diff --git a/c3.js b/c3.js index e8bbdf3..381741f 100644 --- a/c3.js +++ b/c3.js @@ -319,9 +319,10 @@ /*-- Set Chart Params --*/ var margin, margin2, margin3, width, width2, height, height2, currentWidth, currentHeight; - var radius, radiusExpanded, innerRadius, svgArc, svgArcExpanded, svgArcExpandedSub, pie; + var radius, radiusExpanded, innerRadius, arcWidth, arcHeight, svgArc, svgArcExpanded, svgArcExpandedSub, pie; var xMin, xMax, yMin, yMax, subXMin, subXMax, subYMin, subYMax; var x, y, y2, subX, subY, subY2, xAxis, yAxis, y2Axis, subXAxis; + var axes = {}; var xOrient = __axis_rotated ? "left" : "bottom", yOrient = __axis_rotated ? (__axis_y_inner ? "top" : "bottom") : (__axis_y_inner ? "right" : "left"), @@ -336,7 +337,7 @@ y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; }, subx : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, - arc: function () { return "translate(" + width / 2 + "," + height / 2 + ")"; } + arc: function () { return "translate(" + (arcWidth / 2) + "," + (arcHeight / 2) + ")"; } }; var isLegendRight = __legend_position === 'right'; @@ -407,8 +408,9 @@ function updateSizes() { var legendHeight = getLegendHeight(), legendWidth = getLegendWidth(), legendHeightForBottom = isLegendRight ? 0 : legendHeight, - xAxisHeight = __axis_rotated ? 0 : getHorizontalAxisHeight('x'), - subchartHeight = __subchart_show ? (__subchart_size_height + xAxisHeight) : 0; + hasArc = hasArcType(c3.data.targets), + xAxisHeight = __axis_rotated || hasArc ? 0 : getHorizontalAxisHeight('x'), + subchartHeight = __subchart_show && !hasArc ? (__subchart_size_height + xAxisHeight) : 0; currentWidth = getCurrentWidth(); currentHeight = getCurrentHeight(); @@ -417,9 +419,9 @@ if (__axis_rotated) { margin = { top: getHorizontalAxisHeight('y2') + __padding_top, - right: getCurrentPaddingRight(), + right: hasArc ? 0 : getCurrentPaddingRight(), bottom: getHorizontalAxisHeight('y') + legendHeightForBottom + __padding_bottom, - left: subchartHeight + getCurrentPaddingLeft() + left: subchartHeight + (hasArc ? 0 : getCurrentPaddingLeft()) }; margin2 = { top: margin.top, @@ -430,9 +432,9 @@ } else { margin = { top: 4 + __padding_top, // for top tick text - right: getCurrentPaddingRight(), + right: hasArc ? 0 : getCurrentPaddingRight(), bottom: xAxisHeight + subchartHeight + legendHeightForBottom + __padding_bottom, - left: getCurrentPaddingLeft() + left: hasArc ? 0 : getCurrentPaddingLeft() }; margin2 = { top: currentHeight - subchartHeight - legendHeightForBottom, @@ -460,10 +462,12 @@ if (height2 < 0) { height2 = 0; } // for arc + arcWidth = width - (isLegendRight ? legendWidth + 10 : 0); + arcHeight = height - (isLegendRight ? 0 : 10); updateRadius(); - if (isLegendRight && hasArcType(c3.data.targets)) { - margin3.left = width / 2 + radiusExpanded * 1.1; + if (isLegendRight && hasArc) { + margin3.left = arcWidth / 2 + radiusExpanded * 1.1; } } function updateXgridFocus() { @@ -474,7 +478,7 @@ .attr("y2", __axis_rotated ? -10 : height); } function updateRadius() { - radiusExpanded = height / 2; + radiusExpanded = Math.min(arcWidth, arcHeight) / 2; radius = radiusExpanded * 0.95; innerRadius = hasDonutType(c3.data.targets) ? radius * 0.6 : 0; } @@ -483,7 +487,8 @@ leftAxis = main.select('.' + leftAxisClass).node(), svgRect = leftAxis ? leftAxis.getBoundingClientRect() : {right: 0}, chartRect = d3.select(__bindto).node().getBoundingClientRect(), - svgLeft = svgRect.right - chartRect.left - getCurrentPaddingLeft(); + hasArc = hasArcType(c3.data.targets), + svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : getCurrentPaddingLeft()); return svgLeft > 0 ? svgLeft : 0; } function getCurrentWidth() { @@ -494,21 +499,18 @@ return h > 0 ? h : 320; } function getCurrentPaddingLeft() { - if (hasArcType(c3.data.targets)) { - return 0; - } else if (__padding_left) { + var defaultPadding = 1; + if (__padding_left) { return __padding_left; } else if (__axis_rotated) { - return !__axis_x_show ? 1 : getAxisWidthByAxisId('x'); + return !__axis_x_show ? defaultPadding : getAxisWidthByAxisId('x'); } else { - return !__axis_y_show || __axis_y_inner ? 1 : getAxisWidthByAxisId('y'); + return !__axis_y_show || __axis_y_inner ? defaultPadding : getAxisWidthByAxisId('y'); } } function getCurrentPaddingRight() { var defaultPadding = 1; - if (hasArcType(c3.data.targets)) { - return 0; - } else if (__padding_right) { + if (__padding_right) { return __padding_right; } else if (isLegendRight) { return getLegendWidth() + 20 + (__axis_y2_show && !__axis_rotated ? getAxisWidthByAxisId('y2') : defaultPadding); @@ -2590,38 +2592,35 @@ } // Add Axis - if (__axis_x_show) { - main.append("g") - .attr("class", CLASS.axisX) - .attr("clip-path", clipPathForXAxis) - .attr("transform", translate.x) - .append("text") - .attr("class", CLASS.axisXLabel) - .attr("transform", __axis_rotated ? "rotate(-90)" : "") - .style("text-anchor", textAnchorForXAxisLabel); - } - - if (__axis_y_show) { - main.append("g") - .attr("class", CLASS.axisY) - .attr("clip-path", clipPathForYAxis) - .attr("transform", translate.y) - .append("text") - .attr("class", CLASS.axisYLabel) - .attr("transform", __axis_rotated ? "" : "rotate(-90)") - .style("text-anchor", textAnchorForYAxisLabel); - } - - if (__axis_y2_show) { - main.append("g") - .attr("class", CLASS.axisY2) - // clip-path? - .attr("transform", translate.y2) - .append("text") - .attr("class", CLASS.axisY2Label) - .attr("transform", __axis_rotated ? "" : "rotate(-90)") - .style("text-anchor", textAnchorForY2AxisLabel); - } + axes.x = main.append("g") + .attr("class", CLASS.axisX) + .attr("clip-path", clipPathForXAxis) + .attr("transform", translate.x) + .style("visibility", __axis_x_show ? 'visible' : 'hidden'); + axes.x.append("text") + .attr("class", CLASS.axisXLabel) + .attr("transform", __axis_rotated ? "rotate(-90)" : "") + .style("text-anchor", textAnchorForXAxisLabel); + + axes.y = main.append("g") + .attr("class", CLASS.axisY) + .attr("clip-path", clipPathForYAxis) + .attr("transform", translate.y) + .style("visibility", __axis_y_show ? 'visible' : 'hidden'); + axes.y.append("text") + .attr("class", CLASS.axisYLabel) + .attr("transform", __axis_rotated ? "" : "rotate(-90)") + .style("text-anchor", textAnchorForYAxisLabel); + + axes.y2 = main.append("g") + .attr("class", CLASS.axisY2) + // clip-path? + .attr("transform", translate.y2) + .style("visibility", __axis_y2_show ? 'visible' : 'hidden'); + axes.y2.append("text") + .attr("class", CLASS.axisY2Label) + .attr("transform", __axis_rotated ? "" : "rotate(-90)") + .style("text-anchor", textAnchorForY2AxisLabel); /*-- Context Region --*/ @@ -2648,7 +2647,7 @@ // ATTENTION: This must be called AFTER chart added // Add Axis - context.append("g") + axes.subx = context.append("g") .attr("class", CLASS.axisX) .attr("transform", translate.subx) .attr("clip-path", __axis_rotated ? "" : clipPathForXAxis); @@ -3021,18 +3020,18 @@ } } - function redraw(options) { - var xaxis, subxaxis, yaxis, y2axis, xgrid, xgridAttr, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; + function redraw(options, transitions) { + var xgrid, xgridAttr, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; var mainLine, mainArea, mainCircle, mainBar, mainArc, mainRegion, mainText, contextLine, contextBar, eventRect, eventRectUpdate; var barIndices = getBarIndices(), maxDataCountTarget, tickOffset; var rectX, rectW; var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; var hideAxis = hasArcType(c3.data.targets); var drawBar, drawBarOnSub, xForText, yForText; - var transitions, duration, durationForExit, durationForAxis; + var duration, durationForExit, durationForAxis; var targetsToShow = filterTargetsToShow(c3.data.targets), tickValues, i, intervalForCulling; - options = isDefined(options) ? options : {}; + options = options || {}; withY = isDefined(options.withY) ? options.withY : true; withSubchart = isDefined(options.withSubchart) ? options.withSubchart : true; withTransition = isDefined(options.withTransition) ? options.withTransition : true; @@ -3048,17 +3047,7 @@ durationForExit = withTransitionForExit ? duration : 0; durationForAxis = withTransitionForAxis ? duration : 0; - xaxis = main.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1); - yaxis = main.select('.' + CLASS.axisY).style("opacity", hideAxis ? 0 : 1); - y2axis = main.select('.' + CLASS.axisY2).style("opacity", hideAxis ? 0 : 1); - subxaxis = context.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1); - - transitions = { - axisX: xaxis.transition().duration(durationForAxis), - axisY: yaxis.transition().duration(durationForAxis), - axisY2: y2axis.transition().duration(durationForAxis), - axisSubX: subxaxis.transition().duration(durationForAxis), - }; + transitions = transitions || generateAxisTransitions(durationForAxis); // update legend and transform each g if (withLegend && __legend_show) { @@ -3067,7 +3056,7 @@ // MEMO: needed for grids calculation if (isCategorized && targetsToShow.length === 0) { - x.domain([0, xaxis.selectAll('.tick').size()]); + x.domain([0, axes.x.selectAll('.tick').size()]); } if (targetsToShow.length) { @@ -3095,6 +3084,10 @@ y2.domain(getYDomain(targetsToShow, 'y2')); // axes + axes.x.style("opacity", hideAxis ? 0 : 1); + axes.y.style("opacity", hideAxis ? 0 : 1); + axes.y2.style("opacity", hideAxis ? 0 : 1); + axes.subx.style("opacity", hideAxis ? 0 : 1); transitions.axisX.call(xAxis); transitions.axisY.call(yAxis); transitions.axisY2.call(y2Axis); @@ -3125,7 +3118,7 @@ // rotate tick text if needed if (!__axis_rotated && __axis_x_tick_rotate) { - rotateTickText(xaxis, transitions.axisX, __axis_x_tick_rotate); + rotateTickText(axes.x, transitions.axisX, __axis_x_tick_rotate); } // setup drawer - MEMO: these must be called after axis updated @@ -3445,7 +3438,7 @@ // rotate tick text if needed if (!__axis_rotated && __axis_x_tick_rotate) { - rotateTickText(subxaxis, transitions.axisSubX, __axis_x_tick_rotate); + rotateTickText(axes.subx, transitions.axisSubX, __axis_x_tick_rotate); } // extent rect @@ -3628,7 +3621,17 @@ selectChart.style('max-height', currentHeight + "px"); } + function generateAxisTransitions(duration) { + return { + axisX: duration ? axes.x.transition().duration(duration) : axes.x, + axisY: duration ? axes.y.transition().duration(duration) : axes.y, + axisY2: duration ? axes.y2.transition().duration(duration) : axes.y2, + axisSubX: duration ? axes.subx.transition().duration(duration) : axes.subx, + }; + } + function updateAndRedraw(options) { + var transitions; options = options || {}; // same with redraw options.withTransition = isDefined(options.withTransition) ? options.withTransition : true; @@ -3638,14 +3641,18 @@ options.withUpdateXDomain = true; options.withUpdateOrgXDomain = true; options.withTransitionForExit = false; - // Update sizes and scales - updateSizes(); - updateScales(); - updateSvgSize(); - // Update g positions - transformAll(options.withTransition); + // MEMO: called in updateLegend in redraw if withLegend + if (!(options.withLegend && __legend_show)) { + transitions = generateAxisTransitions(options.withTransition ? __transition_duration : 0); + // Update sizes and scales + updateSizes(); + updateScales(); + updateSvgSize(); + // Update g positions + transformAll(options.withTransition, transitions); + } // Draw with new sizes & scales - redraw(options); + redraw(options, transitions); } function updateTargets(targets) { @@ -3888,6 +3895,7 @@ var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; var withTransition, withTransitionForTransform; var hasFocused = legend.selectAll('.' + CLASS.legendItemFocused).size(); + var texts, rects, tiles; options = options || {}; withTransition = isDefined(options.withTransition) ? options.withTransition : true; @@ -4013,25 +4021,25 @@ .attr('width', 10) .attr('height', 10); - legend.selectAll('text') + texts = legend.selectAll('text') .data(targetIds) .text(function (id) { return isDefined(__data_names[id]) ? __data_names[id] : id; }) // MEMO: needed for update - .each(function (id, i) { updatePositions(this, id, i === 0); }) - .transition().duration(withTransition ? 250 : 0) + .each(function (id, i) { updatePositions(this, id, i === 0); }); + (withTransition ? texts.transition() : texts) .attr('x', xForLegendText) .attr('y', yForLegendText); - legend.selectAll('rect.' + CLASS.legendItemEvent) - .data(targetIds) - .transition().duration(withTransition ? 250 : 0) + rects = legend.selectAll('rect.' + CLASS.legendItemEvent) + .data(targetIds); + (withTransition ? rects.transition() : rects) .attr('width', function (id) { return widths[id]; }) .attr('height', function (id) { return heights[id]; }) .attr('x', xForLegendRect) .attr('y', yForLegendRect); - legend.selectAll('rect.' + CLASS.legendItemTile) - .data(targetIds) - .transition().duration(withTransition ? 250 : 0) + tiles = legend.selectAll('rect.' + CLASS.legendItemTile) + .data(targetIds); + (withTransition ? tiles.transition() : tiles) .style('fill', color) .attr('x', xForLegend) .attr('y', yForLegend); diff --git a/c3.min.js b/c3.min.js index 2baa038..8677d30 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&abg&&(bg=0),0>dg&&(dg=0),cg=oh?$f.left-jj-kj:bg,eg=oh?dg:gg-_f.top-_f.bottom,0>cg&&(cg=0),0>eg&&(eg=0),r(),ej&&ke(Jf.data.targets)&&(ag.left=bg/2+1.1*ig)}function q(){tj.select("line."+g.xgridFocus).attr("x1",oh?0:-10).attr("x2",oh?bg:-10).attr("y1",oh?-10:$f.top).attr("y2",oh?-10:dg)}function r(){ig=dg/2,hg=.95*ig,jg=je(Jf.data.targets)?.6*hg:0}function s(){var a=oh?g.axisX:g.axisY,b=tj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=If.select(Lf).node().getBoundingClientRect(),e=c.right-d.left-v();return e>0?e:0}function t(){return Mf?Mf:z()}function u(){var a=Nf?Nf:A();return a>0?a:320}function v(){return ke(Jf.data.targets)?0:Of?Of:oh?ph?x("x"):1:!Hh||Mh?1:x("y")}function w(){var a=1;return ke(Jf.data.targets)?0:Pf?Pf:ej?R()+20+(Qh&&!oh?x("y2"):a):Qh?Vh||oh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||ph?"x"===a&&Eh?Eh:"y"!==a||Hh?"y2"!==a||Qh?(mb(a).isInner?30:40)+("y2"===a?-10:0):lj:ih&&!ej?10:1:0}function z(){return+If.select(Lf).style("width").replace("px","")}function A(){return+If.select(Lf).style("height").replace("px","")}function B(a){return a?-31:-($f.left-1)}function C(a){return a?-20:-4}function D(){return B(!oh)}function E(){return C(!oh)}function F(){return B(oh)}function G(){return C(oh)}function H(a){return a?bg+2+30+30:$f.left+20}function I(a){return a?(Eh?Eh:0)+80:dg+8}function J(){return H(!oh)}function K(){return I(!oh)}function L(){return H(oh)}function M(){return I(oh)}function N(){var a,b,c,d,e,f=Cc(Jf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=wg(b.x)-wg(a.x),0===c?oh?dg:bg:(d=Bc(),e=ge(Jf.data.targets)?(d-(Oi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){fj=a}function P(a){gj=a}function Q(a){hj=a}function R(){return ih?ej?gj*(fj+1):fg:0}function S(){return ih?ej?gg:hj*(fj+1):0}function T(){var a,b,c=!wg;og=oh?1:0,pg=oh?dg:bg,qg=oh?0:dg,rg=oh?bg:1,sg=og,tg=pg,ug=oh?0:eg,vg=oh?cg:1,wg=W(og,pg,c?void 0:wg.domain(),function(){return Cg.tickOffset()}),xg=X(qg,rg,c?void 0:xg.domain()),yg=X(qg,rg,c?void 0:yg.domain()),zg=W(og,pg,yj,function(a){return a%1?0:Fg.tickOffset()}),Ag=X(ug,vg,c?void 0:Ag.domain()),Bg=X(ug,vg,c?void 0:Bg.domain()),a=bb(),b=zh?zh:c?void 0:Cg.tickValues(),Cg=$(wg,_i,a,b),Fg=$(zg,cj,a,b),Dg=_(xg,aj,Nh,Ph),Eg=_(yg,bj,Wh,Yh),c||(mj.scale(zg),Sf&&qj.scale(wg)),U()}function U(){kg=Ib(),lg=Jb(),mg=Jb(.98)}function V(a,b,c){return(c?If.time.scale():If.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ni),g=c?f.domain(c):f;Oi?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return yj&&yj[0]===a[0]&&yj[1]a?a.toFixed(0):a};return uh&&("function"==typeof uh?a=uh:Ni&&(a=function(a){return a?Xi(uh)(a):""})),a}function cb(a){var b;return"y"===a?b=Lh:"y2"===a?b=Uh:"x"===a&&(b=Gh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Lh=b:"y2"===a?Uh=b:"x"===a&&(Gh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function jb(){return ib("x",oh?"inner-top":"inner-right")}function kb(){return ib("y",oh?"inner-right":"inner-top")}function lb(){return ib("y2",oh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?bg/2:bg:b.isBottom?-dg:b.isMiddle?-dg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!oh,jb())}function ub(){return qb(oh,kb())}function vb(){return qb(oh,lb())}function wb(){return rb(!oh,jb())}function xb(){return rb(oh,kb())}function yb(){return rb(oh,lb())}function zb(){var a=jb();return oh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Eh?Eh-10:"3em"}function Ab(){var a=kb();return oh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return oh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!oh,jb())}function Db(){return sb(oh,kb())}function Eb(){return sb(oh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return If.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=tj.select("."+g.axisX+" ."+g.axisXLabel),c=tj.select("."+g.axisY+" ."+g.axisYLabel),d=tj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return ng(Kc(Jf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=If.svg.arc().outerRadius(hg).innerRadius(jg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=If.svg.arc().outerRadius(ig*(a?a:1)).innerRadius(jg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return re(a.data)?kg(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=kg.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*hg*.8+","+d/e*hg*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Fd(c,d)):""}function Pb(a,b){var c=rj.selectAll("."+g.chartArc+rd(a)),d=rj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});xe(a)&&c.selectAll("path").transition().duration(50).attr("d",lg).transition().duration(100).attr("d",mg).each(function(a){qe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=rj.selectAll("."+g.chartArc+rd(a));b.selectAll("path").transition().duration(50).attr("d",kg),rj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return je(Jf.data.targets)?si:mi}function Sb(){return je(Jf.data.targets)?ti:ni}function Tb(){return je(Jf.data.targets)?vi:""}function Ub(){var a=je(Jf.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(){var a=je(Jf.data.targets)?xi:qi;return"function"==typeof a?a:function(){}}function Wb(){var a=je(Jf.data.targets)?yi:ri;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Mg.length>0)for(g=Tc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return If.min(Object.keys(i).map(function(a){return If.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Mg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return If.max(Object.keys(i).map(function(a){return If.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Sh:Jh,n="y2"===c?Rh:Ih,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Th:Kh,r=zd()&&oh;return 0===l.length?"y2"===c?yg.domain():xg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Ad(o,p),j=cc(xg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Oh&&(f=b(Oh.top)?Oh.top:e,g=b(Oh.bottom)?Oh.bottom:e),"y2"===c&&Xh&&(f=b(Xh.top)?Xh.top:e,g=b(Xh.bottom)?Xh.bottom:e),ge(l)&&!Tc(l)&&(g=o),[o-g,p+f])}function $b(a){return Ch?Ni?ze(Ch):Ch:If.min(a,function(a){return If.min(a.values,function(a){return a.x})})}function _b(a){return Bh?Ni?ze(Bh):Bh:If.max(a,function(a){return If.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Oi?d=0:ge(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Dh&&Ee(Dh)?(e=b(Dh.left)?Dh.left:d,f=b(Dh.right)?Dh.right:d):e=f="number"==typeof Dh?Dh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Oi||(c=Ni?new Date(.5*c.getTime()):-.5,d=Ni?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ni?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ni?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?xg:yg;return b="y"===a.axis||"y2"===a.axis?oh?dg:"start"in a?d(a.start):dg:oh?"end"in a?wg(Ni?ze(a.end):a.end):dg:dg,c>b?0:b-c}function kc(a){return Gg&&a===Gg||Ee(Hg)&&Fe(Hg,a)}function lc(a){return!kc(a)}function mc(a){return Gg?Gg:Ee(Hg)?Hg[a]:null}function nc(a,b){var c,d=b&&Ee(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Jf.data.xs[b])}),c}function oc(a,b){return a in Jf.data.xs&&Jf.data.xs[a]&&Jf.data.xs[a][b]?Jf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Hg[b]=a[b]})}function qc(a){return 1===If.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Kg[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Jf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ni?a?a instanceof Date?a:ze(a):ze(oc(c,d)):Pi&&!Oi?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Jf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Gg?(d=Object.keys(Jf.data.xs),Jf.data.xs[c]=d.length>0?Jf.data.xs[d[0]]:void 0):Ee(Hg)&&(Jf.data.xs[c]=nc(f,Jf.data.targets)):Jf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Jf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Jg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Pi&&Oi&&0===c&&g&&(0===e&&(sh=[]),sh.push(g)),("undefined"==typeof a[b]||Jf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Og&&ee(Ec(c).filter(function(a){return!(a in Pg)}),Og),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function zc(a){return a>0&&Jf.data.targets[0].values[a-1]?Jf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Jf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ni?new Date(i):i);j.push(e)}return Ni||(j=j.sort(function(a,b){return a-b})),j}function Nc(a){Zi=Zi.concat(a)}function Oc(a){Zi=Zi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){$i=$i.concat(a)}function Qc(a){$i=$i.filter(function(b){return a.indexOf(b)<0})}function Rc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Sc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Uc(a){return Sc(a,function(a){return a>0})}function Vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Ld(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Ld(a,g))),Od(e,b)):Md(a,b,f,g)}function Nd(a,b){var c;return c=a.map(function(a){return Md(a.values,b)}),Od(c,b)}function Od(a,b){var c,d;return a.forEach(function(a){var e=Ge(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Pd(a,b){return If.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Qd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Rd(){return Rg&&"desc"===Rg.toLowerCase()}function Sd(){return Rg&&"asc"===Rg.toLowerCase()}function Td(a){var b=Sd(),c=Rd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Rg&&a.sort(Rg),a}function Ud(a,c){var d,e,f,g,h,i,j,k=ke(Jf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ai&&(wj.html(Di(a,bb(),Bd(k),Wi)).style("display","block"),d=wj.property("offsetWidth"),e=wj.property("offsetHeight"),k?(g=bg/2+c[0],i=dg/2+c[1]+20):(oh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=wg(l[0].x)+20):(f=s(),g=f+v()+wg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),wj.style("top",i+"px").style("left",g+"px"))}function Vd(){wj.style("display","none")}function Wd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ai&&!he(Jf.data.targets)&&!ke(Jf.data.targets)){var d=tj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(oh?"y1":"x1",Hd).attr(oh?"y2":"x2",Hd),mf(d,"grid")}}function Xd(){tj.select("line."+g.xgridFocus).style("visibility","hidden")}function Yd(a,b){var c,d,e,f,h=[],i=tj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Zd(a){return a.x||0===a.x?wg(a.x):null}function $d(a){return Y(a.id)(a.value)}function _d(){var a,b,d={},e=0;return Kc(Hc(ne)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function de(a,b){return"number"==typeof ki?ki:b?2*a.tickOffset()*li/b:0}function ee(a,b){Fc(a).forEach(function(a){Aj[a]=b===Pg[a],Pg[a]=b})}function fe(a,b){var c=!1;return a.forEach(function(a){Pg[a.id]===b&&(c=!0),a.id in Pg||"line"!==b||(c=!0)}),c}function ge(a){return fe(a,"bar")}function he(a){return fe(a,"scatter")}function ie(a){return fe(a,"pie")}function je(a){return fe(a,"donut")}function ke(a){return ie(a)||je(a)}function le(a){var b="string"==typeof a?a:a.id;return!(b in Pg)||"line"===Pg[b]||"spline"===Pg[b]||"area"===Pg[b]||"area-spline"===Pg[b]}function me(a){var b="string"==typeof a?a:a.id;return"spline"===Pg[b]||"area-spline"===Pg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"bar"===Pg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"scatter"===Pg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"pie"===Pg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"donut"===Pg[b]}function re(a){return pe(a)||qe(a)}function se(a){return le(a)?[a]:[]}function te(a){return re(a.data)?[a]:[]}function ue(a){return ne(a)?a.values:[]}function ve(a){return le(a)||oe(a)?a.values:[]}function we(a){return ne(a)||le(a)?a.values:[]}function xe(a){return qe(a)&&ui||pe(a)&&oi}function ye(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ze(b){var c;try{c=Ig?If.time.format(Ig).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Ig)}return c}function Ae(a,b){var c=If.mouse(a),d=If.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Fe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ge(a,b){var c="y"===ab(a.id)?xg:yg,d=oh?1:0,e=oh?0:1;return Math.pow(wg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function He(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ie(a,b,c){bh(b,a.node()),tj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Wc(g.selectedCircle,c)}).attr("cx",oh?$d:Zd).attr("cy",oh?Zd:$d).attr("stroke",function(){return Wi(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){ch(b,a.node()),tj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){bh(b,a.node()),a.transition().duration(100).style("fill",function(){return If.rgb(Wi(b)).brighter(.75)})}function Me(a,b){ch(b,a.node()),a.transition().duration(100).style("fill",function(){return Wi(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:If.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return di?"function"==typeof ei?ei(a):ei:0}function Se(a){return gi?hi?hi:1.75*Re(a):Re(a)}function Te(a){return ii?ii:4*Re(a)}function Ue(a,c){return(c?tj.selectAll("."+g.circles+qd(c)):tj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return If.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return tj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=oh?1:0,f=oh?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return oh?(c=ne(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return oh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ne(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=de(Cg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return oh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(xj=If.select(Lf),xj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(xj.html("").classed("c3",!0),Jf.data.xs={},Jf.data.targets=xc(b),Vg&&Nc(Vg===!0?Ec(Jf.data.targets):Vg),p(),T(),wg.domain(If.extent(bc(Jf.data.targets))),xg.domain(Zb(Jf.data.targets,"y")),yg.domain(Zb(Jf.data.targets,"y2")),zg.domain(wg.domain()),Ag.domain(xg.domain()),Bg.domain(yg.domain()),yj=wg.domain(),mj.scale(zg),Sf&&qj.scale(wg),rj=xj.append("svg").on("mouseenter",Vf).on("mouseleave",Wf),sj=rj.append("defs"),sj.append("clipPath").attr("id",Hi).append("rect"),sj.append("clipPath").attr("id",Ii).append("rect"),sj.append("clipPath").attr("id",Ji).append("rect"),rf(),tj=rj.append("g").attr("transform",dj.main),uj=rj.append("g").attr("transform",dj.context),vj=rj.append("g").attr("transform",dj.legend),fh||uj.style("visibility","hidden"),ih||(vj.style("visibility","hidden"),$i=Ec(Jf.data.targets)),wj=If.select(Lf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Df(Ec(Jf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=tj.append("g").attr("clip-path",Ki).attr("class",g.grid),Zh&&d.append("g").attr("class",g.xgrids),Ee(_h)&&d.append("g").attr("class",g.xgridLines),fi&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ai&&d.append("g").attr("class",g.ygrids),Ee(bi)&&d.append("g").attr("class",g.ygridLines),tj.append("g").attr("clip-path",Ki).attr("class",g.regions),tj.append("g").attr("clip-path",Ki).attr("class",g.chart),c=tj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Sf?oh?"ns-resize":"ew-resize":null),tj.select("."+g.chart).append("g").attr("class",g.chartBars),tj.select("."+g.chart).append("g").attr("class",g.chartLines),tj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",dj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),tj.select("."+g.chart).append("g").attr("class",g.chartTexts),Sf&&tj.insert("rect",Uf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",bg).attr("height",dg).style("opacity",0).style("cursor",oh?"ns-resize":"ew-resize").call(qj).on("dblclick.zoom",null),Fh&&mj.extent("function"!=typeof Fh?Fh:Fh(bc())),ph&&tj.append("g").attr("class",g.axisX).attr("clip-path",Li).attr("transform",dj.x).append("text").attr("class",g.axisXLabel).attr("transform",oh?"rotate(-90)":"").style("text-anchor",Cb),Hh&&tj.append("g").attr("class",g.axisY).attr("clip-path",Mi).attr("transform",dj.y).append("text").attr("class",g.axisYLabel).attr("transform",oh?"":"rotate(-90)").style("text-anchor",Db),Qh&&tj.append("g").attr("class",g.axisY2).attr("transform",dj.y2).append("text").attr("class",g.axisY2Label).attr("transform",oh?"":"rotate(-90)").style("text-anchor",Eb),uj.append("g").attr("clip-path",Ki).attr("class",g.chart),uj.select("."+g.chart).append("g").attr("class",g.chartBars),uj.select("."+g.chart).append("g").attr("class",g.chartLines),uj.append("g").attr("clip-path",Ki).attr("class",g.brush).call(mj).selectAll("rect").attr(oh?"width":"height",oh?cg:eg),uj.append("g").attr("class",g.axisX).attr("transform",dj.subx).attr("clip-path",oh?"":Li),tf(Jf.data.targets),oh?tj.select("."+g.axisX).style("opacity",0).call(Cg):(tj.select("."+g.axisY).style("opacity",0).call(Dg),tj.select("."+g.axisY2).style("opacity",0).call(Eg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ei){if(Ni&&"string"==typeof Fi){for(Fi=ze(Fi),e=0;e0){d=[];for(var f in Kg)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Qd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){ke(Jf.data.targets)||Wg&&(Qi=a,tj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Ri=!0,dh())}function lf(){ke(Jf.data.targets)||Wg&&(tj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),tj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Ri=!1,eh())}function mf(a,b){"grid"===b&&a.each(function(){var a=If.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a){var c,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=_d(),ab=ke(Jf.data.targets),bb=Kc(Jf.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,M=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Zf:0,W=J?V:0,X=K?V:0,c=tj.select("."+g.axisX).style("opacity",ab?0:1),f=tj.select("."+g.axisY).style("opacity",ab?0:1),h=tj.select("."+g.axisY2).style("opacity",ab?0:1),e=uj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&ih&&Df(Ec(Jf.data.targets),a,U),Oi&&0===bb.length&&wg.domain([0,c.selectAll(".tick").size()]),bb.length&&(O&&(wg.domain(If.extent(bc(bb))),yj=wg.domain(),Sf&&qj.scale(wg).updateScaleExtent(),zg.domain(wg.domain()),mj.scale(zg)),M&&(wg.domain(mj.empty()?yj:mj.extent()),Sf&&qj.scale(wg).updateScaleExtent()),zh||!yh&&!xh||(Y=Mc(Lc(bb),xh),Cg.tickValues(Y),Fg.tickValues(Y))),xg.domain(Zb(bb,"y")),yg.domain(Zb(bb,"y2")),U.axisX.call(Cg),U.axisY.call(Dg),U.axisY2.call(Eg),U.axisSubX.call(Fg),Gb(I),M&&bb.length)if(vh&&Y){for(Z=1;Z=0&&If.select(this).style("display",b%$?"none":"block")})}else rj.selectAll("."+g.axisX+" .tick text").style("display","block");!oh&&Ah&&hb(c,U.axisX,Ah),Q=$e(_),S=_e(_,!0),T=_e(_,!1),Ag.domain(xg.domain()),Bg.domain(yg.domain()),wj.style("display","none"),q(),tj.select("line."+g.xgridFocus).style("visibility","hidden"),Zh&&(k=Yd($h,wg),D=Oi?Cg.tickOffset():0,j=oh?{x1:0,x2:bg,y1:function(a){return wg(a)-D},y2:function(a){return wg(a)-D}}:{x1:function(a){return wg(a)+D},x2:function(a){return wg(a)+D},y1:$f.top,y2:dg},i=tj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+If.select(this).attr(oh?"y1":"x1")===(oh?dg:0)?0:1}),i.exit().remove()),Ee(_h)&&(l=tj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(_h),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",oh?"":"rotate(-90)").attr("dx",oh?0:-$f.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",oh?0:Id).attr("x2",oh?bg:Id).attr("y1",oh?Id:$f.top).attr("y2",oh?Id:dg).style("opacity",1),l.select("text").transition().duration(V).attr("x",oh?bg:0).attr("y",Id).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&ai&&(n=tj.select("."+g.ygrids).selectAll("."+g.ygrid).data(xg.ticks(ci)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",oh?xg:0).attr("x2",oh?xg:bg).attr("y1",oh?0:xg).attr("y2",oh?dg:xg),n.exit().remove(),mf(n,"grid")),G&&Ee(bi)&&(o=tj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(bi),p=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",oh?"rotate(-90)":"").attr("dx",oh?0:-$f.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",oh?Jd:0).attr("x2",oh?Jd:bg).attr("y1",oh?0:Jd).attr("y2",oh?dg:Jd).style("opacity",1),o.select("text").transition().duration(V).attr("x",oh?0:bg).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=tj.select("."+g.regions).selectAll("."+g.region).data(zi),w.enter().append("g").attr("class",jd).append("rect").style("fill-opacity",0),w.selectAll("rect").transition().duration(V).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=tj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),u.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Wi),u.style("opacity",vd).transition().duration(V).attr("d",Q).style("fill",Wi).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=tj.selectAll("."+g.lines).selectAll("."+g.line).data(se),r.enter().append("path").attr("class",_c).style("stroke",Wi),r.style("opacity",vd).transition().duration(V).attr("d",nj).style("stroke",Wi).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=tj.selectAll("."+g.areas).selectAll("."+g.area).data(se),s.enter().append("path").attr("class",hd).style("fill",Wi).style("opacity",function(){return zj=+If.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",oj).style("fill",Wi).style("opacity",zj),s.exit().transition().duration(W).style("opacity",0).remove(),t=tj.selectAll("."+g.circles).selectAll("."+g.circle).data(ve),t.enter().append("circle").attr("class",bd).attr("r",Re).style("fill",Wi),t.style("opacity",vd).transition().duration(V).style("opacity",xd).style("fill",Wi).attr("cx",oh?$d:Zd).attr("cy",oh?Zd:$d),t.exit().remove(),x=tj.selectAll("."+g.texts).selectAll("."+g.text).data(we),x.enter().append("text").attr("class",Xc).attr("text-anchor",function(a){return oh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Wi).style("fill-opacity",0),x.text(function(a){return Gd(a.id)(a.value,a.id)}).style("fill-opacity",wd).transition().duration(V).attr("x",S).attr("y",T).style("fill",Wi).style("fill-opacity",yd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=tj.selectAll("."+g.arcs).selectAll("."+g.arc).data(te),v.enter().append("path").attr("class",fd).style("fill",function(a){return Wi(a.data)}).style("cursor",function(a){return Yg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ui||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),zf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Ud(d,If.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ui||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Af(),Vd(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ui=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Hb(a);return c?(b=If.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Wi(a.data)}).style("opacity",1).call(He,function(){Ui=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),tj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(V).text(Ob).style("opacity",function(a){return Ic(a.data.id)&&re(a.data)?1:0}),tj.select("."+g.chartArcsTitle).style("opacity",je(Jf.data.targets)?1:0),fh&&(If.event&&"zoom"===If.event.type&&mj.extent(wg.orgDomain()).update(),H&&(!oh&&Ah&&hb(e,U.axisSubX,Ah),mj.empty()||mj.extent(wg.orgDomain()).update(),R=$e(_,!0),z=uj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),z.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Wi),z.style("opacity",vd).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=uj.selectAll("."+g.lines).selectAll("."+g.line).data(se),y.enter().append("path").attr("class",_c).style("stroke",Wi),y.style("opacity",vd).transition().duration(V).attr("d",pj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),tj.selectAll("."+g.selectedCircles).filter(function(a){return ne(a)}).selectAll("circle").remove(),tj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",oh?$d:Zd).attr("cy",oh?Zd:$d),A=tj.select("."+g.eventRects),Ee(Hg)&&!qc(Hg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=tj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(B.enter()),B.attr("x",0).attr("y",0).attr("width",bg).attr("height",dg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Pi&&!Oi?(F=function(a,b){var c=zc(b),d=Ac(b),e=Jf.data.xs[a.id][b];return(wg(d?d:e+50)-wg(c?c:e-50))/2},E=function(a,b){var c=zc(b),d=Jf.data.xs[a.id][b];return(wg(d)+wg(c?c:d-50))/2}):(F=N(),E=function(a){return wg(a.x)-F/2}),C=Cc(Jf.data.targets),tj.select("."+g.eventRects).datum(C?C.values:[]),B=tj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(B.enter()),B.attr("class",kd).attr("x",oh?0:E).attr("y",oh?E:0).attr("width",oh?bg:F).attr("height",oh?F:dg),B.exit().remove()),Ec(Jf.data.targets).forEach(function(a){Aj[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Kc(Jf.data.targets).length){if("mousemove"===If.event.sourceEvent.type&&qj.altDomain)return wg.domain(qj.altDomain),void qj.scale(wg).updateScaleExtent();Oi&&wg.orgDomain()[0]===yj[0]&&wg.domain([yj[0]-1e-10,wg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===If.event.sourceEvent.type&&(Si=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){rj.attr("width",fg).attr("height",gg),rj.select("#"+Hi).select("rect").attr("width",bg).attr("height",dg),rj.select("#"+Ii).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),rj.select("#"+Ji).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),rj.select("."+g.zoomRect).attr("width",bg).attr("height",dg),xj.style("max-height",gg+"px")}function sf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,p(),T(),rf(),o(a.withTransition),nf(a)}function tf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=tj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",md),j=i.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Yc),e=tj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),d=e.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",ed).style("cursor",function(a){return Yg(a)?"pointer":null}),c=tj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),b=c.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",ad),b.append("g").attr("class",id),b.append("g").attr("class",function(a){return Wc(g.selectedCircles,a.id)}),b.append("g").attr("class",cd).style("cursor",function(a){return Yg(a)?"pointer":null}),a.forEach(function(a){tj.selectAll("."+g.selectedCircles+qd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=tj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(ng(a)).attr("class",pd),f=h.enter().append("g").attr("class",pd),f.append("g").attr("class",gd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),fh&&(n=uj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),m=n.enter().append("g").style("opacity",0).attr("class",od),m.append("g").attr("class",ed),l=uj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),k=l.enter().append("g").style("opacity",0).attr("class",nd),k.append("g").attr("class",ad)),rj.selectAll("."+g.target).filter(function(a){return Ic(a.id)}).transition().duration(Zf).style("opacity",1)}function uf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ee(a.id,b.types[a.id]):ee(a.id,b.type)}),Jf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ej?j:i,l=ej?S():R();return d&&(w=0,C=0,t=0,u=0),ih&&!Jc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ej?u:t,void(nh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=vj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,ej?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=vj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Wc(g.legendItem,a)}).style("visibility",function(a){return Jc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof kh?kh(a):Jf.toggle(a)}).on("mouseover",function(a){If.select(this).classed(g.legendItemFocused,!0),Ui||Jf.focus(a),"function"==typeof lh&&lh(a)}).on("mouseout",function(a){If.select(this).classed(g.legendItemFocused,!1),Ui||Jf.revert(),"function"==typeof mh&&mh(a)}),m.append("text").text(function(a){return d(Kg[a])?Kg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ej?h:-200).attr("y",ej?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",ej?i:-200).attr("y",ej?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Wi).attr("x",ej?h:-200).attr("y",ej?-200:j).attr("width",10).attr("height",10),vj.selectAll("text").data(a).text(function(a){return d(Kg[a])?Kg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(n?250:0).attr("x",h).attr("y",k),vj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(n?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),vj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(n?250:0).style("fill",Wi).attr("x",f).attr("y",j),vj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Ic(a)}).transition().style("opacity",function(a){var b=If.select(this);return Ic(a)?!D||b.classed(g.legendItemFocused)?xf(b):yf(b):ij}),P(t),Q(u),O(C),p(),T(),rf(),o(q,c)}function Ef(a){return Gc(Jf.data.targets,a.id)}function Ff(a){return"data"in a&&Gc(Jf.data.targets,a.data.id)}function Gf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Hf(a,b,c){var d=!ke(Jf.data.targets);Ui=!1,ee(a,b),sf(c||{withTransitionForAxis:d})}var If=a.d3?a.d3:a.require?a.require("d3"):void 0,Jf={data:{},axis:{},legend:{}},Kf={},Lf=i(["bindto"],"#chart"),Mf=i(["size","width"]),Nf=i(["size","height"]),Of=i(["padding","left"],50),Pf=i(["padding","right"],0),Qf=i(["padding","top"],0),Rf=i(["padding","bottom"],0),Sf=i(["zoom","enabled"],!1),Tf=i(["zoom","extent"]),Uf=i(["zoom","privileged"],!1),Vf=i(["onenter"],function(){}),Wf=i(["onleave"],function(){}),Xf=i(["onresize"],function(){}),Yf=i(["onresized"],function(){}),Zf=i(["transition","duration"],350);h("data","data is required in config");var $f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg=i(["data","x"]),Hg=i(["data","xs"],{}),Ig=i(["data","x_format"]),Jg=i(["data","id_converter"],function(a){return a}),Kg=i(["data","names"],{}),Lg=i(["data","classes"],{}),Mg=i(["data","groups"],[]),Ng=i(["data","axes"],{}),Og=i(["data","type"]),Pg=i(["data","types"],{}),Qg=i(["data","labels"],{}),Rg=i(["data","order"]),Sg=i(["data","regions"],{}),Tg=i(["data","color"]),Ug=i(["data","colors"],{}),Vg=i(["data","hide"],!1),Wg=i(["data","selection","enabled"],!1),Xg=i(["data","selection","grouped"],!1),Yg=i(["data","selection","isselectable"],function(){return!0}),Zg=i(["data","selection","multiple"],!0),$g=i(["data","onclick"],function(){}),_g=i(["data","onenter"],function(){}),ah=i(["data","onleave"],function(){}),bh=i(["data","onselected"],function(){}),ch=i(["data","onunselected"],function(){}),dh=i(["data","ondragstart"],function(){}),eh=i(["data","ondragend"],function(){}),fh=i(["subchart","show"],!1),gh=i(["subchart","size","height"],60),hh=i(["color","pattern"],[]),ih=i(["legend","show"],!0),jh=i(["legend","position"],"bottom"),kh=i(["legend","item","onclick"]),lh=i(["legend","item","onmouseover"]),mh=i(["legend","item","onmouseout"]),nh=i(["legend","equally"],!1),oh=i(["axis","rotated"],!1),ph=i(["axis","x","show"],!0),qh=i(["axis","x","type"],"indexed"),rh=i(["axis","x","localtime"],!0),sh=i(["axis","x","categories"],[]),th=i(["axis","x","tick","centered"],!1),uh=i(["axis","x","tick","format"]),vh=i(["axis","x","tick","culling"],{}),wh=i(["axis","x","tick","culling","max"],10),xh=i(["axis","x","tick","count"]),yh=i(["axis","x","tick","fit"],!0),zh=i(["axis","x","tick","values"],null),Ah=i(["axis","x","tick","rotate"]),Bh=i(["axis","x","max"],null),Ch=i(["axis","x","min"],null),Dh=i(["axis","x","padding"],{}),Eh=i(["axis","x","height"]),Fh=i(["axis","x","default"]),Gh=i(["axis","x","label"],{}),Hh=i(["axis","y","show"],!0),Ih=i(["axis","y","max"]),Jh=i(["axis","y","min"]),Kh=i(["axis","y","center"]),Lh=i(["axis","y","label"],{}),Mh=i(["axis","y","inner"],!1),Nh=i(["axis","y","tick","format"]),Oh=i(["axis","y","padding"]),Ph=i(["axis","y","ticks"],10),Qh=i(["axis","y2","show"],!1),Rh=i(["axis","y2","max"]),Sh=i(["axis","y2","min"]),Th=i(["axis","y2","center"]),Uh=i(["axis","y2","label"],{}),Vh=i(["axis","y2","inner"],!1),Wh=i(["axis","y2","tick","format"]),Xh=i(["axis","y2","padding"]),Yh=i(["axis","y2","ticks"],10),Zh=i(["grid","x","show"],!1),$h=i(["grid","x","type"],"tick"),_h=i(["grid","x","lines"],[]),ai=i(["grid","y","show"],!1),bi=i(["grid","y","lines"],[]),ci=i(["grid","y","ticks"],10),di=i(["point","show"],!0),ei=i(["point","r"],2.5),fi=i(["point","focus","line","enabled"],!0),gi=i(["point","focus","expand","enabled"],!0),hi=i(["point","focus","expand","r"]),ii=i(["point","focus","select","r"]),ji=i(["line","connect_null"],!1),ki=i(["bar","width"]),li=i(["bar","width","ratio"],.6),mi=i(["pie","label","show"],!0),ni=i(["pie","label","format"]),oi=i(["pie","expand"],!0),pi=i(["pie","onclick"],function(){}),qi=i(["pie","onmouseover"],function(){}),ri=i(["pie","onmouseout"],function(){}),si=i(["donut","label","show"],!0),ti=i(["donut","label","format"]),ui=i(["donut","expand"],!0),vi=i(["donut","title"],""),wi=i(["donut","onclick"],function(){}),xi=i(["donut","onmouseover"],function(){}),yi=i(["donut","onmouseout"],function(){}),zi=i(["regions"],[]),Ai=i(["tooltip","show"],!0),Bi=i(["tooltip","format","title"]),Ci=i(["tooltip","format","value"]),Di=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Bi?Bi:b,l=Ci?Ci:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ei=i(["tooltip","init","show"],!1),Fi=i(["tooltip","init","x"],0),Gi=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Hi=("string"==typeof Lf?Lf.replace("#",""):Lf.id)+"-clip",Ii=Hi+"-xaxis",Ji=Hi+"-yaxis",Ki=j(Hi),Li=j(Ii),Mi=j(Ji),Ni="timeseries"===qh,Oi="categorized"===qh,Pi=!Ni&&(Gg||Ee(Hg)),Qi=null,Ri=!1,Si=!1,Ti=!1,Ui=!1,Vi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Wi=ye(Ug,Ee(hh)?hh:Vi,Tg),Xi=rh?If.time.format:If.time.format.utc,Yi=Xi.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),Zi=[],$i=[],_i=oh?"left":"bottom",aj=oh?Mh?"top":"bottom":Mh?"right":"left",bj=oh?Vh?"bottom":"top":Vh?"left":"right",cj=oh?"left":"bottom",dj={main:function(){return"translate("+k($f.left)+","+k($f.top)+")"},context:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},legend:function(){return"translate("+ag.left+","+ag.top+")"},x:function(){return"translate(0,"+(oh?0:dg)+")"},y:function(){return"translate(0,"+(oh?dg:0)+")"},y2:function(){return"translate("+(oh?0:bg)+","+(oh?1:0)+")"},subx:function(){return"translate(0,"+(oh?0:eg)+")"},arc:function(){return"translate("+bg/2+","+dg/2+")"}},ej="right"===jh,fj=0,gj=0,hj=0,ij=.15,jj=30,kj=oh&&!ph?0:30,lj=5;ng=If.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value -},0)});var mj,nj=function(){var a=If.svg.line().x(oh?function(a){return Y(a.id)(a.value)}:Hd).y(oh?Hd:function(a){return Y(a.id)(a.value)});return ji||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ji?Qe(b.values):b.values;return le(b)?(a.interpolate(me(b)?"cardinal":"linear"),Sg[b.id]?df(e,wg,Y(b.id),Sg[b.id]):a(e)):(c=e[0]?wg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,oh?"M "+d+" "+c:"M "+c+" "+d)}}(),oj=function(){var a;return a=oh?If.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Hd):If.svg.area().x(Hd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return fe([b],"area")||fe([b],"area-spline")?(a.interpolate(me(b)?"cardinal":"linear"),a(e)):(c=e[0]?wg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,oh?"M "+d+" "+c:"M "+c+" "+d)}}(),pj=function(){var a=If.svg.line().x(oh?function(a){return Z(a.id)(a.value)}:Kd).y(oh?Kd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return le(b)?a(c):"M "+zg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),qj=function(){};mj=If.svg.brush().on("brush",of),mj.update=function(){return uj&&uj.select("."+g.brush).call(this),this},mj.scale=function(a){return oh?this.y(a):this.x(a)},Sf&&(qj=If.behavior.zoom().on("zoomstart",function(){qj.altDomain=If.event.sourceEvent.altKey?wg.orgDomain():null}).on("zoom",Sf?pf:null),qj.scale=function(a){return oh?this.y(a):this.x(a)},qj.orgScaleExtent=function(){var a=Tf?Tf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},qj.updateScaleExtent=function(){var a=cc(wg.orgDomain())/cc(yj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var rj,sj,tj,uj,vj,wj,xj,yj,zj,Aj={};if(Jf.focus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=rj.selectAll(rd(a)),d=c.filter(Ef),e=c.filter(Ff);Jf.revert(),Jf.defocus(),b(d.classed(g.focused,!0)),b(e),ke(Jf.data.targets)&&Pb(a,!0),zf(a,!0)},Jf.defocus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",.3)}var c=rj.selectAll(rd(a)),d=c.filter(Ef),e=c.filter(Ff);Jf.revert(),b(d.classed(g.focused,!1)),b(e),ke(Jf.data.targets)&&Qb(a),zf(a,!1)},Jf.revert=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=rj.selectAll(rd(a)),d=c.filter(Ef),e=c.filter(Ff);b(d.classed(g.focused,!1)),b(e),ke(Jf.data.targets)&&Qb(a),Af()},Jf.show=function(a,b){a=Fc(a),b=b||{},Oc(a),rj.selectAll(sd(a)).transition().style("opacity",1),b.withLegend&&Bf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Jf.hide=function(a,b){a=Fc(a),b=b||{},Nc(a),rj.selectAll(sd(a)).transition().style("opacity",0),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Jf.toggle=function(a){Ic(a)?Jf.hide(a):Jf.show(a)},Jf.unzoom=function(){mj.clear().update(),nf({withUpdateXDomain:!0})},Jf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Lg[b]=a.classes[b]}),"categories"in a&&Oi&&(sh=a.categories,Cg.categories(sh)),"cacheIds"in a&&dc(a.cacheIds)?void uf(fc(a.cacheIds),a.done):void("unload"in a?wf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){vf(a)}):vf(a))},Jf.unload=function(a,b){wf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Jf.selected=function(a){return If.merge(tj.selectAll("."+g.shapes+qd(a)).selectAll("."+g.shape).filter(function(){return If.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Jf.select=function(a,b,c){Wg&&tj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=If.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=Xg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?Yg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Jf.unselect=function(a,b){Wg&&tj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=If.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=Xg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&Yg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Jf.toLine=function(a){Hf(a,"line")},Jf.toSpline=function(a){Hf(a,"spline")},Jf.toBar=function(a){Hf(a,"bar")},Jf.toScatter=function(a){Hf(a,"scatter")},Jf.toArea=function(a){Hf(a,"area")},Jf.toAreaSpline=function(a){Hf(a,"area-spline")},Jf.toPie=function(a){Hf(a,"pie",{withTransform:!0})},Jf.toDonut=function(a){Hf(a,"donut",{withTransform:!0})},Jf.groups=function(a){return c(a)?Mg:(Mg=a,nf(),Mg)},Jf.xgrids=function(a){return a?(_h=a,nf(),_h):_h},Jf.xgrids.add=function(a){return a?Jf.xgrids(_h.concat(a)):void 0},Jf.xgrids.remove=function(a){var b=Gf(a);return Jf.xgrids(_h.filter(b))},Jf.ygrids=function(a){return a?(bi=a,nf(),bi):bi},Jf.ygrids.add=function(a){return a?Jf.ygrids(bi.concat(a)):void 0},Jf.ygrids.remove=function(a){var b=Gf(a);return Jf.ygrids(bi.filter(b))},Jf.regions=function(a){return c(a)?zi:(zi=a,nf(),zi)},Jf.regions.add=function(a){return c(a)?zi:(zi=zi.concat(a),nf(),zi)},Jf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;rj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),zi=zi.filter(function(b){return b.classes.indexOf(a)<0})}),zi},Jf.data.get=function(a){var b=Jf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Jf.data.getAsTarget=function(a){var b=Hc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Jf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Kg[b]=a[b]}),nf({withLegend:!0}),Kg):Kg},Jf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ug[b]=a[b]}),nf({withLegend:!0}),Ug):Ug},Jf.x=function(a){return arguments.length&&(sc(Jf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Jf.data.xs},Jf.xs=function(a){return arguments.length&&(tc(Jf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Jf.data.xs},Jf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Jf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Bh=+a.x),b(a.y)&&(Ih=+a.y),b(a.y2)&&(Rh=+a.y2)):Ih=Rh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Jf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ch=+a.x),b(a.y)&&(Jh=+a.y),b(a.y2)&&(Sh=+a.y2)):Jh=Sh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Jf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Jf.axis.max(a.max),"undefined"!=typeof a.min&&Jf.axis.min(a.min))},Jf.legend.show=function(a){Bf(Fc(a)),nf({withLegend:!0})},Jf.legend.hide=function(a){Cf(Fc(a)),nf({withLegend:!0})},Jf.resize=function(a){Mf=a?a.width:null,Nf=a?a.height:null,sf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Jf.destroy=function(){Jf.data.targets=void 0,Jf.data.xs={},xj.html(""),a.onresize=null},"url"in f.data)If.xhr(f.data.url,function(a,b){var c,d=If.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=If.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Jf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&acg&&(cg=0),0>eg&&(eg=0),dg=rh?_f.left-nj-oj:cg,fg=rh?eg:hg-ag.top-ag.bottom,0>dg&&(dg=0),0>fg&&(fg=0),lg=cg-(ij?b+10:0),mg=eg-(ij?0:10),r(),ij&&d&&(bg.left=lg/2+1.1*jg)}function q(){xj.select("line."+g.xgridFocus).attr("x1",rh?0:-10).attr("x2",rh?cg:-10).attr("y1",rh?-10:_f.top).attr("y2",rh?-10:eg)}function r(){jg=Math.min(lg,mg)/2,ig=.95*jg,kg=je(Kf.data.targets)?.6*ig:0}function s(){var a=rh?g.axisX:g.axisY,b=xj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Jf.select(Mf).node().getBoundingClientRect(),e=ke(Kf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Nf?Nf:z()}function u(){var a=Of?Of:A();return a>0?a:320}function v(){var a=1;return Pf?Pf:rh?sh?x("x"):a:!Kh||Ph?a:x("y")}function w(){var a=1;return Qf?Qf:ij?R()+20+(Th&&!rh?x("y2"):a):Th?Yh||rh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||sh?"x"===a&&Hh?Hh:"y"!==a||Kh?"y2"!==a||Th?(mb(a).isInner?30:40)+("y2"===a?-10:0):pj:lh&&!ij?10:1:0}function z(){return+Jf.select(Mf).style("width").replace("px","")}function A(){return+Jf.select(Mf).style("height").replace("px","")}function B(a){return a?-31:-(_f.left-1)}function C(a){return a?-20:-4}function D(){return B(!rh)}function E(){return C(!rh)}function F(){return B(rh)}function G(){return C(rh)}function H(a){return a?cg+2+30+30:_f.left+20}function I(a){return a?(Hh?Hh:0)+80:eg+8}function J(){return H(!rh)}function K(){return I(!rh)}function L(){return H(rh)}function M(){return I(rh)}function N(){var a,b,c,d,e,f=Cc(Kf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=zg(b.x)-zg(a.x),0===c?rh?eg:cg:(d=Bc(),e=ge(Kf.data.targets)?(d-(Ri?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){jj=a}function P(a){kj=a}function Q(a){lj=a}function R(){return lh?ij?kj*(jj+1):gg:0}function S(){return lh?ij?hg:lj*(jj+1):0}function T(){var a,b,c=!zg;rg=rh?1:0,sg=rh?eg:cg,tg=rh?0:eg,ug=rh?cg:1,vg=rg,wg=sg,xg=rh?0:fg,yg=rh?dg:1,zg=W(rg,sg,c?void 0:zg.domain(),function(){return Fg.tickOffset()}),Ag=X(tg,ug,c?void 0:Ag.domain()),Bg=X(tg,ug,c?void 0:Bg.domain()),Cg=W(rg,sg,Cj,function(a){return a%1?0:Ig.tickOffset()}),Dg=X(xg,yg,c?void 0:Dg.domain()),Eg=X(xg,yg,c?void 0:Eg.domain()),a=bb(),b=Ch?Ch:c?void 0:Fg.tickValues(),Fg=$(zg,dj,a,b),Ig=$(Cg,gj,a,b),Gg=_(Ag,ej,Qh,Sh),Hg=_(Bg,fj,Zh,_h),c||(qj.scale(Cg),Tf&&uj.scale(zg)),U()}function U(){ng=Ib(),og=Jb(),pg=Jb(.98)}function V(a,b,c){return(c?Jf.time.scale():Jf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Qi),g=c?f.domain(c):f;Ri?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Cj&&Cj[0]===a[0]&&Cj[1]a?a.toFixed(0):a};return xh&&("function"==typeof xh?a=xh:Qi&&(a=function(a){return a?$i(xh)(a):""})),a}function cb(a){var b;return"y"===a?b=Oh:"y2"===a?b=Xh:"x"===a&&(b=Jh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Oh=b:"y2"===a?Xh=b:"x"===a&&(Jh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function jb(){return ib("x",rh?"inner-top":"inner-right")}function kb(){return ib("y",rh?"inner-right":"inner-top")}function lb(){return ib("y2",rh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?cg/2:cg:b.isBottom?-eg:b.isMiddle?-eg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!rh,jb())}function ub(){return qb(rh,kb())}function vb(){return qb(rh,lb())}function wb(){return rb(!rh,jb())}function xb(){return rb(rh,kb())}function yb(){return rb(rh,lb())}function zb(){var a=jb();return rh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Hh?Hh-10:"3em"}function Ab(){var a=kb();return rh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return rh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!rh,jb())}function Db(){return sb(rh,kb())}function Eb(){return sb(rh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Jf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=xj.select("."+g.axisX+" ."+g.axisXLabel),c=xj.select("."+g.axisY+" ."+g.axisYLabel),d=xj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return qg(Kc(Kf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Jf.svg.arc().outerRadius(ig).innerRadius(kg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Jf.svg.arc().outerRadius(jg*(a?a:1)).innerRadius(kg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return re(a.data)?ng(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=ng.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ig*.8+","+d/e*ig*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Fd(c,d)):""}function Pb(a,b){var c=vj.selectAll("."+g.chartArc+rd(a)),d=vj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});xe(a)&&c.selectAll("path").transition().duration(50).attr("d",og).transition().duration(100).attr("d",pg).each(function(a){qe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=vj.selectAll("."+g.chartArc+rd(a));b.selectAll("path").transition().duration(50).attr("d",ng),vj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return je(Kf.data.targets)?vi:pi}function Sb(){return je(Kf.data.targets)?wi:qi}function Tb(){return je(Kf.data.targets)?yi:""}function Ub(){var a=je(Kf.data.targets)?zi:si;return"function"==typeof a?a:function(){}}function Vb(){var a=je(Kf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Wb(){var a=je(Kf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Pg.length>0)for(g=Tc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Jf.min(Object.keys(i).map(function(a){return Jf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Pg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Jf.max(Object.keys(i).map(function(a){return Jf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Vh:Mh,n="y2"===c?Uh:Lh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Wh:Nh,r=zd()&&rh;return 0===l.length?"y2"===c?Bg.domain():Ag.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Ad(o,p),j=cc(Ag.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),"y2"===c&&$h&&(f=b($h.top)?$h.top:e,g=b($h.bottom)?$h.bottom:e),ge(l)&&!Tc(l)&&(g=o),[o-g,p+f])}function $b(a){return Fh?Qi?ze(Fh):Fh:Jf.min(a,function(a){return Jf.min(a.values,function(a){return a.x})})}function _b(a){return Eh?Qi?ze(Eh):Eh:Jf.max(a,function(a){return Jf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Ri?d=0:ge(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Gh&&Ee(Gh)?(e=b(Gh.left)?Gh.left:d,f=b(Gh.right)?Gh.right:d):e=f="number"==typeof Gh?Gh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Ri||(c=Qi?new Date(.5*c.getTime()):-.5,d=Qi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Qi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Qi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Ag:Bg;return b="y"===a.axis||"y2"===a.axis?rh?eg:"start"in a?d(a.start):eg:rh?"end"in a?zg(Qi?ze(a.end):a.end):eg:eg,c>b?0:b-c}function kc(a){return Jg&&a===Jg||Ee(Kg)&&Fe(Kg,a)}function lc(a){return!kc(a)}function mc(a){return Jg?Jg:Ee(Kg)?Kg[a]:null}function nc(a,b){var c,d=b&&Ee(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Kf.data.xs[b])}),c}function oc(a,b){return a in Kf.data.xs&&Kf.data.xs[a]&&Kf.data.xs[a][b]?Kf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Kg[b]=a[b]})}function qc(a){return 1===Jf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Ng[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Kf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Qi?a?a instanceof Date?a:ze(a):ze(oc(c,d)):Si&&!Ri?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Kf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Jg?(d=Object.keys(Kf.data.xs),Kf.data.xs[c]=d.length>0?Kf.data.xs[d[0]]:void 0):Ee(Kg)&&(Kf.data.xs[c]=nc(f,Kf.data.targets)):Kf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Kf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Mg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Si&&Ri&&0===c&&g&&(0===e&&(vh=[]),vh.push(g)),("undefined"==typeof a[b]||Kf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Rg&&ee(Ec(c).filter(function(a){return!(a in Sg)}),Rg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function zc(a){return a>0&&Kf.data.targets[0].values[a-1]?Kf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Kf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Qi?new Date(i):i);j.push(e)}return Qi||(j=j.sort(function(a,b){return a-b})),j}function Nc(a){aj=aj.concat(a)}function Oc(a){aj=aj.filter(function(b){return a.indexOf(b)<0})}function Pc(a){bj=bj.concat(a)}function Qc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Rc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Sc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Uc(a){return Sc(a,function(a){return a>0})}function Vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Ld(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Ld(a,g))),Od(e,b)):Md(a,b,f,g)}function Nd(a,b){var c;return c=a.map(function(a){return Md(a.values,b)}),Od(c,b)}function Od(a,b){var c,d;return a.forEach(function(a){var e=Ge(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Pd(a,b){return Jf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Qd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Rd(){return Ug&&"desc"===Ug.toLowerCase()}function Sd(){return Ug&&"asc"===Ug.toLowerCase()}function Td(a){var b=Sd(),c=Rd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Ug&&a.sort(Ug),a}function Ud(a,c){var d,e,f,g,h,i,j,k=ke(Kf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Di&&(Aj.html(Gi(a,bb(),Bd(k),Zi)).style("display","block"),d=Aj.property("offsetWidth"),e=Aj.property("offsetHeight"),k?(g=cg/2+c[0],i=eg/2+c[1]+20):(rh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=zg(l[0].x)+20):(f=s(),g=f+v()+zg(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Aj.style("top",i+"px").style("left",g+"px"))}function Vd(){Aj.style("display","none")}function Wd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Di&&!he(Kf.data.targets)&&!ke(Kf.data.targets)){var d=xj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(rh?"y1":"x1",Hd).attr(rh?"y2":"x2",Hd),mf(d,"grid")}}function Xd(){xj.select("line."+g.xgridFocus).style("visibility","hidden")}function Yd(a,b){var c,d,e,f,h=[],i=xj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Zd(a){return a.x||0===a.x?zg(a.x):null}function $d(a){return Y(a.id)(a.value)}function _d(){var a,b,d={},e=0;return Kc(Hc(ne)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function de(a,b){return"number"==typeof ni?ni:b?2*a.tickOffset()*oi/b:0}function ee(a,b){Fc(a).forEach(function(a){Ej[a]=b===Sg[a],Sg[a]=b})}function fe(a,b){var c=!1;return a.forEach(function(a){Sg[a.id]===b&&(c=!0),a.id in Sg||"line"!==b||(c=!0)}),c}function ge(a){return fe(a,"bar")}function he(a){return fe(a,"scatter")}function ie(a){return fe(a,"pie")}function je(a){return fe(a,"donut")}function ke(a){return ie(a)||je(a)}function le(a){var b="string"==typeof a?a:a.id;return!(b in Sg)||"line"===Sg[b]||"spline"===Sg[b]||"area"===Sg[b]||"area-spline"===Sg[b]}function me(a){var b="string"==typeof a?a:a.id;return"spline"===Sg[b]||"area-spline"===Sg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"bar"===Sg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"scatter"===Sg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"pie"===Sg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"donut"===Sg[b]}function re(a){return pe(a)||qe(a)}function se(a){return le(a)?[a]:[]}function te(a){return re(a.data)?[a]:[]}function ue(a){return ne(a)?a.values:[]}function ve(a){return le(a)||oe(a)?a.values:[]}function we(a){return ne(a)||le(a)?a.values:[]}function xe(a){return qe(a)&&xi||pe(a)&&ri}function ye(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ze(b){var c;try{c=Lg?Jf.time.format(Lg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Lg)}return c}function Ae(a,b){var c=Jf.mouse(a),d=Jf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Fe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ge(a,b){var c="y"===ab(a.id)?Ag:Bg,d=rh?1:0,e=rh?0:1;return Math.pow(zg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function He(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ie(a,b,c){eh(b,a.node()),xj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Wc(g.selectedCircle,c)}).attr("cx",rh?$d:Zd).attr("cy",rh?Zd:$d).attr("stroke",function(){return Zi(b)}).attr("r",1.4*Te(b)).transition().duration(100).attr("r",Te)}function Je(a,b,c){fh(b,a.node()),xj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b){eh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jf.rgb(Zi(b)).brighter(.75)})}function Me(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Zi(b)})}function Ne(a,b,c,d){a?Le(b,c,d):Me(b,c,d)}function Oe(a,b,c,d){Ne(a,b,c.data,d)}function Pe(a){return"circle"===a.nodeName?Ke:Jf.select(a).classed(g.bar)?Ne:Oe}function Qe(a){return a.filter(function(a){return b(a.value)})}function Re(a){return gi?"function"==typeof hi?hi(a):hi:0}function Se(a){return ji?ki?ki:1.75*Re(a):Re(a)}function Te(a){return li?li:4*Re(a)}function Ue(a,c){return(c?xj.selectAll("."+g.circles+qd(c)):xj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Ve(a,b){Ue(a,b).classed(g.EXPANDED,!0).attr("r",Se)}function We(a){Ue(a).filter(function(){return Jf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Re)}function Xe(a){return xj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ye(a){Xe(a).classed(g.EXPANDED,!0)}function Ze(a){Xe(a).classed(g.EXPANDED,!1)}function $e(a,b){var c=cf(a,b);return function(a,b){var d=c(a,b),e=rh?1:0,f=rh?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function _e(a,b){var c=cf(a,!1),d=b?af:bf;return function(a,b){return d(c(a,b),a,this)}}function af(a,b){var c;return rh?(c=ne(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function bf(a,b,c){var d=c.getBoundingClientRect();return rh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ne(b)?-3:-6)}function cf(a,b){var c=a.__max__+1,d=de(Fg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return rh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ef(b){var c,d,e;if(Bj=Jf.select(Mf),Bj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Bj.html("").classed("c3",!0),Kf.data.xs={},Kf.data.targets=xc(b),Yg&&Nc(Yg===!0?Ec(Kf.data.targets):Yg),p(),T(),zg.domain(Jf.extent(bc(Kf.data.targets))),Ag.domain(Zb(Kf.data.targets,"y")),Bg.domain(Zb(Kf.data.targets,"y2")),Cg.domain(zg.domain()),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Cj=zg.domain(),qj.scale(Cg),Tf&&uj.scale(zg),vj=Bj.append("svg").on("mouseenter",Wf).on("mouseleave",Xf),wj=vj.append("defs"),wj.append("clipPath").attr("id",Ki).append("rect"),wj.append("clipPath").attr("id",Li).append("rect"),wj.append("clipPath").attr("id",Mi).append("rect"),rf(),xj=vj.append("g").attr("transform",hj.main),yj=vj.append("g").attr("transform",hj.context),zj=vj.append("g").attr("transform",hj.legend),ih||yj.style("visibility","hidden"),lh||(zj.style("visibility","hidden"),bj=Ec(Kf.data.targets)),Aj=Jf.select(Mf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ef(Ec(Kf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=xj.append("g").attr("clip-path",Ni).attr("class",g.grid),ai&&d.append("g").attr("class",g.xgrids),Ee(ci)&&d.append("g").attr("class",g.xgridLines),ii&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),di&&d.append("g").attr("class",g.ygrids),Ee(ei)&&d.append("g").attr("class",g.ygridLines),xj.append("g").attr("clip-path",Ni).attr("class",g.regions),xj.append("g").attr("clip-path",Ni).attr("class",g.chart),c=xj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Tf?rh?"ns-resize":"ew-resize":null),xj.select("."+g.chart).append("g").attr("class",g.chartBars),xj.select("."+g.chart).append("g").attr("class",g.chartLines),xj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",hj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),xj.select("."+g.chart).append("g").attr("class",g.chartTexts),Tf&&xj.insert("rect",Vf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",cg).attr("height",eg).style("opacity",0).style("cursor",rh?"ns-resize":"ew-resize").call(uj).on("dblclick.zoom",null),Ih&&qj.extent("function"!=typeof Ih?Ih:Ih(bc())),cj.x=xj.append("g").attr("class",g.axisX).attr("clip-path",Oi).attr("transform",hj.x).style("visibility",sh?"visible":"hidden"),cj.x.append("text").attr("class",g.axisXLabel).attr("transform",rh?"rotate(-90)":"").style("text-anchor",Cb),cj.y=xj.append("g").attr("class",g.axisY).attr("clip-path",Pi).attr("transform",hj.y).style("visibility",Kh?"visible":"hidden"),cj.y.append("text").attr("class",g.axisYLabel).attr("transform",rh?"":"rotate(-90)").style("text-anchor",Db),cj.y2=xj.append("g").attr("class",g.axisY2).attr("transform",hj.y2).style("visibility",Th?"visible":"hidden"),cj.y2.append("text").attr("class",g.axisY2Label).attr("transform",rh?"":"rotate(-90)").style("text-anchor",Eb),yj.append("g").attr("clip-path",Ni).attr("class",g.chart),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.append("g").attr("clip-path",Ni).attr("class",g.brush).call(qj).selectAll("rect").attr(rh?"width":"height",rh?dg:fg),cj.subx=yj.append("g").attr("class",g.axisX).attr("transform",hj.subx).attr("clip-path",rh?"":Oi),uf(Kf.data.targets),rh?xj.select("."+g.axisX).style("opacity",0).call(Fg):(xj.select("."+g.axisY).style("opacity",0).call(Gg),xj.select("."+g.axisY2).style("opacity",0).call(Hg)),p(),T(),rf(),o(!1),nf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Hi){if(Qi&&"string"==typeof Ii){for(Ii=ze(Ii),e=0;e0){d=[];for(var f in Ng)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Qd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ne,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function kf(a){ke(Kf.data.targets)||Zg&&(Ti=a,xj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Ui=!0,gh())}function lf(){ke(Kf.data.targets)||Zg&&(xj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),xj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Ui=!1,hh())}function mf(a,b){"grid"===b&&a.each(function(){var a=Jf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function nf(a,c){var e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,X=_d(),Y=ke(Kf.data.targets),Z=Kc(Kf.data.targets);if(a=a||{},D=d(a.withY)?a.withY:!0,E=d(a.withSubchart)?a.withSubchart:!0,F=d(a.withTransition)?a.withTransition:!0,I=d(a.withTransform)?a.withTransform:!1,J=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,K=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,L=d(a.withLegend)?a.withLegend:!1,G=d(a.withTransitionForExit)?a.withTransitionForExit:F,H=d(a.withTransitionForAxis)?a.withTransitionForAxis:F,R=F?$f:0,S=G?R:0,T=H?R:0,c=c||sf(T),L&&lh&&Ef(Ec(Kf.data.targets),a,c),Ri&&0===Z.length&&zg.domain([0,cj.x.selectAll(".tick").size()]),Z.length&&(K&&(zg.domain(Jf.extent(bc(Z))),Cj=zg.domain(),Tf&&uj.scale(zg).updateScaleExtent(),Cg.domain(zg.domain()),qj.scale(Cg)),J&&(zg.domain(qj.empty()?Cj:qj.extent()),Tf&&uj.scale(zg).updateScaleExtent()),Ch||!Bh&&!Ah||(U=Mc(Lc(Z),Ah),Fg.tickValues(U),Ig.tickValues(U))),Ag.domain(Zb(Z,"y")),Bg.domain(Zb(Z,"y2")),cj.x.style("opacity",Y?0:1),cj.y.style("opacity",Y?0:1),cj.y2.style("opacity",Y?0:1),cj.subx.style("opacity",Y?0:1),c.axisX.call(Fg),c.axisY.call(Gg),c.axisY2.call(Hg),c.axisSubX.call(Ig),Gb(F),J&&Z.length)if(yh&&U){for(V=1;V=0&&Jf.select(this).style("display",b%W?"none":"block")})}else vj.selectAll("."+g.axisX+" .tick text").style("display","block");!rh&&Dh&&hb(cj.x,c.axisX,Dh),M=$e(X),P=_e(X,!0),Q=_e(X,!1),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Aj.style("display","none"),q(),xj.select("line."+g.xgridFocus).style("visibility","hidden"),ai&&(h=Yd(bi,zg),A=Ri?Fg.tickOffset():0,f=rh?{x1:0,x2:cg,y1:function(a){return zg(a)-A},y2:function(a){return zg(a)-A}}:{x1:function(a){return zg(a)+A},x2:function(a){return zg(a)+A},y1:_f.top,y2:eg},e=xj.select("."+g.xgrids).selectAll("."+g.xgrid).data(h),e.enter().append("line").attr("class",g.xgrid),e.attr(f).style("opacity",function(){return+Jf.select(this).attr(rh?"y1":"x1")===(rh?eg:0)?0:1}),e.exit().remove()),Ee(ci)&&(i=xj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(ci),j=i.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",rh?"":"rotate(-90)").attr("dx",rh?0:-_f.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(R).attr("x1",rh?0:Id).attr("x2",rh?cg:Id).attr("y1",rh?Id:_f.top).attr("y2",rh?Id:eg).style("opacity",1),i.select("text").transition().duration(R).attr("x",rh?cg:0).attr("y",Id).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(R).style("opacity",0).remove()),D&&di&&(k=xj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ag.ticks(fi)),k.enter().append("line").attr("class",g.ygrid),k.attr("x1",rh?Ag:0).attr("x2",rh?Ag:cg).attr("y1",rh?0:Ag).attr("y2",rh?eg:Ag),k.exit().remove(),mf(k,"grid")),D&&Ee(ei)&&(l=xj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ei),m=l.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",rh?"rotate(-90)":"").attr("dx",rh?0:-_f.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(R).attr("x1",rh?Jd:0).attr("x2",rh?Jd:cg).attr("y1",rh?0:Jd).attr("y2",rh?eg:Jd).style("opacity",1),l.select("text").transition().duration(R).attr("x",rh?0:cg).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(R).style("opacity",0).remove()),t=xj.select("."+g.regions).selectAll("."+g.region).data(Ci),t.enter().append("g").attr("class",jd).append("rect").style("fill-opacity",0),t.selectAll("rect").transition().duration(R).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=xj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),r.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Zi),r.style("opacity",vd).transition().duration(R).attr("d",M).style("fill",Zi).style("opacity",1),r.exit().transition().duration(S).style("opacity",0).remove(),n=xj.selectAll("."+g.lines).selectAll("."+g.line).data(se),n.enter().append("path").attr("class",_c).style("stroke",Zi),n.style("opacity",vd).transition().duration(R).attr("d",rj).style("stroke",Zi).style("opacity",1),n.exit().transition().duration(S).style("opacity",0).remove(),o=xj.selectAll("."+g.areas).selectAll("."+g.area).data(se),o.enter().append("path").attr("class",hd).style("fill",Zi).style("opacity",function(){return Dj=+Jf.select(this).style("opacity"),0}),o.style("opacity",0).transition().duration(R).attr("d",sj).style("fill",Zi).style("opacity",Dj),o.exit().transition().duration(S).style("opacity",0).remove(),p=xj.selectAll("."+g.circles).selectAll("."+g.circle).data(ve),p.enter().append("circle").attr("class",bd).attr("r",Re).style("fill",Zi),p.style("opacity",vd).transition().duration(R).style("opacity",xd).style("fill",Zi).attr("cx",rh?$d:Zd).attr("cy",rh?Zd:$d),p.exit().remove(),u=xj.selectAll("."+g.texts).selectAll("."+g.text).data(we),u.enter().append("text").attr("class",Xc).attr("text-anchor",function(a){return rh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Zi).style("fill-opacity",0),u.text(function(a){return Gd(a.id)(a.value,a.id)}).style("fill-opacity",wd).transition().duration(R).attr("x",P).attr("y",Q).style("fill",Zi).style("fill-opacity",yd),u.exit().transition().duration(S).style("fill-opacity",0).remove(),s=xj.selectAll("."+g.arcs).selectAll("."+g.arc).data(te),s.enter().append("path").attr("class",fd).style("fill",function(a){return Zi(a.data)}).style("cursor",function(a){return _g(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Xi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Af(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Ud(d,Jf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Xi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Bf(),Vd(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();hf(this,a,b),e(d,b)}),s.attr("transform",I?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Xi=!0}).transition().duration(R).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Jf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",I?"scale(1)":"").style("fill",function(a){return Zi(a.data)}).style("opacity",1).call(He,function(){Xi=!1}),s.exit().transition().duration(S).style("opacity",0).remove(),xj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(R).text(Ob).style("opacity",function(a){return Ic(a.data.id)&&re(a.data)?1:0}),xj.select("."+g.chartArcsTitle).style("opacity",je(Kf.data.targets)?1:0),ih&&(Jf.event&&"zoom"===Jf.event.type&&qj.extent(zg.orgDomain()).update(),E&&(!rh&&Dh&&hb(cj.subx,c.axisSubX,Dh),qj.empty()||qj.extent(zg.orgDomain()).update(),O=$e(X,!0),w=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),w.enter().append("path").attr("class",dd).style("stroke","none").style("fill",Zi),w.style("opacity",vd).transition().duration(R).attr("d",O).style("opacity",1),w.exit().transition().duration(R).style("opacity",0).remove(),v=yj.selectAll("."+g.lines).selectAll("."+g.line).data(se),v.enter().append("path").attr("class",_c).style("stroke",Zi),v.style("opacity",vd).transition().duration(R).attr("d",tj).style("opacity",1),v.exit().transition().duration(R).style("opacity",0).remove())),xj.selectAll("."+g.selectedCircles).filter(function(a){return ne(a)}).selectAll("circle").remove(),xj.selectAll("."+g.selectedCircle).transition().duration(R).attr("cx",rh?$d:Zd).attr("cy",rh?Zd:$d),x=xj.select("."+g.eventRects),Ee(Kg)&&!qc(Kg)?(x.classed(g.eventRectsMultiple)||x.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),y=xj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),gf(y.enter()),y.attr("x",0).attr("y",0).attr("width",cg).attr("height",eg)):(x.classed(g.eventRectsSingle)||x.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Si&&!Ri?(C=function(a,b){var c=zc(b),d=Ac(b),e=Kf.data.xs[a.id][b];return(zg(d?d:e+50)-zg(c?c:e-50))/2},B=function(a,b){var c=zc(b),d=Kf.data.xs[a.id][b];return(zg(d)+zg(c?c:d-50))/2}):(C=N(),B=function(a){return zg(a.x)-C/2}),z=Cc(Kf.data.targets),xj.select("."+g.eventRects).datum(z?z.values:[]),y=xj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),ff(y.enter()),y.attr("class",kd).attr("x",rh?0:B).attr("y",rh?B:0).attr("width",rh?cg:C).attr("height",rh?C:eg),y.exit().remove()),Ec(Kf.data.targets).forEach(function(a){Ej[a]=!0})}function of(){nf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function pf(){if(0!==Kc(Kf.data.targets).length){if("mousemove"===Jf.event.sourceEvent.type&&uj.altDomain)return zg.domain(uj.altDomain),void uj.scale(zg).updateScaleExtent();Ri&&zg.orgDomain()[0]===Cj[0]&&zg.domain([Cj[0]-1e-10,zg.orgDomain()[1]]),nf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Jf.event.sourceEvent.type&&(Vi=!0)}}function qf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function rf(){vj.attr("width",gg).attr("height",hg),vj.select("#"+Ki).select("rect").attr("width",cg).attr("height",eg),vj.select("#"+Li).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),vj.select("#"+Mi).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),vj.select("."+g.zoomRect).attr("width",cg).attr("height",eg),Bj.style("max-height",hg+"px")}function sf(a){return{axisX:a?cj.x.transition().duration(a):cj.x,axisY:a?cj.y.transition().duration(a):cj.y,axisY2:a?cj.y2.transition().duration(a):cj.y2,axisSubX:a?cj.subx.transition().duration(a):cj.subx}}function tf(a){var b;a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&lh||(b=sf(a.withTransition?$f:0),p(),T(),rf(),o(a.withTransition,b)),nf(a,b)}function uf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=xj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",md),j=i.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Yc),e=xj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),d=e.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",ed).style("cursor",function(a){return _g(a)?"pointer":null}),c=xj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),b=c.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",ad),b.append("g").attr("class",id),b.append("g").attr("class",function(a){return Wc(g.selectedCircles,a.id)}),b.append("g").attr("class",cd).style("cursor",function(a){return _g(a)?"pointer":null}),a.forEach(function(a){xj.selectAll("."+g.selectedCircles+qd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=xj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(qg(a)).attr("class",pd),f=h.enter().append("g").attr("class",pd),f.append("g").attr("class",gd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),ih&&(n=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),m=n.enter().append("g").style("opacity",0).attr("class",od),m.append("g").attr("class",ed),l=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),k=l.enter().append("g").style("opacity",0).attr("class",nd),k.append("g").attr("class",ad)),vj.selectAll("."+g.target).filter(function(a){return Ic(a.id)}).transition().duration($f).style("opacity",1)}function vf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ee(a.id,b.types[a.id]):ee(a.id,b.type)}),Kf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=ij?j:i,l=ij?S():R();return d&&(z=0,F=0,w=0,x=0),lh&&!Jc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=ij?x:w,void(qh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=zj.selectAll("."+g.legendItemFocused).size();b=b||{},n=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,ij?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=zj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Wc(g.legendItem,a)}).style("visibility",function(a){return Jc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof nh?nh(a):Kf.toggle(a)}).on("mouseover",function(a){Jf.select(this).classed(g.legendItemFocused,!0),Xi||Kf.focus(a),"function"==typeof oh&&oh(a)}).on("mouseout",function(a){Jf.select(this).classed(g.legendItemFocused,!1),Xi||Kf.revert(),"function"==typeof ph&&ph(a)}),m.append("text").text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ij?h:-200).attr("y",ij?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",ij?i:-200).attr("y",ij?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Zi).attr("x",ij?h:-200).attr("y",ij?-200:j).attr("width",10).attr("height",10),r=zj.selectAll("text").data(a).text(function(a){return d(Ng[a])?Ng[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=zj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=zj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",Zi).attr("x",f).attr("y",j),zj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Ic(a)}).transition().style("opacity",function(a){var b=Jf.select(this);return Ic(a)?!G||b.classed(g.legendItemFocused)?yf(b):zf(b):mj}),P(w),Q(x),O(F),p(),T(),rf(),o(q,c)}function Ff(a){return Gc(Kf.data.targets,a.id)}function Gf(a){return"data"in a&&Gc(Kf.data.targets,a.data.id)}function Hf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function If(a,b,c){var d=!ke(Kf.data.targets);Xi=!1,ee(a,b),tf(c||{withTransitionForAxis:d})}var Jf=a.d3?a.d3:a.require?a.require("d3"):void 0,Kf={data:{},axis:{},legend:{}},Lf={},Mf=i(["bindto"],"#chart"),Nf=i(["size","width"]),Of=i(["size","height"]),Pf=i(["padding","left"],50),Qf=i(["padding","right"],0),Rf=i(["padding","top"],0),Sf=i(["padding","bottom"],0),Tf=i(["zoom","enabled"],!1),Uf=i(["zoom","extent"]),Vf=i(["zoom","privileged"],!1),Wf=i(["onenter"],function(){}),Xf=i(["onleave"],function(){}),Yf=i(["onresize"],function(){}),Zf=i(["onresized"],function(){}),$f=i(["transition","duration"],350);h("data","data is required in config");var _f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg=i(["data","x"]),Kg=i(["data","xs"],{}),Lg=i(["data","x_format"]),Mg=i(["data","id_converter"],function(a){return a}),Ng=i(["data","names"],{}),Og=i(["data","classes"],{}),Pg=i(["data","groups"],[]),Qg=i(["data","axes"],{}),Rg=i(["data","type"]),Sg=i(["data","types"],{}),Tg=i(["data","labels"],{}),Ug=i(["data","order"]),Vg=i(["data","regions"],{}),Wg=i(["data","color"]),Xg=i(["data","colors"],{}),Yg=i(["data","hide"],!1),Zg=i(["data","selection","enabled"],!1),$g=i(["data","selection","grouped"],!1),_g=i(["data","selection","isselectable"],function(){return!0}),ah=i(["data","selection","multiple"],!0),bh=i(["data","onclick"],function(){}),ch=i(["data","onenter"],function(){}),dh=i(["data","onleave"],function(){}),eh=i(["data","onselected"],function(){}),fh=i(["data","onunselected"],function(){}),gh=i(["data","ondragstart"],function(){}),hh=i(["data","ondragend"],function(){}),ih=i(["subchart","show"],!1),jh=i(["subchart","size","height"],60),kh=i(["color","pattern"],[]),lh=i(["legend","show"],!0),mh=i(["legend","position"],"bottom"),nh=i(["legend","item","onclick"]),oh=i(["legend","item","onmouseover"]),ph=i(["legend","item","onmouseout"]),qh=i(["legend","equally"],!1),rh=i(["axis","rotated"],!1),sh=i(["axis","x","show"],!0),th=i(["axis","x","type"],"indexed"),uh=i(["axis","x","localtime"],!0),vh=i(["axis","x","categories"],[]),wh=i(["axis","x","tick","centered"],!1),xh=i(["axis","x","tick","format"]),yh=i(["axis","x","tick","culling"],{}),zh=i(["axis","x","tick","culling","max"],10),Ah=i(["axis","x","tick","count"]),Bh=i(["axis","x","tick","fit"],!0),Ch=i(["axis","x","tick","values"],null),Dh=i(["axis","x","tick","rotate"]),Eh=i(["axis","x","max"],null),Fh=i(["axis","x","min"],null),Gh=i(["axis","x","padding"],{}),Hh=i(["axis","x","height"]),Ih=i(["axis","x","default"]),Jh=i(["axis","x","label"],{}),Kh=i(["axis","y","show"],!0),Lh=i(["axis","y","max"]),Mh=i(["axis","y","min"]),Nh=i(["axis","y","center"]),Oh=i(["axis","y","label"],{}),Ph=i(["axis","y","inner"],!1),Qh=i(["axis","y","tick","format"]),Rh=i(["axis","y","padding"]),Sh=i(["axis","y","ticks"],10),Th=i(["axis","y2","show"],!1),Uh=i(["axis","y2","max"]),Vh=i(["axis","y2","min"]),Wh=i(["axis","y2","center"]),Xh=i(["axis","y2","label"],{}),Yh=i(["axis","y2","inner"],!1),Zh=i(["axis","y2","tick","format"]),$h=i(["axis","y2","padding"]),_h=i(["axis","y2","ticks"],10),ai=i(["grid","x","show"],!1),bi=i(["grid","x","type"],"tick"),ci=i(["grid","x","lines"],[]),di=i(["grid","y","show"],!1),ei=i(["grid","y","lines"],[]),fi=i(["grid","y","ticks"],10),gi=i(["point","show"],!0),hi=i(["point","r"],2.5),ii=i(["point","focus","line","enabled"],!0),ji=i(["point","focus","expand","enabled"],!0),ki=i(["point","focus","expand","r"]),li=i(["point","focus","select","r"]),mi=i(["line","connect_null"],!1),ni=i(["bar","width"]),oi=i(["bar","width","ratio"],.6),pi=i(["pie","label","show"],!0),qi=i(["pie","label","format"]),ri=i(["pie","expand"],!0),si=i(["pie","onclick"],function(){}),ti=i(["pie","onmouseover"],function(){}),ui=i(["pie","onmouseout"],function(){}),vi=i(["donut","label","show"],!0),wi=i(["donut","label","format"]),xi=i(["donut","expand"],!0),yi=i(["donut","title"],""),zi=i(["donut","onclick"],function(){}),Ai=i(["donut","onmouseover"],function(){}),Bi=i(["donut","onmouseout"],function(){}),Ci=i(["regions"],[]),Di=i(["tooltip","show"],!0),Ei=i(["tooltip","format","title"]),Fi=i(["tooltip","format","value"]),Gi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ei?Ei:b,l=Fi?Fi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Hi=i(["tooltip","init","show"],!1),Ii=i(["tooltip","init","x"],0),Ji=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Ki=("string"==typeof Mf?Mf.replace("#",""):Mf.id)+"-clip",Li=Ki+"-xaxis",Mi=Ki+"-yaxis",Ni=j(Ki),Oi=j(Li),Pi=j(Mi),Qi="timeseries"===th,Ri="categorized"===th,Si=!Qi&&(Jg||Ee(Kg)),Ti=null,Ui=!1,Vi=!1,Wi=!1,Xi=!1,Yi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Zi=ye(Xg,Ee(kh)?kh:Yi,Wg),$i=uh?Jf.time.format:Jf.time.format.utc,_i=$i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),aj=[],bj=[],cj={},dj=rh?"left":"bottom",ej=rh?Ph?"top":"bottom":Ph?"right":"left",fj=rh?Yh?"bottom":"top":Yh?"left":"right",gj=rh?"left":"bottom",hj={main:function(){return"translate("+k(_f.left)+","+k(_f.top)+")"},context:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},legend:function(){return"translate("+bg.left+","+bg.top+")"},x:function(){return"translate(0,"+(rh?0:eg)+")" +},y:function(){return"translate(0,"+(rh?eg:0)+")"},y2:function(){return"translate("+(rh?0:cg)+","+(rh?1:0)+")"},subx:function(){return"translate(0,"+(rh?0:fg)+")"},arc:function(){return"translate("+lg/2+","+mg/2+")"}},ij="right"===mh,jj=0,kj=0,lj=0,mj=.15,nj=30,oj=rh&&!sh?0:30,pj=5;qg=Jf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var qj,rj=function(){var a=Jf.svg.line().x(rh?function(a){return Y(a.id)(a.value)}:Hd).y(rh?Hd:function(a){return Y(a.id)(a.value)});return mi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=mi?Qe(b.values):b.values;return le(b)?(a.interpolate(me(b)?"cardinal":"linear"),Vg[b.id]?df(e,zg,Y(b.id),Vg[b.id]):a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,rh?"M "+d+" "+c:"M "+c+" "+d)}}(),sj=function(){var a;return a=rh?Jf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Hd):Jf.svg.area().x(Hd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Qe(b.values);return fe([b],"area")||fe([b],"area-spline")?(a.interpolate(me(b)?"cardinal":"linear"),a(e)):(c=e[0]?zg(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,rh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a=Jf.svg.line().x(rh?function(a){return Z(a.id)(a.value)}:Kd).y(rh?Kd:function(a){return Z(a.id)(a.value)});return function(b){var c=Qe(b.values);return le(b)?a(c):"M "+Cg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),uj=function(){};qj=Jf.svg.brush().on("brush",of),qj.update=function(){return yj&&yj.select("."+g.brush).call(this),this},qj.scale=function(a){return rh?this.y(a):this.x(a)},Tf&&(uj=Jf.behavior.zoom().on("zoomstart",function(){uj.altDomain=Jf.event.sourceEvent.altKey?zg.orgDomain():null}).on("zoom",Tf?pf:null),uj.scale=function(a){return rh?this.y(a):this.x(a)},uj.orgScaleExtent=function(){var a=Uf?Uf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},uj.updateScaleExtent=function(){var a=cc(zg.orgDomain())/cc(Cj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var vj,wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej={};if(Kf.focus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=vj.selectAll(rd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),Kf.defocus(),b(d.classed(g.focused,!0)),b(e),ke(Kf.data.targets)&&Pb(a,!0),Af(a,!0)},Kf.defocus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",.3)}var c=vj.selectAll(rd(a)),d=c.filter(Ff),e=c.filter(Gf);Kf.revert(),b(d.classed(g.focused,!1)),b(e),ke(Kf.data.targets)&&Qb(a),Af(a,!1)},Kf.revert=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=vj.selectAll(rd(a)),d=c.filter(Ff),e=c.filter(Gf);b(d.classed(g.focused,!1)),b(e),ke(Kf.data.targets)&&Qb(a),Bf()},Kf.show=function(a,b){a=Fc(a),b=b||{},Oc(a),vj.selectAll(sd(a)).transition().style("opacity",1),b.withLegend&&Cf(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.hide=function(a,b){a=Fc(a),b=b||{},Nc(a),vj.selectAll(sd(a)).transition().style("opacity",0),b.withLegend&&Df(a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Kf.toggle=function(a){Ic(a)?Kf.hide(a):Kf.show(a)},Kf.unzoom=function(){qj.clear().update(),nf({withUpdateXDomain:!0})},Kf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Og[b]=a.classes[b]}),"categories"in a&&Ri&&(vh=a.categories,Fg.categories(vh)),"cacheIds"in a&&dc(a.cacheIds)?void vf(fc(a.cacheIds),a.done):void("unload"in a?xf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){wf(a)}):wf(a))},Kf.unload=function(a,b){xf(Fc(a),function(){nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Kf.selected=function(a){return Jf.merge(xj.selectAll("."+g.shapes+qd(a)).selectAll("."+g.shape).filter(function(){return Jf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Kf.select=function(a,b,c){Zg&&xj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Jf.select(this),i=e.data?e.data.id:e.id,j=Pe(this),k=$g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?_g(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Kf.unselect=function(a,b){Zg&&xj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Jf.select(this),f=c.data?c.data.id:c.id,h=Pe(this),i=$g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&_g(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Kf.toLine=function(a){If(a,"line")},Kf.toSpline=function(a){If(a,"spline")},Kf.toBar=function(a){If(a,"bar")},Kf.toScatter=function(a){If(a,"scatter")},Kf.toArea=function(a){If(a,"area")},Kf.toAreaSpline=function(a){If(a,"area-spline")},Kf.toPie=function(a){If(a,"pie",{withTransform:!0})},Kf.toDonut=function(a){If(a,"donut",{withTransform:!0})},Kf.groups=function(a){return c(a)?Pg:(Pg=a,nf(),Pg)},Kf.xgrids=function(a){return a?(ci=a,nf(),ci):ci},Kf.xgrids.add=function(a){return a?Kf.xgrids(ci.concat(a)):void 0},Kf.xgrids.remove=function(a){var b=Hf(a);return Kf.xgrids(ci.filter(b))},Kf.ygrids=function(a){return a?(ei=a,nf(),ei):ei},Kf.ygrids.add=function(a){return a?Kf.ygrids(ei.concat(a)):void 0},Kf.ygrids.remove=function(a){var b=Hf(a);return Kf.ygrids(ei.filter(b))},Kf.regions=function(a){return c(a)?Ci:(Ci=a,nf(),Ci)},Kf.regions.add=function(a){return c(a)?Ci:(Ci=Ci.concat(a),nf(),Ci)},Kf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;vj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ci=Ci.filter(function(b){return b.classes.indexOf(a)<0})}),Ci},Kf.data.get=function(a){var b=Kf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Kf.data.getAsTarget=function(a){var b=Hc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Kf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ng[b]=a[b]}),nf({withLegend:!0}),Ng):Ng},Kf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Xg[b]=a[b]}),nf({withLegend:!0}),Xg):Xg},Kf.x=function(a){return arguments.length&&(sc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.xs=function(a){return arguments.length&&(tc(Kf.data.targets,a),nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Kf.data.xs},Kf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Kf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Eh=+a.x),b(a.y)&&(Lh=+a.y),b(a.y2)&&(Uh=+a.y2)):Lh=Uh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,nf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Kf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Kf.axis.max(a.max),"undefined"!=typeof a.min&&Kf.axis.min(a.min))},Kf.legend.show=function(a){Cf(Fc(a)),nf({withLegend:!0})},Kf.legend.hide=function(a){Df(Fc(a)),nf({withLegend:!0})},Kf.resize=function(a){Nf=a?a.width:null,Of=a?a.height:null,tf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Kf.destroy=function(){Kf.data.targets=void 0,Kf.data.xs={},Bj.html(""),a.onresize=null},"url"in f.data)Jf.xhr(f.data.url,function(a,b){var c,d=Jf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Jf.csv.parse(b.response),ef(c)});else if("rows"in f.data)ef(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ef(wc(f.data.columns))}return Kf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file