diff --git a/c3.js b/c3.js index 8575cae..d8799f7 100644 --- a/c3.js +++ b/c3.js @@ -1939,22 +1939,11 @@ return gridData.slice(0, tickNum); } - //-- Circle --// - - function circleX(d) { - return d.x || d.x === 0 ? x(d.x) : null; - } - function circleY(d, i) { - var lineIndices = getLineIndices(), getPoint = generateGetLinePoint(lineIndices); - if (__data_groups.length > 0) { var point = getPoint(d, i); return point[0][1]; } - return getYScale(d.id)(d.value); - } - - //-- Bar --// + //-- Shape --// - function getBarIndices() { + function getShapeIndices(typeFilter) { var indices = {}, i = 0, j, k; - filterTargetsToShow(c3.data.targets.filter(isBarType)).forEach(function (d) { + filterTargetsToShow(c3.data.targets.filter(typeFilter)).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++) { @@ -1969,27 +1958,27 @@ indices.__max__ = i - 1; return indices; } - function getBarX(barW, barTargetsNum, barIndices, isSub) { + function getShapeX(offset, targetsNum, indices, isSub) { var scale = isSub ? subX : x; return function (d) { - var barIndex = d.id in barIndices ? barIndices[d.id] : 0; - return d.x || d.x === 0 ? scale(d.x) - barW * (barTargetsNum / 2 - barIndex) : 0; + var index = d.id in indices ? indices[d.id] : 0; + return d.x || d.x === 0 ? scale(d.x) - offset * (targetsNum / 2 - index) : 0; }; } - function getBarY(isSub) { + function getShapeY(isSub) { return function (d) { var scale = isSub ? getSubYScale(d.id) : getYScale(d.id); return scale(d.value); }; } - function getBarOffset(barIndices, isSub) { - var targets = orderTargets(filterTargetsToShow(c3.data.targets.filter(isBarType))), + function getShapeOffset(typeFilter, indices, isSub) { + var targets = orderTargets(filterTargetsToShow(c3.data.targets.filter(typeFilter))), targetIds = targets.map(function (t) { return t.id; }); return function (d, i) { var scale = isSub ? getSubYScale(d.id) : getYScale(d.id), y0 = scale(0), offset = y0; targets.forEach(function (t) { - if (t.id === d.id || barIndices[t.id] !== barIndices[d.id]) { return; } + if (t.id === d.id || indices[t.id] !== indices[d.id]) { return; } if (targetIds.indexOf(t.id) < targetIds.indexOf(d.id) && t.values[i].value * d.value > 0) { offset += scale(t.values[i].value) - y0; } @@ -1997,104 +1986,21 @@ return offset; }; } - function getBarW(axis, barTargetsNum) { - return typeof __bar_width === 'number' ? __bar_width : barTargetsNum ? (axis.tickOffset() * 2 * __bar_width_ratio) / barTargetsNum : 0; - } - //-- Area --// + //-- Circle --// - function getAreaIndices() { // replication of getBarIndices - var indices = {}, i = 0, j, k; - filterTargetsToShow(c3.data.targets.filter(isAreaType)).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++) { - if (__data_groups[j][k] in indices) { - indices[d.id] = indices[__data_groups[j][k]]; - break; - } - } - } - if (isUndefined(indices[d.id])) { indices[d.id] = i++; } - }); - indices.__max__ = i - 1; - return indices; - } - function getAreaX(areaTargetsNum, areaIndices, isSub) { // partial duplication of getBarX - var scale = isSub ? subX : x; - return function (d) { - var areaIndex = d.id in areaIndices ? areaIndices[d.id] : 0; - return d.x || d.x === 0 ? scale(d.x) - 0 * (areaTargetsNum / 2 - areaIndex) : 0; - }; - } - function getAreaY(isSub) { // replication of getBarY - return function (d) { - var scale = isSub ? getSubYScale(d.id) : getYScale(d.id); - return scale(d.value); - }; + function circleX(d) { + return d.x || d.x === 0 ? x(d.x) : null; } - function getAreaOffset(areaIndices, isSub) { // partial duplication of getBarOffset - var targets = orderTargets(filterTargetsToShow(c3.data.targets.filter(isAreaType))), - targetIds = targets.map(function (t) { return t.id; }); - return function (d, i) { - var scale = isSub ? getSubYScale(d.id) : getYScale(d.id), - y0 = scale(0), offset = y0; - targets.forEach(function (t) { - if (t.id === d.id || areaIndices[t.id] !== areaIndices[d.id]) { return; } - if (targetIds.indexOf(t.id) < targetIds.indexOf(d.id) && t.values[i].value > 0) { - offset += scale(t.values[i].value) - y0; - } - }); - return offset; - }; + function circleY(d, i) { + var lineIndices = getShapeIndices(isLineType), getPoint = generateGetLinePoint(lineIndices); + return __data_groups.length > 0 ? getPoint(d, i)[0][1] : getYScale(d.id)(d.value); } - //-- Line --// + //-- Bar --// - function getLineIndices() { // replication of getBarIndices - var indices = {}, i = 0, j, k; - filterTargetsToShow(c3.data.targets.filter(isLineType)).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++) { - if (__data_groups[j][k] in indices) { - indices[d.id] = indices[__data_groups[j][k]]; - break; - } - } - } - if (isUndefined(indices[d.id])) { indices[d.id] = i++; } - }); - indices.__max__ = i - 1; - return indices; - } - function getLineX(lineTargetsNum, lineIndices, isSub) { // partial duplication of getBarX - var scale = isSub ? subX : x; - return function (d) { - var lineIndex = d.id in lineIndices ? lineIndices[d.id] : 0; - return d.x || d.x === 0 ? scale(d.x) - 0 * (lineTargetsNum / 2 - lineIndex) : 0; - }; - } - function getLineY(isSub) { // replication of getBarY - return function (d) { - var scale = isSub ? getSubYScale(d.id) : getYScale(d.id); - return scale(d.value); - }; - } - function getLineOffset(lineIndices, isSub) { // partial duplication of getBarOffset - var targets = orderTargets(filterTargetsToShow(c3.data.targets.filter(isLineType))), - targetIds = targets.map(function (t) { return t.id; }); - return function (d, i) { - var scale = isSub ? getSubYScale(d.id) : getYScale(d.id), - y0 = scale(0), offset = y0; - targets.forEach(function (t) { - if (t.id === d.id || lineIndices[t.id] !== lineIndices[d.id]) { return; } - if (targetIds.indexOf(t.id) < targetIds.indexOf(d.id) && t.values[i].value > 0) { - offset += scale(t.values[i].value) - y0; - } - }); - return offset; - }; + function getBarW(axis, barTargetsNum) { + return typeof __bar_width === 'number' ? __bar_width : barTargetsNum ? (axis.tickOffset() * 2 * __bar_width_ratio) / barTargetsNum : 0; } //-- Type --// @@ -2142,19 +2048,19 @@ } function isLineType(d) { var id = (typeof d === 'string') ? d : d.id; - return !(id in __data_types) || __data_types[id] === 'line' || __data_types[id] === 'spline' || __data_types[id] === 'area' || __data_types[id] === 'area-spline' || __data_types[id] === 'step' || __data_types[id] === 'area-step'; + return !(id in __data_types) || ['line', 'spline', 'area', 'area-spline', 'step', 'area-step'].indexOf(__data_types[id]) >= 0; } function isStepType(d) { var id = (typeof d === 'string') ? d : d.id; - return __data_types[id] === 'step' || __data_types[id] === 'area-step'; + return ['step', 'area-step'].indexOf(__data_types[id]) >= 0; } function isSplineType(d) { var id = (typeof d === 'string') ? d : d.id; - return __data_types[id] === 'spline' || __data_types[id] === 'area-spline'; + return ['spline', 'area-spline'].indexOf(__data_types[id]) >= 0; } function isAreaType(d) { var id = (typeof d === 'string') ? d : d.id; - return __data_types[id] === 'area'; + return ['area', 'area-spline', 'area-step'].indexOf(__data_types[id]) >= 0; } function isBarType(d) { var id = (typeof d === 'string') ? d : d.id; @@ -2330,6 +2236,10 @@ return rect; } + function getInterporate(d) { + return isSplineType(d) ? "cardinal" : isStepType(d) ? "step-after" : "linear"; + } + //-- Selection --// function selectPoint(target, d, i) { @@ -2419,31 +2329,23 @@ } function generateDrawArea(areaIndices, isSub) { - var area, + var area = d3.svg.area(), getPoint = generateGetAreaPoint(areaIndices, isSub), - yScaleGetter = isSub ? getSubYScale : getYScale; + yScaleGetter = isSub ? getSubYScale : getYScale, + value0 = function (d, i) { + return __data_groups.length > 0 ? getPoint(d, i)[0][1] : yScaleGetter(d.id)(0); + }, + value1 = function (d, i) { + return __data_groups.length > 0 ? getPoint(d, i)[1][1] : yScaleGetter(d.id)(d.value); + }; - if (__axis_rotated) { - area = d3.svg.area() - .x0(function (d) { return yScaleGetter(d.id)(0); }) - .x1(function (d) { return yScaleGetter(d.id)(d.value); }) - .y(xx); - } else { - area = d3.svg.area() - .x(xx) - .y0(function (d, i) { if (__data_groups.length > 0) { var point = getPoint(d, i); return point[0][1]; } return yScaleGetter(d.id)(0); }) - .y1(function (d, i) { if (__data_groups.length > 0) { var point = getPoint(d, i); return point[1][1]; } return yScaleGetter(d.id)(d.value); }); - } + area = __axis_rotated ? area.x0(value0).x1(value1).y(xx) : area.x(xx).y0(value0).y1(value1); return function (d) { var data = filterRemoveNull(d.values), x0, y0; - if (hasType([d], 'area') || hasType([d], 'area-spline')) { - isSplineType(d) ? area.interpolate("cardinal") : area.interpolate("linear"); - return area(data); - } else if (hasType([d], 'area-step')) { - isStepType(d) ? area.interpolate("step-after") : area.interpolate("linear"); - return area(data); + if (isAreaType(d)) { + return area.interpolate(getInterporate(d))(data); } else { x0 = x(data[0].x); y0 = getYScale(d.id)(data[0].value); @@ -2453,13 +2355,15 @@ } function generateDrawLine(lineIndices, isSub) { - var getPoint = generateGetLinePoint(lineIndices, isSub), + var line = d3.svg.line(), + getPoint = generateGetLinePoint(lineIndices, isSub), yScaleGetter = isSub ? getSubYScale : getYScale, xValue = isSub ? subxx : xx, - yValue = function (d, i) { if (__data_groups.length > 0) { var point = getPoint(d, i); return point[0][1]; } return yScaleGetter(d.id)(d.value); }, - line = d3.svg.line() - .x(__axis_rotated ? yValue : xValue) - .y(__axis_rotated ? xValue : yValue); + yValue = function (d, i) { + return __data_groups.length > 0 ? getPoint(d, i)[0][1] : yScaleGetter(d.id)(d.value); + }; + + line = __axis_rotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue); if (!__line_connect_null) { line = line.defined(function (d) { return d.value != null; }); } return function (d) { var data = __line_connect_null ? filterRemoveNull(d.values) : d.values, @@ -2468,8 +2372,7 @@ if (__data_regions[d.id]) { return lineWithRegions(data, x, y, __data_regions[d.id]); } else { - line.interpolate(isSplineType(d) ? "cardinal" : isStepType(d) ? "step-after" : "linear"); - return line(data); + return line.interpolate(getInterporate(d))(data); } } else { if (data[0]) { @@ -2527,32 +2430,32 @@ function generateGetAreaPoint(areaIndices, isSub) { // partial duplication of generateGetBarPoints var areaTargetsNum = areaIndices.__max__ + 1, - x = getAreaX(areaTargetsNum, areaIndices, !!isSub), - y = getAreaY(!!isSub), - areaOffset = getAreaOffset(areaIndices, !!isSub), + x = getShapeX(0, areaTargetsNum, areaIndices, !!isSub), + y = getShapeY(!!isSub), + areaOffset = getShapeOffset(isAreaType, areaIndices, !!isSub), yScale = isSub ? getSubYScale : getYScale; return function (d, i) { - var y0 = yScale(d.id)(0), - offset = areaOffset(d, i) || y0, // offset is for stacked area chart - posX = x(d), posY = y(d); + var y0 = yScale(d.id)(0), + offset = areaOffset(d, i) || y0, // offset is for stacked area chart + posX = x(d), posY = y(d); // fix posY not to overflow opposite quadrant - if (__axis_rotated) { - if ((d.value > 0 && posY < offset) || (d.value < 0 && posY > offset)) { posY = offset; } - } - // 1 point that marks the area position - return [ - [posX, offset], - [posX, posY - (y0 - offset)] - ]; - }; + if (__axis_rotated) { + if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; } + } + // 1 point that marks the area position + return [ + [posX, offset], + [posX, posY - (y0 - offset)] + ]; + }; } function generateGetBarPoints(barIndices, isSub) { var barTargetsNum = barIndices.__max__ + 1, barW = getBarW(xAxis, barTargetsNum), - barX = getBarX(barW, barTargetsNum, barIndices, !!isSub), - barY = getBarY(!!isSub), - barOffset = getBarOffset(barIndices, !!isSub), + barX = getShapeX(barW, barTargetsNum, barIndices, !!isSub), + barY = getShapeY(!!isSub), + barOffset = getShapeOffset(isBarType, barIndices, !!isSub), yScale = isSub ? getSubYScale : getYScale; return function (d, i) { var y0 = yScale(d.id)(0), @@ -2574,23 +2477,23 @@ function generateGetLinePoint(lineIndices, isSub) { // partial duplication of generateGetBarPoints var lineTargetsNum = lineIndices.__max__ + 1, - x = getLineX(lineTargetsNum, lineIndices, !!isSub), - y = getLineY(!!isSub), - lineOffset = getLineOffset(lineIndices, !!isSub), + x = getShapeX(0, lineTargetsNum, lineIndices, !!isSub), + y = getShapeY(!!isSub), + lineOffset = getShapeOffset(isLineType, lineIndices, !!isSub), yScale = isSub ? getSubYScale : getYScale; return function (d, i) { - var y0 = yScale(d.id)(0), - offset = lineOffset(d, i) || y0, // offset is for stacked area chart - posX = x(d), posY = y(d); - // fix posY not to overflow opposite quadrant - if (__axis_rotated) { - if ((d.value > 0 && posY < offset) || (d.value < 0 && posY > offset)) { posY = offset; } - } - // 1 point that marks the line position - return [ - [posX, posY - (y0 - offset)] - ]; - }; + var y0 = yScale(d.id)(0), + offset = lineOffset(d, i) || y0, // offset is for stacked area chart + posX = x(d), posY = y(d); + // fix posY not to overflow opposite quadrant + if (__axis_rotated) { + if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; } + } + // 1 point that marks the line position + return [ + [posX, posY - (y0 - offset)] + ]; + }; } function lineWithRegions(d, x, y, _regions) { @@ -3322,7 +3225,7 @@ function redraw(options, transitions) { var xgrid, xgridAttr, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; var mainLine, mainArea, mainCircle, mainBar, mainArc, mainRegion, mainText, contextLine, contextArea, contextBar, eventRect, eventRectUpdate; - var areaIndices = getAreaIndices(), barIndices = getBarIndices(), lineIndices = getLineIndices(), maxDataCountTarget, tickOffset; + var areaIndices = getShapeIndices(isAreaType), barIndices = getShapeIndices(isBarType), lineIndices = getShapeIndices(isLineType), maxDataCountTarget, tickOffset; var rectX, rectW; var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend, withUpdateTranslate; var hideAxis = hasArcType(c3.data.targets); @@ -4998,7 +4901,7 @@ } function generateTicks(scale) { var i, domain, ticks = []; - if (scale.ticks && tickArguments !== undefined) { + if (scale.ticks) { return scale.ticks.apply(scale, tickArguments); } domain = scale.domain(); diff --git a/c3.min.js b/c3.min.js index dbb0feb..a7d8ca1 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1 +1,3 @@ -(function(e){"use strict";function r(e){return e||e===0}function i(e){return typeof e==="undefined"}function s(e){return typeof e!=="undefined"}function o(e,t){function d(e,t){e.attr("transform",function(e){return"translate("+Math.ceil(t(e)+l)+", 0)"})}function v(e,t){e.attr("transform",function(e){return"translate(0,"+Math.ceil(t(e))+")"})}function m(e){var t=e[0],n=e[e.length-1];return t0&&r[0]>0){r.unshift(r[0]-(r[1]-r[0]))}return r}function y(){var e=n.copy(),r;if(t){r=n.domain();e.domain([r[0],r[1]-1])}return e}function b(e){var n=t&&e=0;return"url("+(n?"":document.URL.split("#")[0])+"#"+t+")"}function fi(e){return Math.ceil(e)+.5}function li(e,t){var r,i,s;if(t&&t.axisX){r=t.axisX}else{r=Ff.select("."+n.axisX);if(e){r=r.transition()}}if(t&&t.axisY){i=t.axisY}else{i=Ff.select("."+n.axisY);if(e){i=i.transition()}}if(t&&t.axisY2){s=t.axisY2}else{s=Ff.select("."+n.axisY2);if(e){s=s.transition()}}Ff.attr("transform",ni.main);r.attr("transform",ni.x);i.attr("transform",ni.y);s.attr("transform",ni.y2);Ff.select("."+n.chartArcs).attr("transform",ni.arc)}function ci(e,t){var r;if(t&&t.axisSubX){r=t.axisSubX}else{r=If.select("."+n.axisX);if(e){r=r.transition()}}If.attr("transform",ni.context);r.attr("transform",ni.subx)}function hi(e){(e?qf.transition():qf).attr("transform",ni.legend)}function pi(e,t){li(e,t);if(ot){ci(e,t)}hi(e)}function gi(){var e=Ki(),t=Ji(),n=ri?0:e,r=Ca(a.data.targets),i=gt||r?0:Li("x"),s=ot&&!r?ut+i:0;Sr=Ei();xr=Si();if(gt){vr={top:Li("y2")+xi(),right:r?0:Ci(),bottom:Li("y")+n+Ti(),left:s+(r?0:Ni())};mr={top:vr.top,right:NaN,bottom:20+n,left:di}}else{vr={top:4+xi(),right:r?0:Ci(),bottom:i+s+n+Ti(),left:r?0:Ni()};mr={top:xr-s-n,right:NaN,bottom:i+n,left:vr.left}}gr={top:ri?0:xr-e,right:NaN,bottom:0,left:ri?Sr-t:0};yr=Sr-vr.left-vr.right;wr=xr-vr.top-vr.bottom;if(yr<0){yr=0}if(wr<0){wr=0}br=gt?vr.left-di-vi:yr;Er=gt?wr:xr-mr.top-mr.bottom;if(br<0){br=0}if(Er<0){Er=0}kr=yr-(ri?t+10:0);Lr=wr-(ri?0:10);bi();if(ri&&r){gr.left=kr/2+Nr*1.1}}function yi(){Ff.select("line."+n.xgridFocus).attr("x1",gt?0:-10).attr("x2",gt?yr:-10).attr("y1",gt?-10:vr.top).attr("y2",gt?-10:wr)}function bi(){Nr=Math.min(kr,Lr)/2;Tr=Nr*.95;var e=_n?(Tr-_n)/Tr:.6;Cr=Na(a.data.targets)||Ta(a.data.targets)?Tr*e:0}function wi(){var e=gt?n.axisX:n.axisY,t=Ff.select("."+e).node(),r=t?t.getBoundingClientRect():{right:0},i=Uf.node().getBoundingClientRect(),s=Ca(a.data.targets),o=r.right-i.left-(s?0:Ni());return o>0?o:0}function Ei(){return p?p:Oi()}function Si(){var e=d?d:Mi();return e>0?e:320}function xi(){return g?g:0}function Ti(){return y?y:0}function Ni(){if(v){return v}else if(gt){return!yt?1:Math.max(rf(ki("x")),40)}else{return!Bt||Rt?1:rf(ki("y"))}}function Ci(){var e=10,t=ri?Ji()+20:0;if(m){return m}else if(gt){return e+t}else{return(!Xt||Qt?e:rf(ki("y2")))+t}}function ki(e){var t=gs(e);return t.isInner?20+Bs(e):40+Bs(e)}function Li(e){if(e==="x"&&!yt){return 0}if(e==="x"&&Dt){return Dt}if(e==="y"&&!Bt){return ct&&!ri?10:1}if(e==="y2"&&!Xt){return mi}return(gs(e).isInner?30:40)+(e==="y2"?-10:0)}function Ai(e){var t=Uf.node(),n;while(t&&t.tagName!=="BODY"){n=t.getBoundingClientRect()[e];if(n){break}t=t.parentNode}return n}function Oi(){return Ai("width")}function Mi(){var e=Uf.style("height");return e.indexOf("px")>0?+e.replace("px",""):0}function _i(e){return e?-(1+30):-(vr.left-1)}function Di(e){return e?-20:-4}function Pi(){return _i(!gt)}function Hi(){return Di(!gt)}function Bi(){return _i(gt)}function ji(){return Di(gt)}function Fi(e){return e?yr+2+30+30:vr.left+20}function Ii(e){return e?(Dt?Dt:0)+80:wr+8}function qi(){return Fi(!gt)}function Ri(){return Ii(!gt)}function Ui(){return Fi(gt)}function zi(){return Ii(gt)}function Wi(){var e=Po(a.data.targets),t,n,r,i,s,o;if(!e){return 0}t=e.values[0],n=e.values[e.values.length-1];r=Rr(n.x)-Rr(t.x);if(r===0){return gt?wr:yr}i=Do();s=Ea(a.data.targets)?(i-(tr?.25:1))/i:1;o=i>1?r*s/(i-1):r;return o<1?1:o}function Xi(e){ii=e}function Vi(e){si=e}function $i(e){oi=e}function Ji(){return ct?ri?si*(ii+1):Sr:0}function Ki(){return ct?ri?xr:oi*(ii+1):0}function Qi(){var e,t,n=!Rr;Dr=gt?1:0;Pr=gt?wr:yr;Hr=gt?0:wr;Br=gt?yr:1;jr=Dr;Fr=Pr;Ir=gt?0:Er;qr=gt?br:1;Rr=Zi(Dr,Pr,n?undefined:Rr.domain(),function(){return $r.tickOffset()});Ur=es(Hr,Br,n?undefined:Ur.domain());zr=es(Hr,Br,n?undefined:zr.domain());Wr=Zi(Dr,Pr,zf,function(e){return e%1?0:Qr.tickOffset()});Xr=es(Ir,qr,n?undefined:Xr.domain());Vr=es(Ir,qr,n?undefined:Vr.domain());e=os();t=Lt?Lt:n?undefined:$r.tickValues();$r=rs(Rr,Yr,e,t);Qr=rs(Wr,ti,e,t);Jr=is(Ur,Zr,Ut,Wt);Kr=is(zr,ei,Gt,Zt);if(!n){Pf.scale(Wr);if(b){Hf.scale(Rr)}}Gi()}function Gi(){Ar=Is();Or=qs();Mr=qs(.98)}function Yi(e,t,n){return(n?u.time.scale():u.scale.linear()).range([e,t])}function Zi(e,t,n,r){var i=Yi(e,t,er),s=n?i.domain(n):i,o;if(tr){r=r||function(){return 0};i=function(e,t){var n=s(e)+r(e);return t?n:Math.ceil(n)}}else{i=function(e,t){var n=s(e);return t?n:Math.ceil(n)}}for(o in s){i[o]=s[o]}i.orgDomain=function(){var e=s.domain();if(zf&&zf[0]===e[0]&&zf[1]=0,isOuter:r.indexOf("outer")>=0,isLeft:r.indexOf("left")>=0,isCenter:r.indexOf("center")>=0,isRight:r.indexOf("right")>=0,isTop:r.indexOf("top")>=0,isMiddle:r.indexOf("middle")>=0,isBottom:r.indexOf("bottom")>=0}}function ds(){return ps("x",gt?"inner-top":"inner-right")}function vs(){return ps("y",gt?"inner-right":"inner-top")}function ms(){return ps("y2",gt?"inner-right":"inner-top")}function gs(e){return e==="y2"?ms():e==="y"?vs():ds()}function ys(){return as("x")}function bs(){return as("y")}function ws(){return as("y2")}function Es(e,t){if(e){return t.isLeft?0:t.isCenter?yr/2:yr}else{return t.isBottom?-wr:t.isMiddle?-wr/2:0}}function Ss(e,t){if(e){return t.isLeft?"0.5em":t.isRight?"-0.5em":"0"}else{return t.isTop?"-0.5em":t.isBottom?"0.5em":"0"}}function xs(e,t){if(e){return t.isLeft?"start":t.isCenter?"middle":"end"}else{return t.isBottom?"start":t.isMiddle?"middle":"end"}}function Ts(){return Es(!gt,ds())}function Ns(){return Es(gt,vs())}function Cs(){return Es(gt,ms())}function ks(){return Ss(!gt,ds())}function Ls(){return Ss(gt,vs())}function As(){return Ss(gt,ms())}function Os(){var e=ds();if(gt){return e.isInner?"1.2em":-25-Bs("x")}else{return e.isInner?"-0.5em":Dt?Dt-10:"3em"}}function Ms(){var e=vs();if(gt){return e.isInner?"-0.5em":"3em"}else{return e.isInner?"1.2em":-20-Bs("y")}}function _s(){var e=ms();if(gt){return e.isInner?"1.2em":"-2.2em"}else{return e.isInner?"-0.5em":30+Bs("y2")}}function Ds(){return xs(!gt,ds())}function Ps(){return xs(gt,vs())}function Hs(){return xs(gt,ms())}function Bs(e){var t=0,r=e==="x"?n.axisX:e==="y"?n.axisY:n.axisY2;u.selectAll("."+r+" .tick text").each(function(){var e=this.getBoundingClientRect();if(tr?r:e.value)}return t?e:null}function Is(){var e=u.svg.arc().outerRadius(Tr).innerRadius(Cr),t=function(t,n){var r;if(n){return e(t)}r=Fs(t);return r?e(r):"M 0 0"};t.centroid=e.centroid;return t}function qs(e){var t=u.svg.arc().outerRadius(Nr*(e?e:1)).innerRadius(Cr);return function(e){var n=Fs(e);return n?t(n):"M 0 0"}}function Rs(e,t){return Ba(e.data)?Ar(e,t):"M 0 0"}function Us(e){var t=Fs(e),n,r,i,s,o,u="";if(t){n=Ar.centroid(t);r=n[0];i=n[1];s=Math.sqrt(r*r+i*i);o=(36/Tr>.375?1.175-36/Tr:.8)*Tr/s;u=On==="arc"?"translate(1,1)":"translate("+r*o+","+i*o+")"}return u}function zs(e){var t=On==="arc"?Math.PI:Math.PI*2;return e?(e.endAngle-e.startAngle)/t:null}function Ws(e){return xo({id:e.data.id,value:e.value,ratio:zs(e)})}function Xs(e){var t,n,r,i;if(!Js()){return""}t=Fs(e);n=t?t.value:null;r=zs(t);i=Ks();return i?i(n,r):Fu(n,r)}function Vs(e,t){var r=Bf.selectAll("."+n.chartArc+Tu(e)),i=Bf.selectAll("."+n.arc).filter(function(t){return t.data.id!==e});if(Wa(e)){r.selectAll("path").transition().duration(50).attr("d",Or).transition().duration(100).attr("d",Mr).each(function(e){if(Ha(e.data)){}})}if(!t){i.style("opacity",.3)}}function $s(e){var t=Bf.selectAll("."+n.chartArc+Tu(e));t.selectAll("path.c3-arc").transition().duration(50).attr("d",Ar);Bf.selectAll("."+n.arc).style("opacity",ft?ft:1)}function Js(){if(Ta(a.data.targets)){return true}return Na(a.data.targets)?Dn:mn}function Ks(){if(Ta(a.data.targets)){return Tn}return Na(a.data.targets)?Pn:gn}function Qs(){return Na(a.data.targets)?Bn:""}function Gs(){if(Ta(a.data.targets)){return typeof kn==="function"?kn:function(){}}var e=Na(a.data.targets)?jn:bn;return typeof e==="function"?e:function(){}}function Ys(){if(Ta(a.data.targets)){return typeof Ln==="function"?Ln:function(){}}var e=Na(a.data.targets)?Fn:wn;return typeof e==="function"?e:function(){}}function Zs(){if(Ta(a.data.targets)){return typeof An==="function"?An:function(){}}var e=Na(a.data.targets)?In:En;return typeof e==="function"?e:function(){}}function eo(e){var t=Bo(e),n=Jo(e),r,i,s,o,a,f;if(P.length>0){f=Qo(e);for(r=0;r=0});if(o.length===0){continue}s=o[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e<0?e:0})}for(i=1;i0)){n[s][t]+=+e}})}}}return u.min(Object.keys(n).map(function(e){return u.min(n[e])}))}function to(e){var t=Bo(e),n=Jo(e),r,i,s,o,a,f;if(P.length>0){f=Go(e);for(r=0;r=0});if(o.length===0){continue}s=o[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e>0?e:0})}for(i=1;i1?n/(i-1)/2:.5}else{s=n*.01}if(typeof _t==="object"&&Ya(_t)){o=r(_t.left)?_t.left:s;u=r(_t.right)?_t.right:s}else if(typeof _t==="number"){o=u=_t}else{o=u=s}return{left:o,right:u}}function oo(e){var t=[ro(e),io(e)],n=t[0],r=t[1],i=so(e),s=0,o=0;if(n-r===0&&!tr){n=er?new Date(n.getTime()*.5):-.5;r=er?new Date(r.getTime()*1.5):.5}if(n||n===0){s=er?new Date(n.getTime()-i.left):n-i.left}if(r||r===0){o=er?new Date(r.getTime()+i.right):r+i.right}return[s,o]}function uo(e){return e[1]-e[0]}function ao(e){for(var t=0;t=0){a.data.xs[t]=e.map(function(e){return e[i]}).filter(r).map(function(e,n){return Co(e,t,n)})}else if(L){s=Object.keys(a.data.xs);a.data.xs[t]=s.length>0?a.data.xs[s[0]]:undefined}else if(Ya(A)){a.data.xs[t]=bo(i,a.data.targets)}}else{a.data.xs[t]=e.map(function(e,t){return t})}});t.forEach(function(e){if(!a.data.xs[e]){throw new Error('x is not defined for id = "'+e+'".')}});i=t.map(function(t,n){var r=M(t);return{id:r,id_org:t,values:e.map(function(e,i){var s=yo(t),o=e[s],u=Co(o,t,i);if(nr&&tr&&n===0&&o){if(i===0){Et=[]}Et.push(o)}if(typeof e[t]==="undefined"||a.data.xs[t].length<=i){u=undefined}return{x:u,value:e[t]!==null&&!isNaN(e[t])?+e[t]:null,id:r}}).filter(function(e){return typeof e.x!=="undefined"})}});i.forEach(function(e){var t;e.values=e.values.sort(function(e,t){var n=e.x||e.x===0?e.x:Infinity,r=t.x||t.x===0?t.x:Infinity;return n-r});t=0;e.values.forEach(function(e){e.index=t++})});if(B){ba(Bo(i).filter(function(e){return!(e in j)}),B)}i.forEach(function(e){fo(e.id_org,e)});return i}function Oo(e){return{id:e.id,id_org:e.id_org,values:e.values.map(function(e){return{x:e.x,value:e.value,id:e.id}})}}function Mo(e){return e>0&&a.data.targets[0].values[e-1]?a.data.targets[0].values[e-1].x:undefined}function _o(e){return e1){e.forEach(function(e){if(e.values.length>n){r=e;n=e.values.length}})}else{r=t?e[0]:null}return r}function Ho(e){var t=Po(e),n,r;if(!t){return[0,0]}n=t.values[0],r=t.values[t.values.length-1];return[n.x,r.x]}function Bo(e){return e.map(function(e){return e.id})}function jo(e){return e?typeof e==="string"?[e]:e:Bo(a.data.targets)}function Fo(e,t){var n=Bo(e),r;for(r=0;r2){o=r-2;i=e[0];s=e[e.length-1];u=(s-i)/(o+1);n=[i];for(a=0;a0})}function Yo(e){return e=0;n--){if(r!==e[n].x){break}i.push(e[n])}for(n=t;n0?s=o:i=o;if(s-i===1||i===0&&s===0){f=[];if(e[i].x||e[i].x===0){f=f.concat(Wu(e,i))}if(e[s].x||e[s].x===0){f=f.concat(Wu(e,s))}return $u(f,t)}return Xu(e,t,i,s)}function Vu(e,t){var n;n=e.map(function(e){return Xu(e.values,t)});return $u(n,t)}function $u(e,t){var n,r;e.forEach(function(e){var i=ef(e,t);if(il){o-=u-l}if(f+i>Si()){f-=i+30}}Rf.style("top",f+"px").style("left",o+"px")}function ea(){Rf.style("display","none")}function ta(e){var t=e.filter(function(e){return e&&r(e.value)});if(!Rn){return}if(Sa(a.data.targets)||Ca(a.data.targets)){return}var i=Ff.selectAll("line."+n.xgridFocus);i.style("visibility","visible").data([t[0]]).attr(gt?"y1":"x1",qu).attr(gt?"y2":"x2",qu);el(i,"grid")}function na(){Ff.select("line."+n.xgridFocus).style("visibility","hidden")}function ra(e,t){var r=[],i,s,o,u,a=Ff.select("."+n.axisX).selectAll(".tick").size();if(e==="year"){i=oo();s=i[0].getFullYear();o=i[1].getFullYear();for(u=s;u<=o;u++){r.push(new Date(u+"-01-01 00:00:00"))}}else{r=t.ticks(10)}return r.slice(0,a)}function ia(e){return e.x||e.x===0?Rr(e.x):null}function sa(e,t){var n=va(),r=_f(n);if(P.length>0){var i=r(e,t);return i[0][1]}return ts(e.id)(e.value)}function oa(){var e={},t=0,n,r;Ro(a.data.targets.filter(Ma)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function la(e,t){return typeof dn==="number"?dn:t?e.tickOffset()*2*vn/t:0}function ca(){var e={},t=0,n,r;Ro(a.data.targets.filter(Oa)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function va(){var e={},t=0,n,r;Ro(a.data.targets.filter(ka)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function ba(e,t){jo(e).forEach(function(e){Xf[e]=t===j[e];j[e]=t});if(!e){B=t}}function wa(e,t){var n=false;e.forEach(function(e){if(j[e.id]===t){n=true}if(!(e.id in j)&&t==="line"){n=true}});return n}function Ea(e){return wa(e,"bar")}function Sa(e){return wa(e,"scatter")}function xa(e){return B==="pie"||wa(e,"pie")}function Ta(e){return wa(e,"gauge")}function Na(e){return B==="donut"||wa(e,"donut")}function Ca(e){return xa(e)||Na(e)||Ta(e)}function ka(e){var t=typeof e==="string"?e:e.id;return!(t in j)||j[t]==="line"||j[t]==="spline"||j[t]==="area"||j[t]==="area-spline"}function La(e){var t=typeof e==="string"?e:e.id;return!(t in j)||j[t]==="step"||j[t]==="area-step"}function Aa(e){var t=typeof e==="string"?e:e.id;return j[t]==="spline"||j[t]==="area-spline"}function Oa(e){var t=typeof e==="string"?e:e.id;return j[t]==="area"}function Ma(e){var t=typeof e==="string"?e:e.id;return j[t]==="bar"}function _a(e){var t=typeof e==="string"?e:e.id;return j[t]==="scatter"}function Da(e){var t=typeof e==="string"?e:e.id;return j[t]==="pie"}function Pa(e){var t=typeof e==="string"?e:e.id;return j[t]==="gauge"}function Ha(e){var t=typeof e==="string"?e:e.id;return j[t]==="donut"}function Ba(e){return Da(e)||Ha(e)||Pa(e)}function ja(e){return ka(e)?[e]:[]}function Fa(e){return La(e)?[e]:[]}function Ia(e){return Ba(e.data)?[e]:[]}function qa(e){return Ma(e)?e.values:[]}function Ra(e){return ka(e)||_a(e)?e.values:[]}function Ua(e){return ka(e)||La(e)?[e]:[]}function za(e){return Ma(e)||ka(e)?e.values:[]}function Wa(e){return Ha(e)&&Hn||Da(e)&&yn}function Xa(e,t,n){var r=[];return function(i){var s=i.id||i,o;if(e[s]instanceof Function){o=e[s](i)}else if(e[s]){o=e[s]}else{if(r.indexOf(s)<0){r.push(s)}o=t[r.indexOf(s)%t.length]}return n instanceof Function?n(o,i):o}}function Va(e,t){var n=e,r=t;return function(e){for(var t=1;t0}function Za(e,t){var n=false;Object.keys(e).forEach(function(r){if(e[r]===t){n=true}});return n}function ef(e,t){var n=ss(e.id)==="y"?Ur:zr,r=gt?1:0,i=gt?0:1;return Math.pow(Rr(e.x)-t[r],2)+Math.pow(n(e.value)-t[i],2)}function tf(e,t){var n=0;e.each(function(){++n}).each("end",function(){if(!--n){t.apply(this,arguments)}})}function nf(e,t,n){return s(e[t])?e[t]:n}function rf(e){return Math.ceil(e/10)*10}function sf(e,t){var n;u.select("body").selectAll(".dummy").data([e]).enter().append("text").classed(t?t:"",true).text(e).each(function(){n=this.getBoundingClientRect()}).remove();return n}function of(e,t,r){Y(t,e.node());Ff.select("."+n.selectedCircles+xu(t.id)).selectAll("."+n.selectedCircle+"-"+r).data([t]).enter().append("circle").attr("class",function(){return Zo(n.selectedCircle,r)}).attr("cx",gt?sa:ia).attr("cy",gt?ia:sa).attr("stroke",function(){return fr(t)}).attr("r",gf(t)*1.4).transition().duration(100).attr("r",gf)}function uf(e,t,r){Z(t,e.node());Ff.select("."+n.selectedCircles+xu(t.id)).selectAll("."+n.selectedCircle+"-"+r).transition().duration(100).attr("r",0).remove()}function af(e,t,n,r){e?of(t,n,r):uf(t,n,r)}function ff(e,t){Y(t,e.node());e.transition().duration(100).style("fill",function(){return u.rgb(fr(t)).brighter(.75)})}function lf(e,t){Z(t,e.node());e.transition().duration(100).style("fill",function(){return fr(t)})}function cf(e,t,n,r){e?ff(t,n,r):lf(t,n,r)}function hf(e,t,n,r){cf(e,t,n.data,r)}function pf(e){return e.nodeName==="circle"?af:u.select(e).classed(n.bar)?cf:hf}function df(e){return e.filter(function(e){return r(e.value)})}function vf(e){return un?typeof an==="function"?an(e):an:0}function mf(e){return ln?cn?cn:vf(e)*1.75:vf(e)}function gf(e){return hn?hn:vf(e)*4}function yf(e,t){return(t?Ff.selectAll("."+n.circles+xu(t)):Ff).selectAll("."+n.circle+(r(e)?"-"+e:""))}function bf(e,t){yf(e,t).classed(n.EXPANDED,true).attr("r",mf)}function wf(e){yf(e).filter(function(){return u.select(this).classed(n.EXPANDED)}).classed(n.EXPANDED,false).attr("r",vf)}function Ef(e){return Ff.selectAll("."+n.bar+(r(e)?"-"+e:""))}function Sf(e){Ef(e).classed(n.EXPANDED,true)}function xf(e){Ef(e).classed(n.EXPANDED,false)}function Tf(e,t){var n,r=Of(e,t),i=t?ns:ts;if(gt){n=u.svg.area().x0(function(e){return i(e.id)(0)}).x1(function(e){return i(e.id)(e.value)}).y(qu)}else{n=u.svg.area().x(qu).y0(function(e,t){if(P.length>0){var n=r(e,t);return n[0][1]}return i(e.id)(0)}).y1(function(e,t){if(P.length>0){var n=r(e,t);return n[1][1]}return i(e.id)(e.value)})}return function(e){var t=df(e.values),r,i;if(wa([e],"area")||wa([e],"area-spline")){Aa(e)?n.interpolate("cardinal"):n.interpolate("linear");return n(t)}else if(wa([e],"area-step")){La(e)?n.interpolate("step-after"):n.interpolate("linear");return n(t)}else{r=Rr(t[0].x);i=ts(e.id)(t[0].value);return gt?"M "+i+" "+r:"M "+r+" "+i}}}function Nf(e,t){var n=_f(e,t),r=t?ns:ts,i=t?zu:qu,s=function(e,t){if(P.length>0){var i=n(e,t);return i[0][1]}return r(e.id)(e.value)},o=u.svg.line().x(gt?s:i).y(gt?i:s);if(!pn){o=o.defined(function(e){return e.value!=null})}return function(e){var n=pn?df(e.values):e.values,i=t?i:Wr,s=r(e.id),u=0,a=0;if(ka(e)){if(q[e.id]){return Df(n,i,s,q[e.id])}else{o.interpolate(Aa(e)?"cardinal":"linear");return o(n)}}else if(La(e)){o.interpolate("step-after");return o(n)}else{if(n[0]){u=i(n[0].x);a=s(n[0].value)}return gt?"M "+a+" "+u:"M "+u+" "+a}}}function Cf(e,t){var n=Mf(e,t);return function(e,t){var r=n(e,t);var i=gt?1:0;var s=gt?0:1;var o="M "+r[0][i]+","+r[0][s]+" "+"L"+r[1][i]+","+r[1][s]+" "+"L"+r[2][i]+","+r[2][s]+" "+"L"+r[3][i]+","+r[3][s]+" "+"z";return o}}function kf(e,t){var n=Mf(e,false),r=t?Lf:Af;return function(e,t){return r(n(e,t),e,this)}}function Lf(e,t){var n;if(gt){n=Ma(t)?4:6;return e[2][1]+n*(t.value<0?-1:1)}else{return e[0][0]+(e[2][0]-e[0][0])/2}}function Af(e,t,n){var r=n.getBoundingClientRect();if(gt){return(e[0][0]+e[2][0]+r.height*.6)/2}else{return e[2][1]+(t.value<0?r.height:Ma(t)?-3:-6)}}function Of(e,t){var n=e.__max__+1,r=ha(n,e,!!t),i=pa(!!t),s=da(e,!!t),o=t?ns:ts;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(gt){if(e.value>0&&fu){f=u}}return[[a,u],[a,f-(n-u)]]}}function Mf(e,t){var n=e.__max__+1,r=la($r,n),i=ua(r,n,e,!!t),s=aa(!!t),o=fa(e,!!t),u=t?ns:ts;return function(e,t){var n=u(e.id)(0),a=o(e,t)||n,f=i(e),l=s(e);if(gt){if(00&&fu){f=u}}return[[a,f-(n-u)]]}}function Df(e,t,n,r){var o=-1,u,a;var f="M",l;var c,h,p,d,v,m,g;var y,b;var w=[];if(s(r)){for(u=0;u=0){u.select(this).style("display",t%mt?"none":"block")}})}else{Bf.selectAll("."+n.axisX+" .tick text").style("display","block")}}if(!gt&&At){hs(Gr.x,t.axisX,At)}G=Tf(_,false);Z=Cf(D);tt=Nf(P,false);it=kf(D,true);st=kf(D,false);Xr.domain(Ur.domain());Vr.domain(zr.domain());Rf.style("display","none");yi();Ff.select("line."+n.xgridFocus).style("visibility","hidden");if(en){o=ra(tn,Rr);B=tr?$r.tickOffset():0;s=gt?{x1:0,x2:yr,y1:function(e){return Rr(e)-B},y2:function(e){return Rr(e)-B}}:{x1:function(e){return Rr(e)+B},x2:function(e){return Rr(e)+B},y1:vr.top,y2:wr};i=Ff.select("."+n.xgrids).selectAll("."+n.xgrid).data(o);i.enter().append("line").attr("class",n.xgrid);i.attr(s).style("opacity",function(){return+u.select(this).attr(gt?"y1":"x1")===(gt?wr:0)?0:1});i.exit().remove()}if(Ya(nn)){f=Ff.select("."+n.xgridLines).selectAll("."+n.xgridLine).data(nn);l=f.enter().append("g").attr("class",function(e){return n.xgridLine+(e.class?e.class:"")});l.append("line").style("opacity",0);l.append("text").attr("text-anchor","end").attr("transform",gt?"":"rotate(-90)").attr("dx",gt?0:-vr.top).attr("dy",-5).style("opacity",0);f.select("line").transition().duration(ut).attr("x1",gt?0:Ru).attr("x2",gt?yr:Ru).attr("y1",gt?Ru:vr.top).attr("y2",gt?Ru:wr).style("opacity",1);f.select("text").transition().duration(ut).attr("x",gt?yr:0).attr("y",Ru).text(function(e){return e.text}).style("opacity",1);f.exit().transition().duration(ut).style("opacity",0).remove()}if(I&&rn){c=Ff.select("."+n.ygrids).selectAll("."+n.ygrid).data(Ur.ticks(on));c.enter().append("line").attr("class",n.ygrid);c.attr("x1",gt?Ur:0).attr("x2",gt?Ur:yr).attr("y1",gt?0:Ur).attr("y2",gt?wr:Ur);c.exit().remove();el(c,"grid")}if(I&&Ya(sn)){h=Ff.select("."+n.ygridLines).selectAll("."+n.ygridLine).data(sn);p=h.enter().append("g").attr("class",function(e){return n.ygridLine+(e.class?e.class:"")});p.append("line").style("opacity",0);p.append("text").attr("text-anchor","end").attr("transform",gt?"rotate(-90)":"").attr("dx",gt?0:-vr.top).attr("dy",-5).style("opacity",0);h.select("line").transition().duration(ut).attr("x1",gt?Uu:0).attr("x2",gt?Uu:yr).attr("y1",gt?0:Uu).attr("y2",gt?wr:Uu).style("opacity",1);h.select("text").transition().duration(ut).attr("x",gt?0:yr).attr("y",Uu).text(function(e){return e.text}).style("opacity",1);h.exit().transition().duration(ut).style("opacity",0).remove()}E=Ff.select("."+n.regions).selectAll("."+n.region).data(qn);E.enter().append("g").attr("class",du).append("rect").style("fill-opacity",0);E.selectAll("rect").transition().duration(ut).attr("x",co).attr("y",ho).attr("width",po).attr("height",vo).style("fill-opacity",function(e){return r(e.opacity)?e.opacity:.1});E.exit().transition().duration(ut).style("opacity",0).remove();y=Ff.selectAll("."+n.bars).selectAll("."+n.bar).data(qa);y.enter().append("path").attr("class",au).style("stroke",function(e){return fr(e.id)}).style("stroke-width",2).style("opacity",0).style("fill",function(e){return fr(e.id)}).style("fill-opacity",function(){if(ft){return ft}return Lu});y.style("opacity",Lu).transition().duration(ut).attr("d",Z).style("fill",fr).style("opacity",1);y.exit().transition().duration(at).style("opacity",0).remove();d=Ff.selectAll("."+n.lines).selectAll("."+n.line).data(ja);d.enter().append("path").attr("class",iu).style("stroke",fr);d.style("opacity",Lu).transition().duration(ut).attr("d",tt).style("stroke",fr).style("opacity",1);d.exit().transition().duration(at).style("opacity",0).remove();v=Ff.selectAll("."+n.steps).selectAll("."+n.step).data(Fa);v.enter().append("path").attr("class",mu).style("stroke",fr);v.style("opacity",Lu).transition().duration(ut).attr("d",tt).style("stroke",fr).style("opacity",1);v.exit().transition().duration(at).style("opacity",0).remove();m=Ff.selectAll("."+n.areas).selectAll("."+n.area).data(Ua);m.enter().append("path").attr("class",hu).style("fill",fr).style("opacity",function(){Wf=+u.select(this).style("opacity");return 0});m.style("opacity",0).transition().duration(ut).attr("d",G).style("fill",fr).style("opacity",Wf);m.exit().transition().duration(at).style("opacity",0).remove();if(un){g=Ff.selectAll("."+n.circles).selectAll("."+n.circle).data(Ra);g.enter().append("circle").attr("class",ou).attr("r",vf).style("fill",fr);g.style("opacity",Lu).transition().duration(ut).style("opacity",Ou).style("fill",fr).attr("cx",gt?sa:ia).attr("cy",gt?ia:sa);g.exit().remove()}if(_u()){x=Ff.selectAll("."+n.texts).selectAll("."+n.text).data(za);x.enter().append("text").attr("class",eu).attr("text-anchor",function(e){return gt?e.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",fr).style("fill-opacity",0);x.text(function(e){return Iu(e.id)(e.value,e.id)}).style("fill-opacity",Au).transition().duration(ut).attr("x",it).attr("y",st).style("fill",fr).style("fill-opacity",Mu);x.exit().transition().duration(at).style("fill-opacity",0).remove()}w=Ff.selectAll("."+n.arcs).selectAll("."+n.arc).data(Ia);if(On==="arc"){w.enter().append("path").attr("class","").style("opacity",1).style("fill",Sn).style("cursor","pointer").attr("transform","scale(1,1)").attr("d",function(e){e.value=Nn;e.startAngle=-1*(Math.PI/2);e.endAngle=Math.PI/2;return Rs(e,true)});w.exit().transition().duration(at).style("opacity",0).remove()}w.enter().append("path").attr("class",lu).style("fill",function(e){return fr(e.data)}).style("cursor",function(e){return $(e)?"pointer":null}).style("opacity",0).each(function(e){this._current=e}).on("mouseover",function(e,t){var n,r,i;if(ur){return}n=Fs(e);r=Ws(n);i=Ys();Vs(n.data.id);dl(n.data.id,true);i(r,t)}).on("mousemove",function(e){var t=Fs(e),n=Ws(t),r=[n];Zu(r,u.mouse(this))}).on("mouseout",function(e,t){var n,r,i;if(ur){return}n=Fs(e);r=Ws(n);i=Zs();$s(n.data.id);vl();ea();i(r,t)}).on("click",function(e,t){var n=Fs(e),r=Ws(n),i=Gs();Qf(this,e,t);i(r,t)});w.attr("transform",W?"scale(0)":"").style("opacity",function(e){return e===this._current?0:1}).each(function(){ur=true}).transition().duration(ut).attrTween("d",function(e){var t=Fs(e),n;if(!t){return function(){return"M 0 0"}}if(isNaN(this._current.endAngle)){this._current.endAngle=this._current.startAngle}n=u.interpolate(this._current,t);this._current=n(0);return function(e){return Rs(n(e),true)}}).attr("transform",W?"scale(1)":"").style("fill",function(e){return On==="arc"&<?lr(e.data.values[0].value):fr(e.data.id)}).style("opacity",ft?ft:1).call(tf,function(){ur=false});w.exit().transition().duration(at).style("opacity",0).remove();Ff.selectAll("."+n.chartArc).select("text").style("opacity",0).text(Xs).attr("transform",Us).transition().duration(ut).style("opacity",function(e){return Io(e.data.id)&&Ba(e.data)?1:0});if(On==="arc"){Ff.selectAll("."+n.chartArc).select("text.units").attr("transform",Us).style("opacity",0).transition().duration(ut).text(xn?Mn:"").style("opacity",function(e){return Io(e.data.id)&&Ba(e.data)?1:0});Ff.selectAll("."+n.chartArc).select("text.min").attr("transform",Us).style("opacity",0).transition().duration(ut).text(xn?Cn:"").style("opacity",function(e){return Io(e.data.id)&&Ba(e.data)?1:0});Ff.selectAll("."+n.chartArc).select("text.max").attr("transform",Us).style("opacity",0).transition().duration(ut).text(xn?Nn:"").style("opacity",function(e){return Io(e.data.id)&&Ba(e.data)?1:0})}Ff.select("."+n.chartArcsTitle).style("opacity",Na(a.data.targets)||Ta(a.data.targets)?1:0);if(ot){if(u.event&&u.event.type==="zoom"){Pf.extent(Rr.orgDomain()).update()}if(q){if(!gt&&At){hs(Gr.subx,t.axisSubX,At)}if(!Pf.empty()){Pf.extent(Rr.orgDomain()).update()}Y=Tf(_,true);et=Cf(D,true);rt=Nf(P,true);L=If.selectAll("."+n.bars).selectAll("."+n.bar).data(qa);L.enter().append("path").attr("class",au).style("stroke","none").style("fill",fr);L.style("opacity",Lu).transition().duration(ut).attr("d",et).style("opacity",1);L.exit().transition().duration(ut).style("opacity",0).remove();T=If.selectAll("."+n.lines).selectAll("."+n.line).data(ja);T.enter().append("path").attr("class",iu).style("stroke",fr);T.style("opacity",Lu).transition().duration(ut).attr("d",rt).style("opacity",1);T.exit().transition().duration(ut).style("opacity",0).remove();N=If.selectAll("."+n.steps).selectAll("."+n.step).data(Fa);N.enter().append("path").attr("class",iu).style("stroke",fr);N.style("opacity",Lu).transition().duration(ut).attr("d",rt).style("opacity",1);N.exit().transition().duration(ut).style("opacity",0).remove();C=If.selectAll("."+n.areas).selectAll("."+n.area).data(La?Fa:ja);C.enter().append("path").attr("class",hu).style("fill",fr).style("opacity",function(){Wf=+u.select(this).style("opacity");return 0});C.style("opacity",0).transition().duration(ut).attr("d",Y).style("fill",fr).style("opacity",Wf);C.exit().transition().duration(at).style("opacity",0).remove()}}Ff.selectAll("."+n.selectedCircles).filter(function(e){return Ma(e)}).selectAll("circle").remove();Ff.selectAll("."+n.selectedCircle).transition().duration(ut).attr("cx",gt?sa:ia).attr("cy",gt?ia:sa);if(S){O=Ff.select("."+n.eventRects);if(Ya(A)&&!So(A)){if(!O.classed(n.eventRectsMultiple)){O.classed(n.eventRectsMultiple,true).classed(n.eventRectsSingle,false).selectAll("."+n.eventRect).remove()}M=Ff.select("."+n.eventRects).selectAll("."+n.eventRect).data([0]);Kf(M.enter());M.attr("x",0).attr("y",0).attr("width",yr).attr("height",wr)}else{if(!O.classed(n.eventRectsSingle)){O.classed(n.eventRectsMultiple,false).classed(n.eventRectsSingle,true).selectAll("."+n.eventRect).remove()}if((nr||er)&&!tr){F=function(e,t){var n=Mo(t),r=_o(t),i=a.data.xs[e.id][t];var s=Rr(r?r:i);var o=Rr(n?n:i);return(s-o)/2};j=function(e,t){var n=Mo(t),r=a.data.xs[e.id][t];return(Rr(r)+Rr(n?n:r))/2}}else{F=Wi();j=function(e){return Rr(e.x)-F/2}}H=Po(a.data.targets);Ff.select("."+n.eventRects).datum(H?H.values:[]);M=Ff.select("."+n.eventRects).selectAll("."+n.eventRect).data(function(e){return e});Jf(M.enter());M.attr("class",vu).attr("x",gt?0:j).attr("y",gt?j:0).attr("width",gt?yr:F).attr("height",gt?F:wr);M.exit().remove()}}Bo(a.data.targets).forEach(function(e){Xf[e]=true})}function nl(){tl({withTransition:false,withY:false,withSubchart:false,withUpdateXDomain:true})}function rl(){if(Ro(a.data.targets).length===0){return}if(u.event.sourceEvent.type==="mousemove"&&Hf.altDomain){Rr.domain(Hf.altDomain);Hf.scale(Rr).updateScaleExtent();return}if(tr&&Rr.orgDomain()[0]===zf[0]){Rr.domain([zf[0]-1e-10,Rr.orgDomain()[1]])}tl({withTransition:false,withY:false,withSubchart:false});if(u.event.sourceEvent.type==="mousemove"){sr=true}}function il(){function t(){e.forEach(function(e){e()})}var e=[];t.add=function(t){e.push(t)};return t}function sl(){Bf.attr("width",Sr).attr("height",xr);Bf.select("#"+Jn).select("rect").attr("width",yr).attr("height",wr);Bf.select("#"+Kn).select("rect").attr("x",Pi).attr("y",Hi).attr("width",qi).attr("height",Ri);Bf.select("#"+Qn).select("rect").attr("x",Bi).attr("y",ji).attr("width",Ui).attr("height",zi);Bf.select("."+n.zoomRect).attr("width",yr).attr("height",wr);Uf.style("max-height",xr+"px")}function ol(e){return{axisX:e?Gr.x.transition().duration(e):Gr.x,axisY:e?Gr.y.transition().duration(e):Gr.y,axisY2:e?Gr.y2.transition().duration(e):Gr.y2,axisSubX:e?Gr.subx.transition().duration(e):Gr.subx}}function ul(e){var t;e=e||{};e.withTransition=nf(e,"withTransition",true);e.withTransform=nf(e,"withTransform",false);e.withLegend=nf(e,"withLegend",false);e.withUpdateXDomain=true;e.withUpdateOrgXDomain=true;e.withTransitionForExit=false;if(!(e.withLegend&&ct)){t=ol(e.withTransitionForAxis?k:0);gi();Qi();sl();pi(e.withTransition,t)}tl(e,t)}function al(e){var t,r,i,s,o,u,a,f;var l,c,h,p;a=Ff.select("."+n.chartTexts).selectAll("."+n.chartText).data(e).attr("class",bu);f=a.enter().append("g").attr("class",bu).style("opacity",0).style("pointer-events","none");f.append("g").attr("class",tu);s=Ff.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Eu);i=s.enter().append("g").attr("class",Eu).style("opacity",0).style("pointer-events","none");i.append("g").attr("class",fu).style("cursor",function(e){return $(e)?"pointer":null});r=Ff.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",wu);t=r.enter().append("g").attr("class",wu).style("opacity",0).style("pointer-events","none");t.append("g").attr("class",su);t.append("g").attr("class",gu);t.append("g").attr("class",pu);t.append("g").attr("class",function(e){return Zo(n.selectedCircles,e.id)});t.append("g").attr("class",uu).style("cursor",function(e){return $(e)?"pointer":null});e.forEach(function(e){Ff.selectAll("."+n.selectedCircles+xu(e.id)).selectAll("."+n.selectedCircle).each(function(t){t.value=e.values[t.index].value})});u=Ff.select("."+n.chartArcs).selectAll("."+n.chartArc).data(_r(e)).attr("class",Su);o=u.enter().append("g").attr("class",Su);o.append("g").attr("class",cu);o.append("text").attr("dy",On==="arc"?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("font-size",yr/10+"px");if(On==="arc"){o.select("text").style("fill","#000");o.append("text").attr("dy",".75em").attr("class","units").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#000").style("font-size",yr/15+"px");o.append("text").attr("dx",-1*(Cr+(Tr-Cr)/2)+"px").attr("dy","1em").attr("class","min").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",yr/20+"px");o.append("text").attr("dx",Cr+(Tr-Cr)/2+"px").attr("dy","1em").attr("class","max").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",yr/20+"px")}if(ot){p=If.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Eu);h=p.enter().append("g").style("opacity",0).attr("class",Eu);h.append("g").attr("class",fu);c=If.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",wu);l=c.enter().append("g").style("opacity",0).attr("class",wu);l.append("g").attr("class",su);l.append("g").attr("class",gu);l.append("g").attr("class",pu)}Bf.selectAll("."+n.target).filter(function(e){return Io(e.id)}).transition().duration(k).style("opacity",1)}function fl(e,t){if(t.filter){e=e.filter(t.filter)}if(t.type||t.types){e.forEach(function(e){t.types?ba(e.id,t.types[e.id]):ba(e.id,t.type)})}a.data.targets.forEach(function(t){for(var n=0;n=v){v=o}if(!m||u>=m){m=u}c=ri?m:v;if(mt){Object.keys(E).forEach(function(e){E[e]=v});Object.keys(S).forEach(function(e){S[e]=m});l=(f-c*e.length)/2;if(l"+(f||f===0?""+f+"":"")}c=e[a].name;l=o(e[a].value,e[a].ratio,e[a].id,e[a].index);h=On==="arc"&<?lr(e[a].value):i(e[a].id);u+="";u+=""+c+"";u+=""+l+"";u+=""}return u+""}),Xn=c(["tooltip","init","show"],false),Vn=c(["tooltip","init","x"],0),$n=c(["tooltip","init","position"],{top:"0px",left:"50px"});var Jn="c3-"+ +(new Date)+"-clip",Kn=Jn+"-xaxis",Qn=Jn+"-yaxis",Gn=ai(Jn),Yn=ai(Kn),Zn=ai(Qn);var er=bt==="timeseries",tr=bt==="categorized",nr=!er&&(L||Ya(A));var rr=null,ir=false,sr=false,or=false,ur=false;var ar=u.scale.category10().range(),fr=Xa(U,Ya(at)?at:ar,R),lr=Va(at,lt);var cr=wt?u.time.format:u.time.format.utc,hr=cr.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%-m/%-d",function(e){return e.getDay()&&e.getDate()!==1}],["%-m/%-d",function(e){return e.getDate()!==1}],["%-m/%-d",function(e){return e.getMonth()}],["%Y/%-m/%-d",function(){return true}]]);var pr=[],dr=[];var vr,mr,gr,yr,br,wr,Er,Sr,xr;var Tr,Nr,Cr,kr,Lr,Ar,Or,Mr,_r;var Dr,Pr,Hr,Br,jr,Fr,Ir,qr;var Rr,Ur,zr,Wr,Xr,Vr,$r,Jr,Kr,Qr;var Gr={};var Yr=gt?"left":"bottom",Zr=gt?Rt?"top":"bottom":Rt?"right":"left",ei=gt?Qt?"bottom":"top":Qt?"left":"right",ti=gt?"left":"bottom";var ni={main:function(){return"translate("+fi(vr.left)+","+fi(vr.top)+")"},context:function(){return"translate("+fi(mr.left)+","+fi(mr.top)+")"},legend:function(){return"translate("+gr.left+","+gr.top+")"},x:function(){return"translate(0,"+(gt?0:wr)+")"},y:function(){return"translate(0,"+(gt?wr:0)+")"},y2:function(){return"translate("+(gt?0:yr)+","+(gt?1:0)+")"},subx:function(){return"translate(0,"+(gt?0:Er)+")"},arc:function(){return"translate("+kr/2+","+Lr/2+")"}};var ri=ht==="right";var ii=0,si=0,oi=0,ui=.15;var di=30,vi=gt&&!yt?0:30,mi=5;_r=u.layout.pie().value(function(e){return e.values.reduce(function(e,t){return e+t.value},0)});var Pf,Hf=function(){};Pf=u.svg.brush().on("brush",nl);Pf.update=function(){if(If){If.select("."+n.brush).call(this)}return this};Pf.scale=function(e){return gt?this.y(e):this.x(e)};if(b){Hf=u.behavior.zoom().on("zoomstart",function(){Hf.altDomain=u.event.sourceEvent.altKey?Rr.orgDomain():null}).on("zoom",b?rl:null);Hf.scale=function(e){return gt?this.y(e):this.x(e)};Hf.orgScaleExtent=function(){var e=w?w:[1,10];return[e[0],Math.max(Do()/e[1],e[1])]};Hf.updateScaleExtent=function(){var e=uo(Rr.orgDomain())/uo(zf),t=this.orgScaleExtent();this.scaleExtent([t[0]*e,t[1]*e]);return this}}var Bf,jf,Ff,If,qf,Rf,Uf;var zf;var Wf,Xf={};a.focus=function(e){function s(e){Ro(e).transition().duration(100).style("opacity",1)}var t=Bf.selectAll(Tu(e)),r=t.filter(bl),i=t.filter(wl);a.revert();a.defocus();s(r.classed(n.focused,true));s(i);if(Ca(a.data.targets)){Vs(e,true)}dl(e,true)};a.defocus=function(e){function s(e){Ro(e).transition().duration(100).style("opacity",.3)}var t=Bf.selectAll(Tu(e)),r=t.filter(bl),i=t.filter(wl);a.revert();s(r.classed(n.focused,false));s(i);if(Ca(a.data.targets)){$s(e)}dl(e,false)};a.revert=function(e){function s(e){Ro(e).transition().duration(100).style("opacity",1)}var t=Bf.selectAll(Tu(e)),r=t.filter(bl),i=t.filter(wl);s(r.classed(n.focused,false));s(i);if(Ca(a.data.targets)){$s(e)}vl()};a.show=function(e,t){e=jo(e);t=t||{};Xo(e);Bf.selectAll(Nu(e)).transition().style("opacity",1);if(t.withLegend){ml(e)}tl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.hide=function(e,t){e=jo(e);t=t||{};Wo(e);Bf.selectAll(Nu(e)).transition().style("opacity",0);if(t.withLegend){gl(e)}tl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.toggle=function(e){Io(e)?a.hide(e):a.show(e)};a.unzoom=function(){Pf.clear().update();tl({withUpdateXDomain:true})};a.update=function(e,n){var r=t,i,s,o;for(i=0;i=0,h=!t||t.indexOf(o)>=0,p=a.classed(n.SELECTED);if(a.classed(n.line)||a.classed(n.area)){return}if(c&&h){if($(i)&&!p){l(true,a.classed(n.SELECTED,true),i,o)}}else if(s(r)&&r){if(p){l(false,a.classed(n.SELECTED,false),i,o)}}})};a.unselect=function(e,t){if(!X){return}Ff.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(r,i){var s=u.select(this),o=r.data?r.data.id:r.id,a=pf(this),f=V||!e||e.indexOf(o)>=0,l=!t||t.indexOf(i)>=0,c=s.classed(n.SELECTED);if(s.classed(n.line)||s.classed(n.area)){return}if(f&&l){if($(r)){if(c){a(false,s.classed(n.SELECTED,false),r,i)}}}})};a.toLine=function(e){Sl(e,"line")};a.toSpline=function(e){Sl(e,"spline")};a.toBar=function(e){Sl(e,"bar")};a.toScatter=function(e){Sl(e,"scatter")};a.toArea=function(e){Sl(e,"area")};a.toAreaSpline=function(e){Sl(e,"area-spline")};a.toPie=function(e){Sl(e,"pie",{withTransform:true})};a.toDonut=function(e){Sl(e,"donut",{withTransform:true})};a.groups=function(e){if(i(e)){return P}P=e;tl();return P};a.xgrids=function(e){if(!e){return nn}nn=e;tl();return nn};a.xgrids.add=function(e){if(!e){return}return a.xgrids(nn.concat(e))};a.xgrids.remove=function(e){var t=El(e);return a.xgrids(nn.filter(t))};a.ygrids=function(e){if(!e){return sn}sn=e;tl();return sn};a.ygrids.add=function(e){if(!e){return}return a.ygrids(sn.concat(e))};a.ygrids.remove=function(e){var t=El(e);return a.ygrids(sn.filter(t))};a.regions=function(e){if(!e){return qn}qn=e;tl();return qn};a.regions.add=function(e){if(!e){return qn}qn=qn.concat(e);tl();return qn};a.regions.remove=function(e){var t,r,i;e=e||{};t=nf(e,"duration",k);r=nf(e,"classes",[n.region]);i=Ff.select("."+n.regions).selectAll(r.map(function(e){return"."+e}));(t?i.transition().duration(t):i).style("opacity",0).remove();qn=qn.filter(function(e){var t=false;if(!e.class){return true}e.class.split(" ").forEach(function(e){if(r.indexOf(e)>=0){t=true}});return!t});return qn};a.data.get=function(e){var t=a.data.getAsTarget(e);return s(t)?t.values.map(function(e){return e.value}):undefined};a.data.getAsTarget=function(e){var t=a.data.targets.filter(function(t){return t.id===e});return t.length>0?t[0]:undefined};a.data.names=function(e){if(!arguments.length){return _}Object.keys(e).forEach(function(t){_[t]=e[t]});tl({withLegend:true});return _};a.data.colors=function(e){if(!arguments.length){return U}Object.keys(e).forEach(function(t){U[t]=e[t]});tl({withLegend:true});return U};a.x=function(e){if(arguments.length){To(a.data.targets,e);tl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.xs=function(e){if(arguments.length){No(a.data.targets,e);tl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.axis.labels=function(e){if(arguments.length){Object.keys(e).forEach(function(t){fs(t,e[t])});js()}};a.axis.max=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.x)){Ot=+e.x}if(r(e.y)){jt=+e.y}if(r(e.y2)){Vt=+e.y2}}else{jt=Vt=+e}tl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}};a.axis.min=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.x)){Mt=+e.x}if(r(e.y)){Ft=+e.y}if(r(e.y2)){$t=+e.y2}}else{Ft=$t=+e}tl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}};a.axis.range=function(e){if(arguments.length){if(typeof e.max!=="undefined"){a.axis.max(e.max)}if(typeof e.min!=="undefined"){a.axis.min(e.min)}}};a.legend.show=function(e){ml(jo(e));tl({withLegend:true})};a.legend.hide=function(e){gl(jo(e));tl({withLegend:true})};a.resize=function(e){p=e?e.width:null;d=e?e.height:null;a.flush();a.flush()};a.flush=function(){ul({withLegend:true,withTransition:false,withTransitionForTransform:false})};a.destroy=function(){a.data.targets=undefined;a.data.xs={};Uf.classed("c3",false).html("");e.onresize=null};if("url"in t.data){u.xhr(t.data.url,function(e,t){var n=u.csv.parseRows(t.response),r;if(n.length===1){r=[{}];n[0].forEach(function(e){r[0][e]=null})}else{r=u.csv.parse(t.response)}$f(r)})}else if("rows"in t.data){$f(ko(t.data.rows))}else if("columns"in t.data){$f(Lo(t.data.columns))}else{throw Error("url or rows or columns is required.")}return a};if(typeof define==="function"&&define.amd){define("c3",["d3"],t)}else if("undefined"!==typeof exports&&"undefined"!==typeof module){module.exports=t}else{e.c3=t}})(window) +!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=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=Zj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Zj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Zj.select("."+g.axisY2),a&&(e=e.transition())),Zj.attr("transform",Mj.main),c.attr("transform",Mj.x),d.attr("transform",Mj.y),e.attr("transform",Mj.y2),Zj.select("."+g.chartArcs).attr("transform",Mj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=$j.select("."+g.axisX),a&&(c=c.transition())),$j.attr("transform",Mj.context),c.attr("transform",Mj.subx)}function n(a){(a?_j.transition():_j).attr("transform",Mj.legend)}function o(a,b){l(a,b),Ah&&m(a,b),n(a)}function p(){var a=V(),b=U(),c=Nj?0:a,d=ne($f.data.targets),e=Kh||d?0:A("x"),f=Ah&&!d?Bh+e:0;xg=t(),yg=u(),Kh?(qg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},rg={top:qg.top,right:0/0,bottom:20+c,left:Sj}):(qg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},rg={top:yg-f-c,right:0/0,bottom:e+c,left:qg.left}),sg={top:Nj?0:yg-a,right:0/0,bottom:0,left:Nj?xg-b:0},tg=xg-qg.left-qg.right,vg=yg-qg.top-qg.bottom,0>tg&&(tg=0),0>vg&&(vg=0),ug=Kh?qg.left-Sj-Tj:tg,wg=Kh?vg:yg-rg.top-rg.bottom,0>ug&&(ug=0),0>wg&&(wg=0),Cg=tg-(Nj?b+10:0),Dg=vg-(Nj?0:10),r(),Nj&&d&&(sg.left=Cg/2+1.1*Ag)}function q(){Zj.select("line."+g.xgridFocus).attr("x1",Kh?0:-10).attr("x2",Kh?tg:-10).attr("y1",Kh?-10:qg.top).attr("y2",Kh?-10:vg)}function r(){Ag=Math.min(Cg,Dg)/2,zg=.95*Ag;var a=Yi?(zg-Yi)/zg:.6;Bg=me($f.data.targets)||le($f.data.targets)?zg*a:0}function s(){var a=Kh?g.axisX:g.axisY,b=Zj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=bk.node().getBoundingClientRect(),e=ne($f.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return bg?bg:C()}function u(){var a=cg?cg:D();return a>0?a:320}function v(){return fg?fg:0}function w(){return gg?gg:0}function x(){return dg?dg:Kh?Lh?Math.max(Qe(z("x")),40):1:!bi||gi?1:Qe(z("y"))}function y(){var a=10,b=Nj?U()+20:0;return eg?eg:Kh?a+b:(!ki||pi?a:Qe(z("y2")))+b}function z(a){var b=pb(a);return b.isInner?20+Ib(a):40+Ib(a)}function A(a){return"x"!==a||Lh?"x"===a&&$h?$h:"y"!==a||bi?"y2"!==a||ki?(pb(a).isInner?30:40)+("y2"===a?-10:0):Uj:Eh&&!Nj?10:1:0}function B(a){for(var b,c=bk.node();c&&"BODY"!==c.tagName&&!(b=c.getBoundingClientRect()[a]);)c=c.parentNode;return b}function C(){return B("width")}function D(){var a=bk.style("height");return a.indexOf("px")>0?+a.replace("px",""):0}function E(a){return a?-31:-(qg.left-1)}function F(a){return a?-20:-4}function G(){return E(!Kh)}function H(){return F(!Kh)}function I(){return E(Kh)}function J(){return F(Kh)}function K(a){return a?tg+2+30+30:qg.left+20}function L(a){return a?($h?$h:0)+80:vg+8}function M(){return K(!Kh)}function N(){return L(!Kh)}function O(){return K(Kh)}function P(){return L(Kh)}function Q(){var a,b,c,d,e,f,g=Fc($f.data.targets);return g?(a=g.values[0],b=g.values[g.values.length-1],c=Qg(b.x)-Qg(a.x),0===c?Kh?vg:tg:(d=Ec(),e=ie($f.data.targets)?(d-(tj?.25:1))/d:1,f=d>1?c*e/(d-1):c,1>f?1:f)):0}function R(a){Oj=a}function S(a){Pj=a}function T(a){Qj=a}function U(){return Eh?Nj?Pj*(Oj+1):xg:0}function V(){return Eh?Nj?yg:Qj*(Oj+1):0}function W(){var a,b,c=!Qg;Ig=Kh?1:0,Jg=Kh?vg:tg,Kg=Kh?0:vg,Lg=Kh?tg:1,Mg=Ig,Ng=Jg,Og=Kh?0:wg,Pg=Kh?ug:1,Qg=Z(Ig,Jg,c?void 0:Qg.domain(),function(){return Wg.tickOffset()}),Rg=$(Kg,Lg,c?void 0:Rg.domain()),Sg=$(Kg,Lg,c?void 0:Sg.domain()),Tg=Z(Ig,Jg,ck,function(a){return a%1?0:Zg.tickOffset()}),Ug=$(Og,Pg,c?void 0:Ug.domain()),Vg=$(Og,Pg,c?void 0:Vg.domain()),a=eb(),b=Vh?Vh:c?void 0:Wg.tickValues(),Wg=bb(Qg,Ij,a,b),Zg=bb(Tg,Lj,a,b),Xg=cb(Rg,Jj,hi,ji),Yg=cb(Sg,Kj,qi,si),c||(Vj.scale(Tg),hg&&Wj.scale(Qg)),X()}function X(){Eg=Lb(),Fg=Mb(),Gg=Mb(.98)}function Y(a,b,c){return(c?Zf.time.scale():Zf.scale.linear()).range([a,b])}function Z(a,b,c,d){var e,f=Y(a,b,sj),g=c?f.domain(c):f;tj?(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 ck&&ck[0]===a[0]&&ck[1]a?a.toFixed(0):a};return Qh&&("function"==typeof Qh?a=Qh:sj&&(a=function(a){return a?Dj(Qh)(a):""})),a}function fb(a){var b;return"y"===a?b=fi:"y2"===a?b=oi:"x"===a&&(b=ai),b}function gb(a){var b=fb(a);return"string"==typeof b?b:b?b.text:null}function hb(a,b){var c=fb(a);"string"==typeof c?"y"===a?fi=b:"y2"===a?oi=b:"x"===a&&(ai=b):c&&(c.text=b)}function ib(a){return 10*Math.sin(Math.PI*(a/180))}function jb(a){return 11.5-2.5*(a/15)}function kb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",jb(c)).attr("x",ib(c)).attr("transform","rotate("+c+")")}function lb(a,b){var c=fb(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function mb(){return lb("x",Kh?"inner-top":"inner-right")}function nb(){return lb("y",Kh?"inner-right":"inner-top")}function ob(){return lb("y2",Kh?"inner-right":"inner-top")}function pb(a){return"y2"===a?ob():"y"===a?nb():mb()}function qb(){return gb("x")}function rb(){return gb("y")}function sb(){return gb("y2")}function tb(a,b){return a?b.isLeft?0:b.isCenter?tg/2:tg:b.isBottom?-vg:b.isMiddle?-vg/2:0}function ub(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function vb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function wb(){return tb(!Kh,mb())}function xb(){return tb(Kh,nb())}function yb(){return tb(Kh,ob())}function zb(){return ub(!Kh,mb())}function Ab(){return ub(Kh,nb())}function Bb(){return ub(Kh,ob())}function Cb(){var a=mb();return Kh?a.isInner?"1.2em":-25-Ib("x"):a.isInner?"-0.5em":$h?$h-10:"3em"}function Db(){var a=nb();return Kh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Ib("y")}function Eb(){var a=ob();return Kh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Ib("y2")}function Fb(){return vb(!Kh,mb())}function Gb(){return vb(Kh,nb())}function Hb(){return vb(Kh,ob())}function Ib(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Zf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Jb(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",wb).attr("dx",zb).attr("dy",Cb).text(qb),(a?c.transition():c).attr("x",xb).attr("dx",Ab).attr("dy",Db).attr("dy",Db).text(rb),(a?d.transition():d).attr("x",yb).attr("dx",Bb).attr("dy",Eb).text(sb)}function Kb(a){var b=!1;if(Hg(Mc($f.data.targets)).forEach(function(c){b||c.data.id!==a.data.id||(b=!0,a=c)}),isNaN(a.endAngle)&&(a.endAngle=a.startAngle),ve(a.data)){var c=Si,d=Ri,e=Math.abs(c)+d,f=Math.PI/e;a.startAngle=-1*(Math.PI/2)+f*Math.abs(c),a.endAngle=a.startAngle+f*(a.value>d?d:a.value)}return b?a:null}function Lb(){var a=Zf.svg.arc().outerRadius(zg).innerRadius(Bg),b=function(b,c){var d;return c?a(b):(d=Kb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Mb(a){var b=Zf.svg.arc().outerRadius(Ag*(a?a:1)).innerRadius(Bg);return function(a){var c=Kb(a);return c?b(c):"M 0 0"}}function Nb(a,b){return xe(a.data)?Eg(a,b):"M 0 0"}function Ob(a){var b,c,d,e,f,g=Kb(a),h="";return g&&(b=Eg.centroid(g),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),f=(36/zg>.375?1.175-36/zg:.8)*zg/e,h="arc"===Wi?"translate(1,1)":"translate("+c*f+","+d*f+")"),h}function Pb(a){var b="arc"===Wi?Math.PI:2*Math.PI;return a?(a.endAngle-a.startAngle)/b:null}function Qb(a){return uc({id:a.data.id,value:a.value,ratio:Pb(a)})}function Rb(a){var b,c,d,e;return Ub()?(b=Kb(a),c=b?b.value:null,d=Pb(b),e=Vb(),e?e(c,d):Hd(c,d)):""}function Sb(a,b){var c=Xj.selectAll("."+g.chartArc+td(a)),d=Xj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});De(a)&&c.selectAll("path").transition().duration(50).attr("d",Fg).transition().duration(100).attr("d",Gg).each(function(a){we(a.data)}),b||d.style("opacity",.3)}function Tb(a){var b=Xj.selectAll("."+g.chartArc+td(a));b.selectAll("path."+g.arc).transition().duration(50).attr("d",Eg),Xj.selectAll("."+g.arc).style("opacity",1)}function Ub(){return le($f.data.targets)?!0:me($f.data.targets)?Zi:Ii}function Vb(){return le($f.data.targets)?Qi:me($f.data.targets)?$i:Ji}function Wb(){return me($f.data.targets)?aj:""}function Xb(){if(le($f.data.targets))return"function"==typeof Ti?Ti:function(){};var a=me($f.data.targets)?bj:Li;return"function"==typeof a?a:function(){}}function Yb(){if(le($f.data.targets))return"function"==typeof Ui?Ui:function(){};var a=me($f.data.targets)?cj:Mi;return"function"==typeof a?a:function(){}}function Zb(){if(le($f.data.targets))return"function"==typeof Vi?Vi:function(){};var a=me($f.data.targets)?dj:Ni;return"function"==typeof a?a:function(){}}function $b(a){var b,c,d,e,f,g,h=Hc(a),i=Tc(a);if(eh.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]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Zf.min(Object.keys(i).map(function(a){return Zf.min(i[a])}))}function _b(a){var b,c,d,e,f,g,h=Hc(a),i=Tc(a);if(eh.length>0)for(g=Wc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Zf.max(Object.keys(i).map(function(a){return Zf.max(i[a])}))}function ac(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return db(a.id)===c}),m="y2"===c?mi:di,n="y2"===c?li:ci,o=b(m)?m:$b(l),p=b(n)?n:_b(l),q="y2"===c?ni:ei,r=Bd()&&Kh;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=Cd(o,p),j=fc(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&&ii&&(f=b(ii.top)?ii.top:e,g=b(ii.bottom)?ii.bottom:e),"y2"===c&&ri&&(f=b(ri.top)?ri.top:e,g=b(ri.bottom)?ri.bottom:e),ie(l)&&!Vc(l)&&(g=o),[o-g,p+f])}function bc(a){return Yh?sj?Ge(Yh):Yh:Zf.min(a,function(a){return Zf.min(a.values,function(a){return a.x})})}function cc(a){return Xh?sj?Ge(Xh):Xh:Zf.max(a,function(a){return Zf.max(a.values,function(a){return a.x})})}function dc(a){var c,d,e,f,g=Gc(a),h=g[1]-g[0];return tj?d=0:ie(a)?(c=Ec(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Zh&&Le(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 ec(a){var b=[bc(a),cc(a)],c=b[0],d=b[1],e=dc(a),f=0,g=0;return c-d!==0||tj||(c=sj?new Date(.5*c.getTime()):-.5,d=sj?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=sj?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=sj?new Date(d.getTime()+e.right):d+e.right),[f,g]}function fc(a){return a[1]-a[0]}function gc(a){for(var b=0;bb?0:b-c}function mc(a){var b,c=kc(a),d="y"===a.axis?Rg:Sg;return b="y"===a.axis||"y2"===a.axis?Kh?vg:"start"in a?d(a.start):vg:Kh?"end"in a?Qg(sj?Ge(a.end):a.end):vg:vg,c>b?0:b-c}function nc(a){return $g&&a===$g||Le(_g)&&Me(_g,a)}function oc(a){return!nc(a)}function pc(a){return $g?$g:Le(_g)?_g[a]:null}function qc(a,b){var c,d=b&&Le(b)?Hc(b):[];return d.forEach(function(b){pc(b)===a&&(c=$f.data.xs[b])}),c}function rc(a,b){return a in $f.data.xs&&$f.data.xs[a]&&$f.data.xs[a][b]?$f.data.xs[a][b]:b}function sc(a){Object.keys(a).forEach(function(b){_g[b]=a[b]})}function tc(a){return 1===Zf.set(Object.keys(a).map(function(b){return a[b]})).size()}function uc(a){var b;return a&&(b=ch[a.id],a.name=b?b:a.id),a}function vc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=xc(b[d],a.id,d)}),$f.data.xs[a.id]=b})}function wc(a,b){a.forEach(function(a){b[a.id]&&vc([a],b[a.id])})}function xc(a,c,d){var e;return e=sj?a?a instanceof Date?a:Ge(a):Ge(rc(c,d)):uj&&!tj?b(a)?+a:rc(c,d):d}function yc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?$f.data.xs[c]=a.map(function(a){return a[f]}).filter(b).map(function(a,b){return xc(a,c,b)}):$g?(d=Object.keys($f.data.xs),$f.data.xs[c]=d.length>0?$f.data.xs[d[0]]:void 0):Le(_g)&&($f.data.xs[c]=qc(f,$f.data.targets)):$f.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!$f.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=bh(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=pc(b),g=a[f],h=xc(g,b,e);return uj&&tj&&0===c&&g&&(0===e&&(Oh=[]),Oh.push(g)),("undefined"==typeof a[b]||$f.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++})}),gh&&ge(Hc(c).filter(function(a){return!(a in hh)}),gh),c.forEach(function(a){hc(a.id_org,a)}),c}function Bc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function Cc(a){return a>0&&$f.data.targets[0].values[a-1]?$f.data.targets[0].values[a-1].x:void 0}function Dc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Gc(a){var b,c,d=Fc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Hc(a){return a.map(function(a){return a.id})}function Ic(a){return a?"string"==typeof a?[a]:a:Hc($f.data.targets)}function Jc(a,b){var c,d=Hc(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(sj?new Date(i):i);j.push(e)}return sj||(j=j.sort(function(a,b){return a-b})),j}function Pc(a){Fj=Fj.concat(a)}function Qc(a){Fj=Fj.filter(function(b){return a.indexOf(b)<0})}function Rc(a){Gj=Gj.concat(a)}function Sc(a){Gj=Gj.filter(function(b){return a.indexOf(b)<0})}function Tc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Uc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Wc(a){return Uc(a,function(a){return a>0})}function Xc(a){return a=0&&d===a[c].x;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(Nd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Nd(a,g))),Qd(e,b)):Od(a,b,f,g)}function Pd(a,b){var c;return c=a.map(function(a){return Od(a.values,b)}),Qd(c,b)}function Qd(a,b){var c,d;return a.forEach(function(a){var e=Ne(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Rd(a,b){return Zf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Sd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Td(){return jh&&"desc"===jh.toLowerCase()}function Ud(){return jh&&"asc"===jh.toLowerCase()}function Vd(a){var b=Ud(),c=Td();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof jh&&a.sort(jh),a}function Wd(a,c){var d,e,f,g,h,i,j,k=ne($f.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&fj&&(ak.html(ij(a,eb(),Dd(k),Bj)).style("display","block"),d=ak.property("offsetWidth"),e=ak.property("offsetHeight"),k?(g=tg/2+c[0],i=vg/2+c[1]+20):(Kh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Qg(l[0].x)+20):(f=s(),g=f+x()+Qg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=h-j),i+e>u()&&(i-=e+30)),ak.style("top",i+"px").style("left",g+"px"))}function Xd(){ak.style("display","none")}function Yd(a){var c=a.filter(function(a){return a&&b(a.value)});if(fj&&!je($f.data.targets)&&!ne($f.data.targets)){var d=Zj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(Kh?"y1":"x1",Jd).attr(Kh?"y2":"x2",Jd),Cf(d,"grid")}}function Zd(){Zj.select("line."+g.xgridFocus).style("visibility","hidden")}function $d(a,b){var c,d,e,f,h=[],i=Zj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=ec(),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){var b,d,e={},f=0;return Mc($f.data.targets.filter(a)).forEach(function(a){for(b=0;b0&&(i+=g(c.values[f].value)-h)}),i}}function de(a){return a.x||0===a.x?Qg(a.x):null}function ee(a,b){var c=_d(oe),d=sf(c);return eh.length>0?d(a,b)[0][1]:_(a.id)(a.value)}function fe(a,b){return"number"==typeof Gi?Gi:b?2*a.tickOffset()*Hi/b:0}function ge(a,b){Ic(a).forEach(function(a){ek[a]=b===hh[a],hh[a]=b}),a||(gh=b)}function he(a,b){var c=!1;return a.forEach(function(a){hh[a.id]===b&&(c=!0),a.id in hh||"line"!==b||(c=!0)}),c}function ie(a){return he(a,"bar")}function je(a){return he(a,"scatter")}function ke(a){return"pie"===gh||he(a,"pie")}function le(a){return he(a,"gauge")}function me(a){return"donut"===gh||he(a,"donut")}function ne(a){return ke(a)||me(a)||le(a)}function oe(a){var b="string"==typeof a?a:a.id;return!(b in hh)||["line","spline","area","area-spline","step","area-step"].indexOf(hh[b])>=0}function pe(a){var b="string"==typeof a?a:a.id;return["step","area-step"].indexOf(hh[b])>=0}function qe(a){var b="string"==typeof a?a:a.id;return["spline","area-spline"].indexOf(hh[b])>=0}function re(a){var b="string"==typeof a?a:a.id;return["area","area-spline","area-step"].indexOf(hh[b])>=0}function se(a){var b="string"==typeof a?a:a.id;return"bar"===hh[b]}function te(a){var b="string"==typeof a?a:a.id;return"scatter"===hh[b]}function ue(a){var b="string"==typeof a?a:a.id;return"pie"===hh[b]}function ve(a){var b="string"==typeof a?a:a.id;return"gauge"===hh[b]}function we(a){var b="string"==typeof a?a:a.id;return"donut"===hh[b]}function xe(a){return ue(a)||we(a)||ve(a)}function ye(a){return oe(a)?[a]:[]}function ze(a){return xe(a.data)?[a]:[]}function Ae(a){return se(a)?a.values:[]}function Be(a){return oe(a)||te(a)?a.values:[]}function Ce(a){return se(a)||oe(a)?a.values:[]}function De(a){return we(a)&&_i||ue(a)&&Ki}function Ee(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 Fe(a,b){var c="value"===b.unit,d=b.values&&b.values.length?b.values:[],e=b.max||100;return function(b){var f,g,h=a[a.length-1];for(f=0;f0}function Me(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ne(a,b){var c="y"===db(a.id)?Rg:Sg,d=Kh?1:0,e=Kh?0:1;return Math.pow(Qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Oe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Pe(a,b,c){return d(a[b])?a[b]:c}function Qe(a){return 10*Math.ceil(a/10)}function Re(a,b){var c;return Zf.select("body").selectAll(".dummy").data([a]).enter().append("text").classed(b?b:"",!0).text(a).each(function(){c=this.getBoundingClientRect()}).remove(),c}function Se(a){return qe(a)?"cardinal":pe(a)?"step-after":"linear"}function Te(a,b,c){wh(b,a.node()),Zj.select("."+g.selectedCircles+sd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Yc(g.selectedCircle,c)}).attr("cx",Kh?ee:de).attr("cy",Kh?de:ee).attr("stroke",function(){return Bj(b)}).attr("r",1.4*cf(b)).transition().duration(100).attr("r",cf)}function Ue(a,b,c){xh(b,a.node()),Zj.select("."+g.selectedCircles+sd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ve(a,b,c,d){a?Te(b,c,d):Ue(b,c,d)}function We(a,b){wh(b,a.node()),a.transition().duration(100).style("fill",function(){return Zf.rgb(Bj(b)).brighter(.75)})}function Xe(a,b){xh(b,a.node()),a.transition().duration(100).style("fill",function(){return Bj(b)})}function Ye(a,b,c,d){a?We(b,c,d):Xe(b,c,d) +}function Ze(a,b,c,d){Ye(a,b,c.data,d)}function $e(a){return"circle"===a.nodeName?Ve:Zf.select(a).classed(g.bar)?Ye:Ze}function _e(a){return a.filter(function(a){return b(a.value)})}function af(a){return zi&&!pe(a)?"function"==typeof Ai?Ai(a):Ai:0}function bf(a){return Ci?Di?Di:1.75*af(a):af(a)}function cf(a){return Ei?Ei:4*af(a)}function df(a,c){return(c?Zj.selectAll("."+g.circles+sd(c)):Zj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function ef(a,b){df(a,b).classed(g.EXPANDED,!0).attr("r",bf)}function ff(a){df(a).filter(function(){return Zf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",af)}function gf(a){return Zj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function hf(a){gf(a).classed(g.EXPANDED,!0)}function jf(a){gf(a).classed(g.EXPANDED,!1)}function kf(a,b){var c=Zf.svg.area(),d=qf(a,b),e=b?ab:_,f=function(a,b){return eh.length>0?d(a,b)[0][1]:e(a.id)(0)},g=function(a,b){return eh.length>0?d(a,b)[1][1]:e(a.id)(a.value)};return c=Kh?c.x0(f).x1(g).y(Jd):c.x(Jd).y0(f).y1(g),function(a){var b,d,e=_e(a.values);return re(a)?c.interpolate(Se(a))(e):(b=Qg(e[0].x),d=_(a.id)(e[0].value),Kh?"M "+d+" "+b:"M "+b+" "+d)}}function lf(a,b){var c=Zf.svg.line(),d=sf(a,b),e=b?ab:_,f=b?Md:Jd,g=function(a,b){return eh.length>0?d(a,b)[0][1]:e(a.id)(a.value)};return c=Kh?c.x(g).y(f):c.x(f).y(g),Fi||(c=c.defined(function(a){return null!=a.value})),function(a){var d=Fi?_e(a.values):a.values,f=b?f:Tg,g=e(a.id),h=0,i=0;return oe(a)?kh[a.id]?tf(d,f,g,kh[a.id]):c.interpolate(Se(a))(d):(d[0]&&(h=f(d[0].x),i=g(d[0].value)),Kh?"M "+i+" "+h:"M "+h+" "+i)}}function mf(a,b){var c=rf(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 nf(a,b){var c=rf(a,!1),d=b?of:pf;return function(a,b){return d(c(a,b),a,this)}}function of(a,b){var c;return Kh?(c=se(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function pf(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:se(b)?-3:-6)}function qf(a,b){var c=a.__max__+1,d=ae(0,c,a,!!b),e=be(!!b),f=ce(re,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Kh&&(0j||a.value<0&&j>c)&&(j=c),[[i,h],[i,j-(c-h)]]}}function rf(a,b){var c=a.__max__+1,d=fe(Wg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(se,a,!!b),h=b?ab:_;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 sf(a,b){var c=a.__max__+1,d=ae(0,c,a,!!b),e=be(!!b),f=ce(oe,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Kh&&(0j||a.value<0&&j>c)&&(j=c),[[i,j-(c-h)]]}}function tf(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 uf(b){var c=new MutationObserver(function(d){d.forEach(function(d){if("childList"===d.type&&d.previousSibling){c.disconnect();var e=a.setInterval(function(){b.node().parentNode&&(a.clearInterval(e),Df({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransition:!1,withTransitionForTransform:!1,withLegend:!0}),b.transition().style("opacity",1))},10)}})});c.observe(b.node(),{attributes:!0,childList:!0,characterData:!0})}function vf(b){var c,d,e,f=!0;if(bk=Zf.select(ag),bk.empty()&&(bk=Zf.select(document.createElement("div")).style("opacity",0),uf(bk),f=!1),bk.html("").classed("c3",!0),$f.data.xs={},$f.data.targets=Ac(b),oh&&($f.data.targets=$f.data.targets.filter(oh)),nh&&Pc(nh===!0?Hc($f.data.targets):nh),p(),W(),Qg.domain(Zf.extent(ec($f.data.targets))),Rg.domain(ac($f.data.targets,"y")),Sg.domain(ac($f.data.targets,"y2")),Tg.domain(Qg.domain()),Ug.domain(Rg.domain()),Vg.domain(Sg.domain()),ck=Qg.domain(),Vj.scale(Tg),hg&&Wj.scale(Qg),Xj=bk.append("svg").style("overflow","hidden").on("mouseenter",lg).on("mouseleave",mg),Yj=Xj.append("defs"),Yj.append("clipPath").attr("id",mj).append("rect"),Yj.append("clipPath").attr("id",nj).append("rect"),Yj.append("clipPath").attr("id",oj).append("rect"),Hf(),Zj=Xj.append("g").attr("transform",Mj.main),$j=Xj.append("g").attr("transform",Mj.context),_j=Xj.append("g").attr("transform",Mj.legend),Ah||$j.style("visibility","hidden"),Eh||(_j.style("visibility","hidden"),Gj=Hc($f.data.targets)),ak=bk.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Uf(Hc($f.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Zj.append("g").attr("clip-path",pj).attr("class",g.grid),ti&&d.append("g").attr("class",g.xgrids),Le(vi)&&d.append("g").attr("class",g.xgridLines),Bi&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),wi&&d.append("g").attr("class",g.ygrids),Le(xi)&&d.append("g").attr("class",g.ygridLines),Zj.append("g").attr("clip-path",pj).attr("class",g.regions),Zj.append("g").attr("clip-path",pj).attr("class",g.chart),c=Zj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",hg?Kh?"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",Mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Wb()),Zj.select("."+g.chart).append("g").attr("class",g.chartTexts),hg&&Zj.insert("rect",jg?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",tg).attr("height",vg).style("opacity",0).style("cursor",Kh?"ns-resize":"ew-resize").call(Wj).on("dblclick.zoom",null),_h&&Vj.extent("function"!=typeof _h?_h:_h(ec())),Hj.x=Zj.append("g").attr("class",g.axisX).attr("clip-path",qj).attr("transform",Mj.x).style("visibility",Lh?"visible":"hidden"),Hj.x.append("text").attr("class",g.axisXLabel).attr("transform",Kh?"rotate(-90)":"").style("text-anchor",Fb),Hj.y=Zj.append("g").attr("class",g.axisY).attr("clip-path",rj).attr("transform",Mj.y).style("visibility",bi?"visible":"hidden"),Hj.y.append("text").attr("class",g.axisYLabel).attr("transform",Kh?"":"rotate(-90)").style("text-anchor",Gb),Hj.y2=Zj.append("g").attr("class",g.axisY2).attr("transform",Mj.y2).style("visibility",ki?"visible":"hidden"),Hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",Kh?"":"rotate(-90)").style("text-anchor",Hb),$j.append("g").attr("clip-path",pj).attr("class",g.chart),$j.select("."+g.chart).append("g").attr("class",g.chartBars),$j.select("."+g.chart).append("g").attr("class",g.chartLines),$j.append("g").attr("clip-path",pj).attr("class",g.brush).call(Vj).selectAll("rect").attr(Kh?"width":"height",Kh?ug:wg),Hj.subx=$j.append("g").attr("class",g.axisX).attr("transform",Mj.subx).attr("clip-path",Kh?"":qj),Kf($f.data.targets),f&&Df({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),jj){if(sj&&"string"==typeof kj){for(kj=Ge(kj),e=0;e<$f.data.targets[0].values.length&&$f.data.targets[0].values[e].x-kj!==0;e++);kj=e}ak.html(ij($f.data.targets.map(function(a){return uc(a.values[kj])}),eb(),Dd(ne($f.data.targets)),Bj)),ak.style("top",lj.top).style("left",lj.left).style("display","block")}null==a.onresize&&(a.onresize=Gf()),a.onresize.add&&(a.onresize.add(ng),a.onresize.add(function(){$f.flush()}),a.onresize.add(og)),$f.element=bk.node()}function wf(a){a.append("rect").attr("class",md).style("cursor",ph&&qh?"pointer":null).on("mouseover",function(a,b){if(!wj&&!ne($f.data.targets)){var c=$f.data.targets.map(function(a){return uc(a.values[b])}),d=[];Object.keys(ch).forEach(function(a){for(var b=0;bf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Sd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ye,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 Af(a){ne($f.data.targets)||ph&&(vj=a,Zj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),wj=!0,yh())}function Bf(){ne($f.data.targets)||ph&&(Zj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Zj.selectAll("."+g.shape).classed(g.INCLUDED,!1),wj=!1,zh())}function Cf(a,b){"grid"===b&&a.each(function(){var a=Zf.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 Df(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,P,R,S,T,U,V,X,Y,Z,$,_,ab,bb,cb,db=_d(re),eb=_d(se),fb=_d(oe),gb=ne($f.data.targets),hb=Mc($f.data.targets);if(a=a||{},F=Pe(a,"withY",!0),G=Pe(a,"withSubchart",!0),H=Pe(a,"withTransition",!0),K=Pe(a,"withTransform",!1),L=Pe(a,"withUpdateXDomain",!1),M=Pe(a,"withUpdateOrgXDomain",!1),O=Pe(a,"withUpdateTranslate",!1),N=Pe(a,"withLegend",!1),I=Pe(a,"withTransitionForExit",H),J=Pe(a,"withTransitionForAxis",H),Z=H?pg:0,$=I?Z:0,_=J?Z:0,c=c||If(_),O&&(Kh?(Hj.x.call(Wg),Hj.subx.call(Zg)):(Hj.y.call(Xg),Hj.y2.call(Yg)),p(),W(),Hf(),o(!1)),N&&Eh&&Uf(Hc($f.data.targets),a,c),tj&&0===hb.length&&Qg.domain([0,Hj.x.selectAll(".tick").size()]),hb.length&&(M&&(Qg.domain(Zf.extent(ec(hb))),ck=Qg.domain(),hg&&Wj.scale(Qg).updateScaleExtent(),Tg.domain(Qg.domain()),Vj.scale(Tg)),L&&(Qg.domain(Vj.empty()?ck:Vj.extent()),hg&&Wj.scale(Qg).updateScaleExtent()),Vh||!Uh&&!Th||(ab=Oc(Nc(hb),Th),Wg.tickValues(ab),Zg.tickValues(ab))),Rg.domain(ac(hb,"y")),Sg.domain(ac(hb,"y2")),Hj.x.style("opacity",gb?0:1),Hj.y.style("opacity",gb?0:1),Hj.y2.style("opacity",gb?0:1),Hj.subx.style("opacity",gb?0:1),c.axisX.call(Wg),c.axisY.call(Xg),c.axisY2.call(Yg),c.axisSubX.call(Zg),Jb(H),L&&hb.length)if(Rh&&ab){for(bb=1;bb=0&&Zf.select(this).style("display",b%cb?"none":"block")})}else Xj.selectAll("."+g.axisX+" .tick text").style("display","block");!Kh&&Wh&&kb(Hj.x,c.axisX,Wh),P=kf(db,!1),S=mf(eb),U=lf(fb,!1),X=nf(eb,!0),Y=nf(eb,!1),Ug.domain(Rg.domain()),Vg.domain(Sg.domain()),ak.style("display","none"),q(),Zj.select("line."+g.xgridFocus).style("visibility","hidden"),ti&&(f=$d(ui,Qg),C=tj?Wg.tickOffset():0,e=Kh?{x1:0,x2:tg,y1:function(a){return Qg(a)-C},y2:function(a){return Qg(a)-C}}:{x1:function(a){return Qg(a)+C},x2:function(a){return Qg(a)+C},y1:qg.top,y2:vg},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+Zf.select(this).attr(Kh?"y1":"x1")===(Kh?vg:0)?0:1}),d.exit().remove()),Le(vi)&&(h=Zj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(vi),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",Kh?"":"rotate(-90)").attr("dx",Kh?0:-qg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Z).attr("x1",Kh?0:Kd).attr("x2",Kh?tg:Kd).attr("y1",Kh?Kd:qg.top).attr("y2",Kh?Kd:vg).style("opacity",1),h.select("text").transition().duration(Z).attr("x",Kh?tg:0).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Z).style("opacity",0).remove()),F&&wi&&(j=Zj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Rg.ticks(yi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",Kh?Rg:0).attr("x2",Kh?Rg:tg).attr("y1",Kh?0:Rg).attr("y2",Kh?vg:Rg),j.exit().remove(),Cf(j,"grid")),F&&Le(xi)&&(k=Zj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(xi),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",Kh?"rotate(-90)":"").attr("dx",Kh?0:-qg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Z).attr("x1",Kh?Ld:0).attr("x2",Kh?Ld:tg).attr("y1",Kh?0:Ld).attr("y2",Kh?vg:Ld).style("opacity",1),k.select("text").transition().duration(Z).attr("x",Kh?0:tg).attr("y",Ld).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Z).style("opacity",0).remove()),u=Zj.select("."+g.regions).selectAll("."+g.region).data(ej),u.enter().append("g").attr("class",ld).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(Z).attr("x",jc).attr("y",kc).attr("width",lc).attr("height",mc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(Z).style("opacity",0).remove(),s=Zj.selectAll("."+g.bars).selectAll("."+g.bar).data(Ae),s.enter().append("path").attr("class",fd).style("stroke",function(a){return Bj(a.id)}).style("fill",function(a){return Bj(a.id)}),s.style("opacity",xd).transition().duration(Z).attr("d",S).style("fill",Bj).style("opacity",1),s.exit().transition().duration($).style("opacity",0).remove(),m=Zj.selectAll("."+g.lines).selectAll("."+g.line).data(ye),m.enter().append("path").attr("class",bd).style("stroke",Bj),m.style("opacity",xd).transition().duration(Z).attr("d",U).style("stroke",Bj).style("opacity",1),m.exit().transition().duration($).style("opacity",0).remove(),n=Zj.selectAll("."+g.areas).selectAll("."+g.area).data(ye),n.enter().append("path").attr("class",jd).style("fill",Bj).style("opacity",function(){return dk=+Zf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Z).attr("d",P).style("fill",Bj).style("opacity",dk),n.exit().transition().duration($).style("opacity",0).remove(),zi&&(r=Zj.selectAll("."+g.circles).selectAll("."+g.circle).data(Be),r.enter().append("circle").attr("class",dd).attr("r",af).style("fill",Bj),r.style("opacity",xd).transition().duration(Z).style("opacity",zd).style("fill",Bj).attr("cx",Kh?ee:de).attr("cy",Kh?de:ee),r.exit().remove()),Bd()&&(v=Zj.selectAll("."+g.texts).selectAll("."+g.text).data(Ce),v.enter().append("text").attr("class",Zc).attr("text-anchor",function(a){return Kh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Bj).style("fill-opacity",0),v.text(function(a){return Id(a.id)(a.value,a.id)}).style("fill-opacity",yd).transition().duration(Z).attr("x",X).attr("y",Y).style("fill",Bj).style("fill-opacity",Ad),v.exit().transition().duration($).style("fill-opacity",0).remove()),t=Zj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ze),"arc"===Wi&&(t.enter().append("path").attr("class","").style("opacity",1).style("fill",Oi).style("cursor","pointer").attr("transform","scale(1,1)").attr("d",function(a){return a.value=Ri,a.startAngle=-1*(Math.PI/2),a.endAngle=Math.PI/2,Nb(a,!0)}),t.exit().transition().duration($).style("opacity",0).remove()),t.enter().append("path").attr("class",hd).style("fill",function(a){return Bj(a.data)}).style("cursor",function(a){return rh(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;zj||(c=Kb(a),d=Qb(c),e=Yb(),Sb(c.data.id),Qf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Kb(a),c=Qb(b),d=[c];Wd(d,Zf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;zj||(c=Kb(a),d=Qb(c),e=Zb(),Tb(c.data.id),Rf(),Xd(),e(d,b))}).on("click",function(a,b){var c=Kb(a),d=Qb(c),e=Xb();yf(this,a,b),e(d,b)}),t.attr("transform",K?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){zj=!0}).transition().duration(Z).attrTween("d",function(a){var b,c=Kb(a);return c?(isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle),b=Zf.interpolate(this._current,c),this._current=b(0),function(a){return Nb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",K?"scale(1)":"").style("fill",function(a){return Cj?Cj(a.data.values[0].value):Bj(a.data.id)}).style("opacity",1).call(Oe,function(){zj=!1}),t.exit().transition().duration($).style("opacity",0).remove(),Zj.selectAll("."+g.chartArc).select("text").style("opacity",0).text(Rb).attr("transform",Ob).transition().duration(Z).style("opacity",function(a){return Kc(a.data.id)&&xe(a.data)?1:0}),"arc"===Wi&&(Zj.selectAll("."+g.chartArc).select("text.units").attr("transform",Ob).style("opacity",0).transition().duration(Z).text(Pi?Xi:"").style("opacity",function(a){return Kc(a.data.id)&&xe(a.data)?1:0}),Zj.selectAll("."+g.chartArc).select("text.min").attr("transform",Ob).style("opacity",0).transition().duration(Z).text(Pi?Si:"").style("opacity",function(a){return Kc(a.data.id)&&xe(a.data)?1:0}),Zj.selectAll("."+g.chartArc).select("text.max").attr("transform",Ob).style("opacity",0).transition().duration(Z).text(Pi?Ri:"").style("opacity",function(a){return Kc(a.data.id)&&xe(a.data)?1:0})),Zj.select("."+g.chartArcsTitle).style("opacity",me($f.data.targets)||le($f.data.targets)?1:0),Ah&&(Zf.event&&"zoom"===Zf.event.type&&Vj.extent(Qg.orgDomain()).update(),G&&(!Kh&&Wh&&kb(Hj.subx,c.axisSubX,Wh),Vj.empty()||Vj.extent(Qg.orgDomain()).update(),R=kf(db,!0),T=mf(eb,!0),V=lf(fb,!0),y=$j.selectAll("."+g.bars).selectAll("."+g.bar).data(Ae),y.enter().append("path").attr("class",fd).style("stroke","none").style("fill",Bj),y.style("opacity",xd).transition().duration(Z).attr("d",T).style("opacity",1),y.exit().transition().duration(Z).style("opacity",0).remove(),w=$j.selectAll("."+g.lines).selectAll("."+g.line).data(ye),w.enter().append("path").attr("class",bd).style("stroke",Bj),w.style("opacity",xd).transition().duration(Z).attr("d",V).style("opacity",1),w.exit().transition().duration(Z).style("opacity",0).remove(),x=$j.selectAll("."+g.areas).selectAll("."+g.area).data(ye),x.enter().append("path").attr("class",jd).style("fill",Bj).style("opacity",function(){return dk=+Zf.select(this).style("opacity"),0}),x.style("opacity",0).transition().duration(Z).attr("d",R).style("fill",Bj).style("opacity",dk),x.exit().transition().duration($).style("opacity",0).remove())),Zj.selectAll("."+g.selectedCircles).filter(function(a){return se(a)}).selectAll("circle").remove(),Zj.selectAll("."+g.selectedCircle).transition().duration(Z).attr("cx",Kh?ee:de).attr("cy",Kh?de:ee),kg&&(z=Zj.select("."+g.eventRects),Le(_g)&&!tc(_g)?(z.classed(g.eventRectsMultiple)||z.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),A=Zj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),xf(A.enter()),A.attr("x",0).attr("y",0).attr("width",tg).attr("height",vg)):(z.classed(g.eventRectsSingle)||z.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),!uj&&!sj||tj?(E=Q(),D=function(a){return Qg(a.x)-E/2}):(E=function(a,b){var c=Cc(b),d=Dc(b),e=$f.data.xs[a.id][b],f=Qg(d?d:e),g=Qg(c?c:e);return(f-g)/2},D=function(a,b){var c=Cc(b),d=$f.data.xs[a.id][b];return(Qg(d)+Qg(c?c:d))/2}),B=Fc($f.data.targets),Zj.select("."+g.eventRects).datum(B?B.values:[]),A=Zj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),wf(A.enter()),A.attr("class",md).attr("x",Kh?0:D).attr("y",Kh?D:0).attr("width",Kh?tg:E).attr("height",Kh?E:vg),A.exit().remove())),Hc($f.data.targets).forEach(function(a){ek[a]=!0})}function Ef(){Df({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ff(){if(0!==Mc($f.data.targets).length){if("mousemove"===Zf.event.sourceEvent.type&&Wj.altDomain)return Qg.domain(Wj.altDomain),void Wj.scale(Qg).updateScaleExtent();tj&&Qg.orgDomain()[0]===ck[0]&&Qg.domain([ck[0]-1e-10,Qg.orgDomain()[1]]),Df({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Zf.event.sourceEvent.type&&(xj=!0)}}function Gf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Hf(){Xj.attr("width",xg).attr("height",yg),Xj.select("#"+mj).select("rect").attr("width",tg).attr("height",vg),Xj.select("#"+nj).select("rect").attr("x",G).attr("y",H).attr("width",M).attr("height",N),Xj.select("#"+oj).select("rect").attr("x",I).attr("y",J).attr("width",O).attr("height",P),Xj.select("."+g.zoomRect).attr("width",tg).attr("height",vg),bk.style("max-height",yg+"px")}function If(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 Jf(a){var b;a=a||{},a.withTransition=Pe(a,"withTransition",!0),a.withTransform=Pe(a,"withTransform",!1),a.withLegend=Pe(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&Eh||(b=If(a.withTransitionForAxis?pg:0),p(),W(),Hf(),o(a.withTransition,b)),Df(a,b)}function Kf(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",od),j=i.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",$c),e=Zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",qd),d=e.enter().append("g").attr("class",qd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",gd).style("cursor",function(a){return rh(a)?"pointer":null}),c=Zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",pd),b=c.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",cd),b.append("g").attr("class",kd),b.append("g").attr("class",function(a){return Yc(g.selectedCircles,a.id)}),b.append("g").attr("class",ed).style("cursor",function(a){return rh(a)?"pointer":null}),a.forEach(function(a){Zj.selectAll("."+g.selectedCircles+sd(a.id)).selectAll("."+g.selectedCircle).each(function(b){b.value=a.values[b.index].value})}),h=Zj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(Hg(a)).attr("class",rd),f=h.enter().append("g").attr("class",rd),f.append("g").attr("class",id),f.append("text").attr("dy","arc"===Wi?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("font-size",tg/10+"px"),"arc"===Wi&&(f.select("text").style("fill","#000"),f.append("text").attr("dy",".75em").attr("class","units").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#000").style("font-size",tg/15+"px"),f.append("text").attr("dx",-1*(Bg+(zg-Bg)/2)+"px").attr("dy","1em").attr("class","min").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",tg/20+"px"),f.append("text").attr("dx",Bg+(zg-Bg)/2+"px").attr("dy","1em").attr("class","max").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",tg/20+"px")),Ah&&(n=$j.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",qd),m=n.enter().append("g").style("opacity",0).attr("class",qd),m.append("g").attr("class",gd),l=$j.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",pd),k=l.enter().append("g").style("opacity",0).attr("class",pd),k.append("g").attr("class",cd),k.append("g").attr("class",kd)),Xj.selectAll("."+g.target).filter(function(a){return Kc(a.id)}).transition().duration(pg).style("opacity",1)}function Lf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?ge(a.id,b.types[a.id]):ge(a.id,b.type)}),$f.data.targets.forEach(function(b){for(var c=0;cf&&(f=(m-l)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=l}var f,h,i=Re(b.textContent,g.legendItem),j=10*Math.ceil((i.width+v)/10),k=10*Math.ceil((i.height+u)/10),l=Nj?k:j,m=Nj?V():U();return d&&(z=0,F=0,w=0,x=0),Eh&&!Lc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=j,C[c]=k,(!w||j>=w)&&(w=j),(!x||k>=x)&&(x=k),h=Nj?x:w,void(Jh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(m-h*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=_j.selectAll("."+g.legendItemFocused).size();b=b||{},n=Pe(b,"withTransition",!0),q=Pe(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=_j.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Yc(g.legendItem,a)}).style("visibility",function(a){return Lc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Gh?Gh(a):$f.toggle(a)}).on("mouseover",function(a){Zf.select(this).classed(g.legendItemFocused,!0),zj||$f.focus(a),"function"==typeof Hh&&Hh(a)}).on("mouseout",function(a){Zf.select(this).classed(g.legendItemFocused,!1),zj||$f.revert(),"function"==typeof Ih&&Ih(a)}),m.append("text").text(function(a){return d(ch[a])?ch[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",Bj).attr("x",Nj?h:-200).attr("y",Nj?-200:j).attr("width",10).attr("height",10),r=_j.selectAll("text").data(a).text(function(a){return d(ch[a])?ch[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=_j.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=_j.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",Bj).attr("x",f).attr("y",j),_j.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Kc(a)}).transition().style("opacity",function(a){var b=Zf.select(this);return Kc(a)?!G||b.classed(g.legendItemFocused)?Of(b):Pf(b):Rj}),S(w),T(x),R(F),p(),W(),Hf(),o(q,c)}function Vf(a){return Jc($f.data.targets,a.id)}function Wf(a){return"data"in a&&Jc($f.data.targets,a.data.id)}function Xf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Yf(a,b,c){var d=!ne($f.data.targets);zj=!1,ge(a,b),Jf(c||{withTransitionForAxis:d})}var Zf=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,$f={data:{},axis:{},legend:{}},_f={},ag=i(["bindto"],"#chart"),bg=i(["size","width"]),cg=i(["size","height"]),dg=i(["padding","left"]),eg=i(["padding","right"]),fg=i(["padding","top"]),gg=i(["padding","bottom"]),hg=i(["zoom","enabled"],!1),ig=i(["zoom","extent"]),jg=i(["zoom","privileged"],!1),kg=i(["interaction","enabled"],!0),lg=i(["onenter"],function(){}),mg=i(["onleave"],function(){}),ng=i(["onresize"],function(){}),og=i(["onresized"],function(){}),pg=i(["transition","duration"],350); +h("data","data is required in config");var qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,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,$g=i(["data","x"]),_g=i(["data","xs"],{}),ah=i(["data","x_format"]),bh=i(["data","id_converter"],function(a){return a}),ch=i(["data","names"],{}),dh=i(["data","classes"],{}),eh=i(["data","groups"],[]),fh=i(["data","axes"],{}),gh=i(["data","type"]),hh=i(["data","types"],{}),ih=i(["data","labels"],{}),jh=i(["data","order"]),kh=i(["data","regions"],{}),lh=i(["data","color"]),mh=i(["data","colors"],{}),nh=i(["data","hide"],!1),oh=i(["data","filter"]),ph=i(["data","selection","enabled"],!1),qh=i(["data","selection","grouped"],!1),rh=i(["data","selection","isselectable"],function(){return!0}),sh=i(["data","selection","multiple"],!0),th=i(["data","onclick"],function(){}),uh=i(["data","onenter"],function(){}),vh=i(["data","onleave"],function(){}),wh=i(["data","onselected"],function(){}),xh=i(["data","onunselected"],function(){}),yh=i(["data","ondragstart"],function(){}),zh=i(["data","ondragend"],function(){}),Ah=i(["subchart","show"],!1),Bh=i(["subchart","size","height"],60),Ch=i(["color","pattern"],[]),Dh=i(["color","threshold"],{}),Eh=i(["legend","show"],!0),Fh=i(["legend","position"],"bottom"),Gh=i(["legend","item","onclick"]),Hh=i(["legend","item","onmouseover"]),Ih=i(["legend","item","onmouseout"]),Jh=i(["legend","equally"],!1),Kh=i(["axis","rotated"],!1),Lh=i(["axis","x","show"],!0),Mh=i(["axis","x","type"],"indexed"),Nh=i(["axis","x","localtime"],!0),Oh=i(["axis","x","categories"],[]),Ph=i(["axis","x","tick","centered"],!1),Qh=i(["axis","x","tick","format"]),Rh=i(["axis","x","tick","culling"],{}),Sh=i(["axis","x","tick","culling","max"],10),Th=i(["axis","x","tick","count"]),Uh=i(["axis","x","tick","fit"],!0),Vh=i(["axis","x","tick","values"],null),Wh=i(["axis","x","tick","rotate"]),Xh=i(["axis","x","max"],null),Yh=i(["axis","x","min"],null),Zh=i(["axis","x","padding"],{}),$h=i(["axis","x","height"]),_h=i(["axis","x","default"]),ai=i(["axis","x","label"],{}),bi=i(["axis","y","show"],!0),ci=i(["axis","y","max"]),di=i(["axis","y","min"]),ei=i(["axis","y","center"]),fi=i(["axis","y","label"],{}),gi=i(["axis","y","inner"],!1),hi=i(["axis","y","tick","format"]),ii=i(["axis","y","padding"]),ji=i(["axis","y","ticks"],10),ki=i(["axis","y2","show"],!1),li=i(["axis","y2","max"]),mi=i(["axis","y2","min"]),ni=i(["axis","y2","center"]),oi=i(["axis","y2","label"],{}),pi=i(["axis","y2","inner"],!1),qi=i(["axis","y2","tick","format"]),ri=i(["axis","y2","padding"]),si=i(["axis","y2","ticks"],10),ti=i(["grid","x","show"],!1),ui=i(["grid","x","type"],"tick"),vi=i(["grid","x","lines"],[]),wi=i(["grid","y","show"],!1),xi=i(["grid","y","lines"],[]),yi=i(["grid","y","ticks"],10),zi=i(["point","show"],!0),Ai=i(["point","r"],2.5),Bi=i(["point","focus","line","enabled"],!0),Ci=i(["point","focus","expand","enabled"],!0),Di=i(["point","focus","expand","r"]),Ei=i(["point","focus","select","r"]),Fi=i(["line","connect_null"],!1),Gi=i(["bar","width"]),Hi=i(["bar","width","ratio"],.6),Ii=i(["pie","label","show"],!0),Ji=i(["pie","label","format"]),Ki=i(["pie","expand"],!0),Li=i(["pie","onclick"],function(){}),Mi=i(["pie","onmouseover"],function(){}),Ni=i(["pie","onmouseout"],function(){}),Oi=i(["gauge","color"],"#e0e0e0"),Pi=i(["gauge","label","show"],!0),Qi=i(["gauge","label","format"]),Ri=i(["gauge","max"]),Si=i(["gauge","min"]),Ti=i(["gauge","onclick"],function(){}),Ui=i(["gauge","onmouseover"],function(){}),Vi=i(["gauge","onmouseout"],function(){}),Wi=i(["gauge","style"]),Xi=i(["gauge","units"]),Yi=i(["gauge","width"],!1),Zi=i(["donut","label","show"],!0),$i=i(["donut","label","format"]),_i=i(["donut","expand"],!0),aj=i(["donut","title"],""),bj=i(["donut","onclick"],function(){}),cj=i(["donut","onmouseover"],function(){}),dj=i(["donut","onmouseout"],function(){}),ej=i(["regions"],[]),fj=i(["tooltip","show"],!0),gj=i(["tooltip","format","title"]),hj=i(["tooltip","format","value"]),ij=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k,l=gj?gj:b,m=hj?hj:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=m(a[f].value,a[f].ratio,a[f].id,a[f].index),k=Cj?Cj(a[f].value):d(a[f].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),jj=i(["tooltip","init","show"],!1),kj=i(["tooltip","init","x"],0),lj=i(["tooltip","init","position"],{top:"0px",left:"50px"}),mj="c3-"+ +new Date+"-clip",nj=mj+"-xaxis",oj=mj+"-yaxis",pj=j(mj),qj=j(nj),rj=j(oj),sj="timeseries"===Mh,tj="categorized"===Mh,uj=!sj&&($g||Le(_g)),vj=null,wj=!1,xj=!1,yj=!1,zj=!1,Aj=Zf.scale.category10().range(),Bj=Ee(mh,Le(Ch)?Ch:Aj,lh),Cj=Le(Dh)?Fe(Ch,Dh):null,Dj=Nh?Zf.time.format:Zf.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=Kh?"left":"bottom",Jj=Kh?gi?"top":"bottom":gi?"right":"left",Kj=Kh?pi?"bottom":"top":pi?"left":"right",Lj=Kh?"left":"bottom",Mj={main:function(){return"translate("+k(qg.left)+","+k(qg.top)+")"},context:function(){return"translate("+k(rg.left)+","+k(rg.top)+")"},legend:function(){return"translate("+sg.left+","+sg.top+")"},x:function(){return"translate(0,"+(Kh?0:vg)+")"},y:function(){return"translate(0,"+(Kh?vg:0)+")"},y2:function(){return"translate("+(Kh?0:tg)+","+(Kh?1:0)+")"},subx:function(){return"translate(0,"+(Kh?0:wg)+")"},arc:function(){return"translate("+Cg/2+","+Dg/2+")"}},Nj="right"===Fh,Oj=0,Pj=0,Qj=0,Rj=.15,Sj=30,Tj=Kh&&!Lh?0:30,Uj=5;Hg=Zf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vj,Wj=function(){};Vj=Zf.svg.brush().on("brush",Ef),Vj.update=function(){return $j&&$j.select("."+g.brush).call(this),this},Vj.scale=function(a){return Kh?this.y(a):this.x(a)},hg&&(Wj=Zf.behavior.zoom().on("zoomstart",function(){Wj.altDomain=Zf.event.sourceEvent.altKey?Qg.orgDomain():null}).on("zoom",hg?Ff:null),Wj.scale=function(a){return Kh?this.y(a):this.x(a)},Wj.orgScaleExtent=function(){var a=ig?ig:[1,10];return[a[0],Math.max(Ec()/a[1],a[1])]},Wj.updateScaleExtent=function(){var a=fc(Qg.orgDomain())/fc(ck),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Xj,Yj,Zj,$j,_j,ak,bk,ck,dk,ek={};if($f.focus=function(a){function b(a){Mc(a).transition().duration(100).style("opacity",1)}var c=Xj.selectAll(td(a)),d=c.filter(Vf),e=c.filter(Wf);$f.revert(),$f.defocus(),b(d.classed(g.focused,!0)),b(e),ne($f.data.targets)&&Sb(a,!0),Qf(a,!0)},$f.defocus=function(a){function b(a){Mc(a).transition().duration(100).style("opacity",.3)}var c=Xj.selectAll(td(a)),d=c.filter(Vf),e=c.filter(Wf);$f.revert(),b(d.classed(g.focused,!1)),b(e),ne($f.data.targets)&&Tb(a),Qf(a,!1)},$f.revert=function(a){function b(a){Mc(a).transition().duration(100).style("opacity",1)}var c=Xj.selectAll(td(a)),d=c.filter(Vf),e=c.filter(Wf);b(d.classed(g.focused,!1)),b(e),ne($f.data.targets)&&Tb(a),Rf()},$f.show=function(a,b){a=Ic(a),b=b||{},Qc(a),Xj.selectAll(ud(a)).transition().style("opacity",1),b.withLegend&&Sf(a),Df({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},$f.hide=function(a,b){a=Ic(a),b=b||{},Pc(a),Xj.selectAll(ud(a)).transition().style("opacity",0),b.withLegend&&Tf(a),Df({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},$f.toggle=function(a){Kc(a)?$f.hide(a):$f.show(a)},$f.unzoom=function(){Vj.clear().update(),Df({withUpdateXDomain:!0})},$f.update=function(a,b){var c,d,e,g=f;for(c=0;c=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?rh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},$f.unselect=function(a,b){ph&&Zj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Zf.select(this),f=c.data?c.data.id:c.id,h=$e(this),i=qh||!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&&rh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},$f.toLine=function(a){Yf(a,"line")},$f.toSpline=function(a){Yf(a,"spline")},$f.toBar=function(a){Yf(a,"bar")},$f.toScatter=function(a){Yf(a,"scatter")},$f.toArea=function(a){Yf(a,"area")},$f.toAreaSpline=function(a){Yf(a,"area-spline")},$f.toPie=function(a){Yf(a,"pie",{withTransform:!0})},$f.toDonut=function(a){Yf(a,"donut",{withTransform:!0})},$f.groups=function(a){return c(a)?eh:(eh=a,Df(),eh)},$f.xgrids=function(a){return a?(vi=a,Df(),vi):vi},$f.xgrids.add=function(a){return a?$f.xgrids(vi.concat(a)):void 0},$f.xgrids.remove=function(a){var b=Xf(a);return $f.xgrids(vi.filter(b))},$f.ygrids=function(a){return a?(xi=a,Df(),xi):xi},$f.ygrids.add=function(a){return a?$f.ygrids(xi.concat(a)):void 0},$f.ygrids.remove=function(a){var b=Xf(a);return $f.ygrids(xi.filter(b))},$f.regions=function(a){return a?(ej=a,Df(),ej):ej},$f.regions.add=function(a){return a?(ej=ej.concat(a),Df(),ej):ej},$f.regions.remove=function(a){var b,c,d;return a=a||{},b=Pe(a,"duration",pg),c=Pe(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(),ej=ej.filter(function(a){var b=!1;return a.class?(a.class.split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0})},$f.data.get=function(a){var b=$f.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},$f.data.getAsTarget=function(a){var b=$f.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},$f.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ch[b]=a[b]}),Df({withLegend:!0}),ch):ch},$f.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){mh[b]=a[b]}),Df({withLegend:!0}),mh):mh},$f.x=function(a){return arguments.length&&(vc($f.data.targets,a),Df({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),$f.data.xs},$f.xs=function(a){return arguments.length&&(wc($f.data.targets,a),Df({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),$f.data.xs},$f.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){hb(b,a[b])}),Jb())},$f.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Xh=+a.x),b(a.y)&&(ci=+a.y),b(a.y2)&&(li=+a.y2)):ci=li=+a,Df({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},$f.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Yh=+a.x),b(a.y)&&(di=+a.y),b(a.y2)&&(mi=+a.y2)):di=mi=+a,Df({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},$f.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&$f.axis.max(a.max),"undefined"!=typeof a.min&&$f.axis.min(a.min))},$f.legend.show=function(a){Sf(Ic(a)),Df({withLegend:!0})},$f.legend.hide=function(a){Tf(Ic(a)),Df({withLegend:!0})},$f.resize=function(a){bg=a?a.width:null,cg=a?a.height:null,$f.flush(),$f.flush()},$f.flush=function(){Jf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},$f.destroy=function(){$f.data.targets=void 0,$f.data.xs={},bk.classed("c3",!1).html(""),a.onresize=null},"url"in f.data)Zf.xhr(f.data.url,function(a,b){var c,d=Zf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Zf.csv.parse(b.response),vf(c)});else if("rows"in f.data)vf(yc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");vf(zc(f.data.columns))}return $f},"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