diff --git a/c3.js b/c3.js index bb8ccf6..b0bded9 100644 --- a/c3.js +++ b/c3.js @@ -1286,6 +1286,19 @@ } return [min, max]; } + function updateXDomain(targets, withUpdateXDomain, withUpdateOrgXDomain) { + if (withUpdateOrgXDomain) { + x.domain(d3.extent(getXDomain(targets))); + orgXDomain = x.domain(); + if (__zoom_enabled) { zoom.scale(x).updateScaleExtent(); } + subX.domain(x.domain()); + brush.scale(subX); + } + if (withUpdateXDomain) { + x.domain(brush.empty() ? orgXDomain : brush.extent()); + if (__zoom_enabled) { zoom.scale(x).updateScaleExtent(); } + } + } function diffDomain(d) { return d[1] - d[0]; } @@ -1371,6 +1384,14 @@ function getXValue(id, i) { return id in c3.data.xs && c3.data.xs[id] && c3.data.xs[id][i] ? c3.data.xs[id][i] : i; } + function getOtherTargetXs() { + var idsForX = Object.keys(c3.data.xs); + return idsForX.length ? c3.data.xs[idsForX[0]] : null; + } + function getOtherTargetX(index) { + var xs = getOtherTargetXs(); + return xs && index < xs.length ? xs[index] : null; + } function addXs(xs) { Object.keys(xs).forEach(function (id) { __data_xs[id] = xs[id]; @@ -1389,6 +1410,11 @@ return data; } + function getValueOnIndex(values, index) { + var valueOnIndex = values.filter(function (v) { return v.index === index; }); + return valueOnIndex.length ? valueOnIndex[0] : null; + } + function updateTargetX(targets, x) { targets.forEach(function (t) { t.values.forEach(function (v, i) { @@ -1441,23 +1467,25 @@ } return new_rows; } - function convertDataToTargets(data) { + function convertDataToTargets(data, appendXs) { var ids = d3.keys(data[0]).filter(isNotX), xs = d3.keys(data[0]).filter(isX), targets; // save x for update data by load when custom x and c3.x API ids.forEach(function (id) { - var xKey = getXKey(id), idsForX; + var xKey = getXKey(id); if (isCustomX || isTimeSeries) { // if included in input data if (xs.indexOf(xKey) >= 0) { - c3.data.xs[id] = data.map(function (d) { return d[xKey]; }).filter(isValue).map(function (rawX, i) { return generateTargetX(rawX, id, i); }); - + c3.data.xs[id] = (appendXs && c3.data.xs[id] ? c3.data.xs[id] : []).concat( + data.map(function (d) { return d[xKey]; }) + .filter(isValue) + .map(function (rawX, i) { return generateTargetX(rawX, id, i); }) + ); } // if not included in input data, find from preloaded data of other id's x else if (__data_x) { - idsForX = Object.keys(c3.data.xs); - c3.data.xs[id] = idsForX.length > 0 ? c3.data.xs[idsForX[0]] : undefined; + c3.data.xs[id] = getOtherTargetXs(); } // if not included in input data, find from preloaded data else if (notEmpty(__data_xs)) { @@ -1536,10 +1564,12 @@ }; } function getPrevX(i) { - return i > 0 && c3.data.targets[0].values[i - 1] ? c3.data.targets[0].values[i - 1].x : undefined; + var value = getValueOnIndex(c3.data.targets[0].values, i - 1); + return value ? value.x : null; } function getNextX(i) { - return i < getMaxDataCount() - 1 ? c3.data.targets[0].values[i + 1].x : undefined; + var value = getValueOnIndex(c3.data.targets[0].values, i + 1); + return value ? value.x : null; } function getMaxDataCount() { return d3.max(c3.data.targets, function (t) { return t.values.length; }); @@ -1668,20 +1698,20 @@ } function classText(d) { return generateClass(CLASS.text, d.id); } function classTexts(d) { return generateClass(CLASS.texts, d.id); } - function classShape(d, i) { return generateClass(CLASS.shape, i); } + function classShape(d) { return generateClass(CLASS.shape, d.index); } function classShapes(d) { return generateClass(CLASS.shapes, d.id); } function classLine(d) { return classShape(d) + generateClass(CLASS.line, d.id); } function classLines(d) { return classShapes(d) + generateClass(CLASS.lines, d.id); } - function classCircle(d, i) { return classShape(d, i) + generateClass(CLASS.circle, i); } + function classCircle(d) { return classShape(d) + generateClass(CLASS.circle, d.index); } function classCircles(d) { return classShapes(d) + generateClass(CLASS.circles, d.id); } - function classBar(d, i) { return classShape(d, i) + generateClass(CLASS.bar, i); } + function classBar(d) { return classShape(d) + generateClass(CLASS.bar, d.index); } function classBars(d) { return classShapes(d) + generateClass(CLASS.bars, d.id); } function classArc(d) { return classShape(d.data) + generateClass(CLASS.arc, d.data.id); } function classArcs(d) { return classShapes(d.data) + generateClass(CLASS.arcs, d.data.id); } function classArea(d) { return classShape(d) + generateClass(CLASS.area, d.id); } function classAreas(d) { return classShapes(d) + generateClass(CLASS.areas, d.id); } function classRegion(d, i) { return generateClass(CLASS.region, i) + ' ' + ('class' in d ? d.class : ''); } - function classEvent(d, i) { return generateClass(CLASS.eventRect, i); } + function classEvent(d) { return generateClass(CLASS.eventRect, d.index); } function classTarget(id) { var additionalClassSuffix = __data_classes[id], additionalClass = ''; if (additionalClassSuffix) { @@ -2177,7 +2207,7 @@ function parseDate(date) { var parsedDate; try { - parsedDate = __data_x_format ? d3.time.format(__data_x_format).parse(date) : new Date(date); + parsedDate = date instanceof Date || !__data_x_format ? new Date(date) : d3.time.format(__data_x_format).parse(date); } catch (e) { window.console.error("Failed to parse x '" + date + "' to Date with format " + __data_x_format); } @@ -2236,6 +2266,34 @@ }); } + function generateWait() { + var transitionsToWait = [], + f = function (transition, callback) { + var timer = setInterval(function () { + var done = 0; + transitionsToWait.forEach(function (t) { + if (t.empty()) { + done += 1; + return; + } + try { + t.transition(); + } catch (e) { + done += 1; + } + }); + if (done === transitionsToWait.length) { + clearInterval(timer); + if (callback) { callback(); } + } + }, 10); + }; + f.add = function (transition) { + transitionsToWait.push(transition); + }; + return f; + } + function getOption(options, key, defaultValue) { return isDefined(options[key]) ? options[key] : defaultValue; } @@ -2965,14 +3023,18 @@ eventRectEnter.append("rect") .attr("class", classEvent) .style("cursor", __data_selection_enabled && __data_selection_grouped ? "pointer" : null) - .on('mouseover', function (_, i) { + .on('mouseover', function (d) { + var index = d.index, selectedData, newData; + if (dragging) { return; } // do nothing if dragging if (hasArcType(c3.data.targets)) { return; } - var selectedData = c3.data.targets.map(function (d) { return addName(d.values[i]); }), - newData = []; + selectedData = c3.data.targets.map(function (t) { + return addName(getValueOnIndex(t.values, index)); + }); // Sort selectedData as names order + newData = []; Object.keys(__data_names).forEach(function (id) { for (var j = 0; j < selectedData.length; j++) { if (selectedData[j] && selectedData[j].id === id) { @@ -2985,35 +3047,36 @@ selectedData = newData.concat(selectedData); // Add remained // Expand shapes if needed - if (__point_focus_expand_enabled) { expandCircles(i); } - expandBars(i); + if (__point_focus_expand_enabled) { expandCircles(index); } + expandBars(index); // Call event handler - main.selectAll('.' + CLASS.shape + '-' + i).each(function (d) { + main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) { __data_onenter(d); }); }) - .on('mouseout', function (_, i) { + .on('mouseout', function (d) { + var index = d.index; if (hasArcType(c3.data.targets)) { return; } hideXGridFocus(); hideTooltip(); // Undo expanded shapes - unexpandCircles(i); + unexpandCircles(index); unexpandBars(); // Call event handler - main.selectAll('.' + CLASS.shape + '-' + i).each(function (d) { + main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) { __data_onleave(d); }); }) - .on('mousemove', function (_, i) { - var selectedData; + .on('mousemove', function (d) { + var selectedData, index = d.index; if (dragging) { return; } // do nothing when dragging if (hasArcType(c3.data.targets)) { return; } // Show tooltip - selectedData = filterTargetsToShow(c3.data.targets).map(function (d) { - return addName(d.values[i]); + selectedData = filterTargetsToShow(c3.data.targets).map(function (t) { + return addName(getValueOnIndex(t.values, index)); }); showTooltip(selectedData, d3.mouse(this)); @@ -3023,12 +3086,12 @@ if (! __data_selection_enabled) { return; } if (__data_selection_grouped) { return; } // nothing to do when grouped - main.selectAll('.' + CLASS.shape + '-' + i) + main.selectAll('.' + CLASS.shape + '-' + index) .filter(function (d) { return __data_selection_isselectable(d); }) .each(function () { var _this = d3.select(this).classed(CLASS.EXPANDED, true); if (this.nodeName === 'circle') { _this.attr('r', pointExpandedR); } - svg.select('.' + CLASS.eventRect + '-' + i).style('cursor', null); + svg.select('.' + CLASS.eventRect + '-' + index).style('cursor', null); }) .filter(function (d) { if (this.nodeName === 'circle') { @@ -3044,16 +3107,17 @@ _this.classed(CLASS.EXPANDED, true); if (this.nodeName === 'circle') { _this.attr('r', pointSelectR); } } - svg.select('.' + CLASS.eventRect + '-' + i).style('cursor', 'pointer'); + svg.select('.' + CLASS.eventRect + '-' + index).style('cursor', 'pointer'); }); }) - .on('click', function (_, i) { + .on('click', function (d) { + var index = d.index; if (hasArcType(c3.data.targets)) { return; } if (cancelClick) { cancelClick = false; return; } - main.selectAll('.' + CLASS.shape + '-' + i).each(function (d) { toggleShape(this, d, i); }); + main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) { toggleShape(this, d, index); }); }) .call( d3.behavior.drag().origin(Object) @@ -3287,7 +3351,7 @@ var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend, withUpdateTranslate; var hideAxis = hasArcType(c3.data.targets); var drawArea, drawAreaOnSub, drawBar, drawBarOnSub, drawLine, drawLineOnSub, xForText, yForText; - var duration, durationForExit, durationForAxis; + var duration, durationForExit, durationForAxis, waitForDraw = generateWait(); var targetsToShow = filterTargetsToShow(c3.data.targets), tickValues, i, intervalForCulling; options = options || {}; @@ -3334,18 +3398,7 @@ } if (targetsToShow.length) { - if (withUpdateOrgXDomain) { - x.domain(d3.extent(getXDomain(targetsToShow))); - orgXDomain = x.domain(); - if (__zoom_enabled) { zoom.scale(x).updateScaleExtent(); } - subX.domain(x.domain()); - brush.scale(subX); - } - // ATTENTION: call here to update tickOffset - if (withUpdateXDomain) { - x.domain(brush.empty() ? orgXDomain : brush.extent()); - if (__zoom_enabled) { zoom.scale(x).updateScaleExtent(); } - } + updateXDomain(targetsToShow, withUpdateXDomain, withUpdateOrgXDomain); // update axis tick values according to options if (!__axis_x_tick_values && (__axis_x_tick_fit || __axis_x_tick_count)) { tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow), __axis_x_tick_count); @@ -3541,16 +3594,12 @@ .style("stroke", function (d) { return color(d.id); }) .style("fill", function (d) { return color(d.id); }); mainBar - .style("opacity", initialOpacity) - .transition().duration(duration) - .attr('d', drawBar) - .style("fill", color) - .style("opacity", 1); + .style("opacity", initialOpacity); mainBar.exit().transition().duration(durationForExit) .style('opacity', 0) .remove(); - // lines and cricles + // lines, areas and cricles mainLine = main.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line) .data(lineData); mainLine.enter().append('path') @@ -3558,14 +3607,11 @@ .style("stroke", color); mainLine .style("opacity", initialOpacity) - .transition().duration(duration) - .attr("d", drawLine) - .style("stroke", color) - .style("opacity", 1); + .attr('transform', null); mainLine.exit().transition().duration(durationForExit) .style('opacity', 0) .remove(); - // area + mainArea = main.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area) .data(lineData); mainArea.enter().append('path') @@ -3573,10 +3619,6 @@ .style("fill", color) .style("opacity", function () { orgAreaOpacity = +d3.select(this).style('opacity'); return 0; }); mainArea - .style("opacity", 0) - .transition().duration(duration) - .attr("d", drawArea) - .style("fill", color) .style("opacity", orgAreaOpacity); mainArea.exit().transition().duration(durationForExit) .style('opacity', 0) @@ -3590,13 +3632,10 @@ .attr("r", pointR) .style("fill", color); mainCircle - .style("opacity", initialOpacity) - .transition().duration(duration) - .style('opacity', opacityForCircle) - .style("fill", color) - .attr("cx", __axis_rotated ? circleY : circleX) - .attr("cy", __axis_rotated ? circleX : circleY); + .style("opacity", initialOpacity); mainCircle.exit().remove(); + } else { + mainCircle = d3.selectAll([]); } if (hasDataLabel()) { @@ -3794,10 +3833,6 @@ .filter(function (d) { return isBarType(d); }) .selectAll('circle') .remove(); - main.selectAll('.' + CLASS.selectedCircle) - .transition().duration(duration) - .attr("cx", __axis_rotated ? circleY : circleX) - .attr("cy", __axis_rotated ? circleX : circleY); if (__interaction_enabled) { // rect for mouseover @@ -3828,14 +3863,12 @@ } if ((isCustomX || isTimeSeries) && !isCategorized) { - rectW = function (d, i) { - var prevX = getPrevX(i), nextX = getNextX(i), dx = c3.data.xs[d.id][i]; - var xnX = x(nextX ? nextX : dx); - var xpX = x(prevX ? prevX : dx); - return (xnX - xpX) / 2; + rectW = function (d) { + var prevX = getPrevX(d.index), nextX = getNextX(d.index), dx = c3.data.xs[d.id][d.index]; + return (x(nextX ? nextX : dx) - x(prevX ? prevX : dx)) / 2; }; - rectX = function (d, i) { - var prevX = getPrevX(i), dx = c3.data.xs[d.id][i]; + rectX = function (d) { + var prevX = getPrevX(d.index), dx = c3.data.xs[d.id][d.index]; return (x(dx) + x(prevX ? prevX : dx)) / 2; }; } else { @@ -3865,6 +3898,97 @@ } } + // transition should be derived from one transition + d3.transition().duration(duration).each(function () { + waitForDraw.add(mainBar.transition() + .attr('d', drawBar) + .style("fill", color) + .style("opacity", 1)); + waitForDraw.add(mainLine.transition() + .attr("d", drawLine) + .style("stroke", color) + .style("opacity", 1)); + waitForDraw.add(mainArea.transition() + .attr("d", drawArea) + .style("fill", color) + .style("opacity", orgAreaOpacity)); + waitForDraw.add(mainCircle.transition() + .style('opacity', opacityForCircle) + .style("fill", color) + .attr("cx", __axis_rotated ? circleY : circleX) + .attr("cy", __axis_rotated ? circleX : circleY)); + waitForDraw.add(main.selectAll('.' + CLASS.selectedCircle).transition() + .attr("cx", __axis_rotated ? circleY : circleX) + .attr("cy", __axis_rotated ? circleX : circleY)); + }) + .call(waitForDraw, options.flow ? function () { // only for flow + var translateX, scaleX = 1, transform, + flowIndex = options.flow.index, + flowLength = options.flow.length, + flowStart = getValueOnIndex(c3.data.targets[0].values, flowIndex), + flowEnd = getValueOnIndex(c3.data.targets[0].values, flowIndex + flowLength), + orgDomain = x.domain(), + wait = generateWait(); + + // remove head data after rendered + c3.data.targets.forEach(function (d) { + d.values.splice(0, flowLength); + }); + + // update x domain to generate axis elements for flow + updateXDomain(targetsToShow, true, true); + + // generate transform to flow + translateX = x(flowStart.x) - x(flowEnd.x); + if (isTimeSeries) { + translateX = translateX * 0.9; // TODO: fix 0.9, I don't know why 0.9.. + scaleX = (diffDomain(orgDomain) / diffDomain(x.domain())); + } + transform = 'translate(' + translateX + ',0) scale(' + scaleX + ',1)'; + + d3.transition().ease('linear').each(function () { + wait.add(axes.x.transition().call(xAxis)); + wait.add(mainBar.transition().attr('transform', transform)); + wait.add(mainLine.transition().attr('transform', transform)); + wait.add(mainArea.transition().attr('transform', transform)); + wait.add(mainCircle.transition().attr('transform', transform)); + }) + .call(wait, function () { + var i, targets = [], eventRects = []; + + // remove flowed elements + for (i = 0; i < flowLength; i++) { + targets.push('.' + CLASS.shape + '-' + (flowIndex + i)); + eventRects.push('.' + CLASS.eventRect + '-' + (flowIndex + i)); + } + svg.selectAll('.' + CLASS.shapes).selectAll(targets).remove(); + svg.selectAll('.' + CLASS.eventRects).selectAll(eventRects).remove(); + + // draw again for removing flowed elements + mainBar + .attr('transform', null) + .attr("d", drawBar); + mainLine + .attr('transform', null) + .attr("d", drawLine); + mainArea + .attr('transform', null) + .attr("d", drawArea); + mainCircle + .attr('transform', null) + .attr("cx", __axis_rotated ? circleY : circleX) + .attr("cy", __axis_rotated ? circleX : circleY); + eventRectUpdate + .attr("x", __axis_rotated ? 0 : rectX) + .attr("y", __axis_rotated ? rectX : 0) + .attr("width", __axis_rotated ? width : rectW) + .attr("height", __axis_rotated ? rectW : height); + + // callback here? + + }); + } : null); + // update fadein condition mapToIds(c3.data.targets).forEach(function (id) { withoutFadeIn[id] = true; @@ -4538,6 +4662,87 @@ }); }; + c3.flow = function (args) { + var targets = convertDataToTargets(convertColumnsToData(args.columns), true), + notfoundIds = [], length, tail; + + // Update/Add data + c3.data.targets.forEach(function (t) { + var found = false, i, j; + for (i = 0; i < targets.length; i++) { + if (t.id === targets[i].id) { + found = true; + + tail = t.values[t.values.length - 1].index + 1; + length = targets[i].values.length; + + for (j = 0; j < targets[i].values.length; j++) { + targets[i].values[j].index = tail + j; + if (!isTimeSeries) { + targets[i].values[j].x = tail + j; + } + } + t.values = t.values.concat(targets[i].values); + + targets.splice(i, 1); + break; + } + } + if (!found) { notfoundIds.push(t.id); } + }); + + // Append null for not found targets + c3.data.targets.forEach(function (t) { + var i, j; + for (i = 0; i < notfoundIds.length; i++) { + if (t.id === notfoundIds[i]) { + tail = t.values[t.values.length - 1].index + 1; + for (j = 0; j < length; j++) { + t.values.push({ + id: t.id, + index: tail + j, + x: isTimeSeries ? getOtherTargetX(tail + j) : tail + j, + value: null + }); + } + } + } + }); + + // Generate null values for new target + targets.forEach(function (t) { + var i, missing = []; + for (i = c3.data.targets[0].values[0].index; i < tail; i++) { + missing.push({ + id: t.id, + index: i, + x: isTimeSeries ? getOtherTargetX(i) : i, + value: null + }); + } + t.values.forEach(function (v) { + v.index += tail; + if (!isTimeSeries) { + v.x += tail; + } + }); + t.values = missing.concat(t.values); + }); + c3.data.targets = c3.data.targets.concat(targets); // add remained + + // Set targets + updateTargets(c3.data.targets); + + // Redraw with new targets + redraw({ + flow: { + index: c3.data.targets[0].values[0].index, + length: length + }, + withLegend: true + }); + }; + c3.selected = function (targetId) { return d3.merge( main.selectAll('.' + CLASS.shapes + getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS.shape) diff --git a/c3.min.js b/c3.min.js index 19f36d7..4368706 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Yj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Yj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Yj.select("."+g.axisY2),a&&(e=e.transition())),Yj.attr("transform",Lj.main),c.attr("transform",Lj.x),d.attr("transform",Lj.y),e.attr("transform",Lj.y2),Yj.select("."+g.chartArcs).attr("transform",Lj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Zj.select("."+g.axisX),a&&(c=c.transition())),Zj.attr("transform",Lj.context),c.attr("transform",Lj.subx)}function n(a){(a?$j.transition():$j).attr("transform",Lj.legend)}function o(a,b){l(a,b),Bh&&m(a,b),n(a)}function p(){var a=V(),b=U(),c=Mj?0:a,d=oe(_f.data.targets),e=Lh||d?0:A("x"),f=Bh&&!d?Ch+e:0;yg=t(),zg=u(),Lh?(rg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},sg={top:rg.top,right:0/0,bottom:20+c,left:Rj}):(rg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},sg={top:zg-f-c,right:0/0,bottom:e+c,left:rg.left}),tg={top:Mj?0:zg-a,right:0/0,bottom:0,left:Mj?yg-b:0},ug=yg-rg.left-rg.right,wg=zg-rg.top-rg.bottom,0>ug&&(ug=0),0>wg&&(wg=0),vg=Lh?rg.left-Rj-Sj:ug,xg=Lh?wg:zg-sg.top-sg.bottom,0>vg&&(vg=0),0>xg&&(xg=0),Dg=ug-(Mj?b+10:0),Eg=wg-(Mj?0:10),r(),Mj&&d&&(tg.left=Dg/2+1.1*Bg)}function q(){Yj.select("line."+g.xgridFocus).attr("x1",Lh?0:-10).attr("x2",Lh?ug:-10).attr("y1",Lh?-10:rg.top).attr("y2",Lh?-10:wg)}function r(){var a;Bg=Math.min(Dg,Eg)/2,Ag=.95*Bg,a=Xi?(Ag-Xi)/Ag:.6,Cg=ne(_f.data.targets)||me(_f.data.targets)?Ag*a:0}function s(){var a=Lh?g.axisX:g.axisY,b=Yj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=ak.node().getBoundingClientRect(),e=oe(_f.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return cg?cg:C()}function u(){var a=dg?dg:D();return a>0?a:320}function v(){return gg?gg:0}function w(){return hg?hg:0}function x(){return eg?eg:Lh?Mh?Math.max(Re(z("x")),40):1:!ci||hi?1:Re(z("y"))}function y(){var a=10,b=Mj?U()+20:0;return fg?fg:Lh?a+b:(!li||qi?a:Re(z("y2")))+b}function z(a){var b=pb(a);return b.isInner?20+Ib(a):40+Ib(a)}function A(a){return"x"!==a||Mh?"x"===a&&_h?_h:"y"!==a||ci?"y2"!==a||li?(pb(a).isInner?30:40)+("y2"===a?-10:0):Tj:Fh&&!Mj?10:1:0}function B(a){for(var b,c=ak.node();c&&"BODY"!==c.tagName&&!(b=c.getBoundingClientRect()[a]);)c=c.parentNode;return b}function C(){return B("width")}function D(){var a=ak.style("height");return a.indexOf("px")>0?+a.replace("px",""):0}function E(a){return a?-31:-(rg.left-1)}function F(a){return a?-20:-4}function G(){return E(!Lh)}function H(){return F(!Lh)}function I(){return E(Lh)}function J(){return F(Lh)}function K(a){return a?ug+2+30+30:rg.left+20}function L(a){return a?(_h?_h:0)+80:wg+8}function M(){return K(!Lh)}function N(){return L(!Lh)}function O(){return K(Lh)}function P(){return L(Lh)}function Q(){var a,b,c,d,e,f,g=Gc(_f.data.targets);return g?(a=g.values[0],b=g.values[g.values.length-1],c=Rg(b.x)-Rg(a.x),0===c?Lh?wg:ug:(d=Fc(),e=je(_f.data.targets)?(d-(sj?.25:1))/d:1,f=d>1?c*e/(d-1):c,1>f?1:f)):0}function R(a){Nj=a}function S(a){Oj=a}function T(a){Pj=a}function U(){return Fh?Mj?Oj*(Nj+1):yg:0}function V(){return Fh?Mj?zg:Pj*(Nj+1):0}function W(){var a,b,c=!Rg;Jg=Lh?1:0,Kg=Lh?wg:ug,Lg=Lh?0:wg,Mg=Lh?ug:1,Ng=Jg,Og=Kg,Pg=Lh?0:xg,Qg=Lh?vg:1,Rg=Z(Jg,Kg,c?void 0:Rg.domain(),function(){return Xg.tickOffset()}),Sg=$(Lg,Mg,c?void 0:Sg.domain()),Tg=$(Lg,Mg,c?void 0:Tg.domain()),Ug=Z(Jg,Kg,bk,function(a){return a%1?0:$g.tickOffset()}),Vg=$(Pg,Qg,c?void 0:Vg.domain()),Wg=$(Pg,Qg,c?void 0:Wg.domain()),a=eb(),b=Wh?Wh:c?void 0:Xg.tickValues(),Xg=bb(Rg,Hj,a,b),$g=bb(Ug,Kj,a,b),Yg=cb(Sg,Ij,ii,ki),Zg=cb(Tg,Jj,ri,ti),c||(Uj.scale(Ug),ig&&Vj.scale(Rg)),X()}function X(){Fg=Lb(),Gg=Mb(),Hg=Mb(.98)}function Y(a,b,c){return(c?$f.time.scale():$f.scale.linear()).range([a,b])}function Z(a,b,c,d){var e,f=Y(a,b,rj),g=c?f.domain(c):f;sj?(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 bk&&bk[0]===a[0]&&bk[1]a?a.toFixed(0):a};return Rh&&("function"==typeof Rh?a=Rh:rj&&(a=function(a){return a?Cj(Rh)(a):""})),a}function fb(a){var b;return"y"===a?b=gi:"y2"===a?b=pi:"x"===a&&(b=bi),b}function gb(a){var b=fb(a);return"string"==typeof b?b:b?b.text:null}function hb(a,b){var c=fb(a);"string"==typeof c?"y"===a?gi=b:"y2"===a?pi=b:"x"===a&&(bi=b):c&&(c.text=b)}function ib(a){return 10*Math.sin(Math.PI*(a/180))}function jb(a){return 11.5-2.5*(a/15)}function kb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",jb(c)).attr("x",ib(c)).attr("transform","rotate("+c+")")}function lb(a,b){var c=fb(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function mb(){return lb("x",Lh?"inner-top":"inner-right")}function nb(){return lb("y",Lh?"inner-right":"inner-top")}function ob(){return lb("y2",Lh?"inner-right":"inner-top")}function pb(a){return"y2"===a?ob():"y"===a?nb():mb()}function qb(){return gb("x")}function rb(){return gb("y")}function sb(){return gb("y2")}function tb(a,b){return a?b.isLeft?0:b.isCenter?ug/2:ug:b.isBottom?-wg:b.isMiddle?-wg/2:0}function ub(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function vb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function wb(){return tb(!Lh,mb())}function xb(){return tb(Lh,nb())}function yb(){return tb(Lh,ob())}function zb(){return ub(!Lh,mb())}function Ab(){return ub(Lh,nb())}function Bb(){return ub(Lh,ob())}function Cb(){var a=mb();return Lh?a.isInner?"1.2em":-25-Ib("x"):a.isInner?"-0.5em":_h?_h-10:"3em"}function Db(){var a=nb();return Lh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Ib("y")}function Eb(){var a=ob();return Lh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Ib("y2")}function Fb(){return vb(!Lh,mb())}function Gb(){return vb(Lh,nb())}function Hb(){return vb(Lh,ob())}function Ib(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return $f.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Jb(a){var b=Yj.select("."+g.axisX+" ."+g.axisXLabel),c=Yj.select("."+g.axisY+" ."+g.axisYLabel),d=Yj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",wb).attr("dx",zb).attr("dy",Cb).text(qb),(a?c.transition():c).attr("x",xb).attr("dx",Ab).attr("dy",Db).attr("dy",Db).text(rb),(a?d.transition():d).attr("x",yb).attr("dx",Bb).attr("dy",Eb).text(sb)}function Kb(a){var b=!1;if(Ig(Nc(_f.data.targets)).forEach(function(c){b||c.data.id!==a.data.id||(b=!0,a=c)}),isNaN(a.endAngle)&&(a.endAngle=a.startAngle),we(a.data)){var c=Ri,d=Si,e=Math.abs(c)+d,f=Math.PI/e;a.startAngle=-1*(Math.PI/2)+f*Math.abs(c),a.endAngle=a.startAngle+f*(a.value>d?d:a.value)}return b?a:null}function Lb(){var a=$f.svg.arc().outerRadius(Ag).innerRadius(Cg),b=function(b,c){var d;return c?a(b):(d=Kb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Mb(a){var b=$f.svg.arc().outerRadius(Bg*(a?a:1)).innerRadius(Cg);return function(a){var c=Kb(a);return c?b(c):"M 0 0"}}function Nb(a,b,c){return c||ye(a.data)?Fg(a,b):"M 0 0"}function Ob(a){var b,c,d,e,f,g=Kb(a),h="";return g&&!me(_f.data.targets)&&(b=Fg.centroid(g),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),f=(36/Ag>.375?1.175-36/Ag:.8)*Ag/e,h="translate("+c*f+","+d*f+")"),h}function Pb(a){var b=me(_f.data.targets)?Math.PI:2*Math.PI;return a?(a.endAngle-a.startAngle)/b:null}function Qb(a){return vc({id:a.data.id,value:a.value,ratio:Pb(a)})}function Rb(a){var b,c,d,e;return Ub()?(b=Kb(a),c=b?b.value:null,d=Pb(b),e=Vb(),e?e(c,d):Id(c,d)):""}function Sb(a,b){var c=Wj.selectAll("."+g.chartArc+ud(a)),d=Wj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});Ee(a)&&c.selectAll("path").transition().duration(50).attr("d",Gg).transition().duration(100).attr("d",Hg).each(function(a){xe(a.data)}),b||d.style("opacity",.3)}function Tb(a){var b=Wj.selectAll("."+g.chartArc+ud(a));b.selectAll("path."+g.arc).transition().duration(50).attr("d",Fg),Wj.selectAll("."+g.arc).style("opacity",1)}function Ub(){var a=!0;return ne(_f.data.targets)?a=Yi:le(_f.data.targets)&&(a=Ji),a}function Vb(){var a=Ki;return me(_f.data.targets)?a=Qi:ne(_f.data.targets)&&(a=Zi),a}function Wb(){return ne(_f.data.targets)?_i:""}function Xb(){var a=Mi;return me(_f.data.targets)?a=Ti:ne(_f.data.targets)&&(a=aj),"function"==typeof a?a:function(){}}function Yb(){var a=Ni;return me(_f.data.targets)?a=Ui:ne(_f.data.targets)&&(a=bj),"function"==typeof a?a:function(){}}function Zb(){var a=Oi;return me(_f.data.targets)?a=Vi:ne(_f.data.targets)&&(a=cj),"function"==typeof a?a:function(){}}function $b(a,c,d,e){var f="ratio"===a.unit?e:1;return b(a[c])?a[c]*f:d}function _b(a){var b,c,d,e,f,g,h=Ic(a),i=Uc(a);if(fh.length>0)for(g=Wc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return $f.min(Object.keys(i).map(function(a){return $f.min(i[a])}))}function ac(a){var b,c,d,e,f,g,h=Ic(a),i=Uc(a);if(fh.length>0)for(g=Xc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return $f.max(Object.keys(i).map(function(a){return $f.max(i[a])}))}function bc(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return db(a.id)===c}),m="y2"===c?ni:ei,n="y2"===c?mi:di,o=b(m)?m:_b(l),p=b(n)?n:ac(l),q="y2"===c?oi:fi,r=Cd()&&Lh;return 0===l.length?"y2"===c?Tg.domain():Sg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Dd(o,p),j=gc(Sg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&ji&&(f=$b(ji,"top",e,d),g=$b(ji,"bottom",e,d)),"y2"===c&&si&&(f=$b(si,"top",e,d),g=$b(si,"bottom",e,d)),je(l)&&!Wc(l)&&(g=o),[o-g,p+f])}function cc(a){return Zh?rj?He(Zh):Zh:$f.min(a,function(a){return $f.min(a.values,function(a){return a.x})})}function dc(a){return Yh?rj?He(Yh):Yh:$f.max(a,function(a){return $f.max(a.values,function(a){return a.x})})}function ec(a){var c,d,e,f,g=Hc(a),h=g[1]-g[0];return sj?d=0:je(a)?(c=Fc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof $h&&Me($h)?(e=b($h.left)?$h.left:d,f=b($h.right)?$h.right:d):e=f="number"==typeof $h?$h:d,{left:e,right:f}}function fc(a){var b=[cc(a),dc(a)],c=b[0],d=b[1],e=ec(a),f=0,g=0;return c-d!==0||sj||(c=rj?new Date(.5*c.getTime()):-.5,d=rj?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=rj?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=rj?new Date(d.getTime()+e.right):d+e.right),[f,g]}function gc(a){return a[1]-a[0]}function hc(a){for(var b=0;bb?0:b-c}function nc(a){var b,c=lc(a),d="y"===a.axis?Sg:Tg;return b="y"===a.axis||"y2"===a.axis?Lh?wg:"start"in a?d(a.start):wg:Lh?"end"in a?Rg(rj?He(a.end):a.end):wg:wg,c>b?0:b-c}function oc(a){return _g&&a===_g||Me(ah)&&Ne(ah,a)}function pc(a){return!oc(a)}function qc(a){return _g?_g:Me(ah)?ah[a]:null}function rc(a,b){var c,d=b&&Me(b)?Ic(b):[];return d.forEach(function(b){qc(b)===a&&(c=_f.data.xs[b])}),c}function sc(a,b){return a in _f.data.xs&&_f.data.xs[a]&&_f.data.xs[a][b]?_f.data.xs[a][b]:b}function tc(a){Object.keys(a).forEach(function(b){ah[b]=a[b]})}function uc(a){return 1===$f.set(Object.keys(a).map(function(b){return a[b]})).size()}function vc(a){var b;return a&&(b=dh[a.id],a.name=b?b:a.id),a}function wc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=yc(b[d],a.id,d)}),_f.data.xs[a.id]=b})}function xc(a,b){a.forEach(function(a){b[a.id]&&wc([a],b[a.id])})}function yc(a,c,d){var e;return e=rj?a?a instanceof Date?a:He(a):He(sc(c,d)):tj&&!sj?b(a)?+a:sc(c,d):d}function zc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?_f.data.xs[c]=a.map(function(a){return a[f]}).filter(b).map(function(a,b){return yc(a,c,b)}):_g?(d=Object.keys(_f.data.xs),_f.data.xs[c]=d.length>0?_f.data.xs[d[0]]:void 0):Me(ah)&&(_f.data.xs[c]=rc(f,_f.data.targets)):_f.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!_f.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=ch(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=qc(b),g=a[f],h=yc(g,b,e);return tj&&sj&&0===c&&g&&(0===e&&(Ph=[]),Ph.push(g)),("undefined"==typeof a[b]||_f.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),hh&&he(Ic(c).filter(function(a){return!(a in ih)}),hh),c.forEach(function(a){ic(a.id_org,a)}),c}function Cc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function Dc(a){return a>0&&_f.data.targets[0].values[a-1]?_f.data.targets[0].values[a-1].x:void 0}function Ec(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Hc(a){var b,c,d=Gc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ic(a){return a.map(function(a){return a.id})}function Jc(a){return a?"string"==typeof a?[a]:a:Ic(_f.data.targets)}function Kc(a,b){var c,d=Ic(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(rj?new Date(i):i);j.push(e)}return rj||(j=j.sort(function(a,b){return a-b})),j}function Qc(a){Ej=Ej.concat(a)}function Rc(a){Ej=Ej.filter(function(b){return a.indexOf(b)<0})}function Sc(a){Fj=Fj.concat(a)}function Tc(a){Fj=Fj.filter(function(b){return a.indexOf(b)<0})}function Uc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Vc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Xc(a){return Vc(a,function(a){return a>0})}function Yc(a){return a=0&&d===a[c].x;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(Od(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Od(a,g))),Rd(e,b)):Pd(a,b,f,g)}function Qd(a,b){var c;return c=a.map(function(a){return Pd(a.values,b)}),Rd(c,b)}function Rd(a,b){var c,d;return a.forEach(function(a){var e=Oe(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Sd(a,b){return $f.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Td(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Ud(){return kh&&"desc"===kh.toLowerCase()}function Vd(){return kh&&"asc"===kh.toLowerCase()}function Wd(a){var b=Vd(),c=Ud();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof kh&&a.sort(kh),a}function Xd(a,c){var d,e,f,g,h,i,j,k=oe(_f.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ej&&(_j.html(hj(a,eb(),Ed(k),Aj)).style("display","block"),d=_j.property("offsetWidth"),e=_j.property("offsetHeight"),k?(g=ug/2+c[0],i=wg/2+c[1]+20):(Lh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Rg(l[0].x)+20):(f=s(),g=f+x()+Rg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=h-j),i+e>u()&&(i-=e+30)),_j.style("top",i+"px").style("left",g+"px"))}function Yd(){_j.style("display","none")}function Zd(a){var c=a.filter(function(a){return a&&b(a.value)});if(ej&&!ke(_f.data.targets)&&!oe(_f.data.targets)){var d=Yj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(Lh?"y1":"x1",Kd).attr(Lh?"y2":"x2",Kd),Df(d,"grid")}}function $d(){Yj.select("line."+g.xgridFocus).style("visibility","hidden")}function _d(a,b){var c,d,e,f,h=[],i=Yj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=fc(),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 ae(a){var b,d,e={},f=0;return Nc(_f.data.targets.filter(a)).forEach(function(a){for(b=0;b0&&(i+=g(c.values[f].value)-h)}),i}}function ee(a){return a.x||0===a.x?Rg(a.x):null}function fe(a,b){var c=ae(pe),d=tf(c);return fh.length>0?d(a,b)[0][1]:_(a.id)(a.value)}function ge(a,b){return"number"==typeof Hi?Hi:b?2*a.tickOffset()*Ii/b:0}function he(a,b){Jc(a).forEach(function(a){dk[a]=b===ih[a],ih[a]=b}),a||(hh=b)}function ie(a,b){var c=!1;return a.forEach(function(a){ih[a.id]===b&&(c=!0),a.id in ih||"line"!==b||(c=!0)}),c}function je(a){return ie(a,"bar")}function ke(a){return ie(a,"scatter")}function le(a){return"pie"===hh||ie(a,"pie")}function me(a){return ie(a,"gauge")}function ne(a){return"donut"===hh||ie(a,"donut")}function oe(a){return le(a)||ne(a)||me(a)}function pe(a){var b="string"==typeof a?a:a.id;return!(b in ih)||["line","spline","area","area-spline","step","area-step"].indexOf(ih[b])>=0}function qe(a){var b="string"==typeof a?a:a.id;return["step","area-step"].indexOf(ih[b])>=0}function re(a){var b="string"==typeof a?a:a.id;return["spline","area-spline"].indexOf(ih[b])>=0}function se(a){var b="string"==typeof a?a:a.id;return["area","area-spline","area-step"].indexOf(ih[b])>=0}function te(a){var b="string"==typeof a?a:a.id;return"bar"===ih[b]}function ue(a){var b="string"==typeof a?a:a.id;return"scatter"===ih[b]}function ve(a){var b="string"==typeof a?a:a.id;return"pie"===ih[b]}function we(a){var b="string"==typeof a?a:a.id;return"gauge"===ih[b]}function xe(a){var b="string"==typeof a?a:a.id;return"donut"===ih[b]}function ye(a){return ve(a)||xe(a)||we(a)}function ze(a){return pe(a)?[a]:[]}function Ae(a){return ye(a.data)?[a]:[]}function Be(a){return te(a)?a.values:[]}function Ce(a){return pe(a)||ue(a)?a.values:[]}function De(a){return te(a)||pe(a)?a.values:[]}function Ee(a){return xe(a)&&$i||ve(a)&&Li}function Fe(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 Ge(a,b){var c="value"===b.unit,d=b.values&&b.values.length?b.values:[],e=b.max||100;return function(b){var f,g,h=a[a.length-1];for(f=0;f0}function Ne(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Oe(a,b){var c="y"===db(a.id)?Sg:Tg,d=Lh?1:0,e=Lh?0:1;return Math.pow(Rg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Pe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Qe(a,b,c){return d(a[b])?a[b]:c}function Re(a){return 10*Math.ceil(a/10)}function Se(a,b){var c;return $f.select("body").selectAll(".dummy").data([a]).enter().append("text").classed(b?b:"",!0).text(a).each(function(){c=this.getBoundingClientRect()}).remove(),c}function Te(a){return re(a)?"cardinal":qe(a)?"step-after":"linear"}function Ue(a,b,c){xh(b,a.node()),Yj.select("."+g.selectedCircles+td(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Zc(g.selectedCircle,c)}).attr("cx",Lh?fe:ee).attr("cy",Lh?ee:fe).attr("stroke",function(){return Aj(b)}).attr("r",1.4*df(b)).transition().duration(100).attr("r",df)}function Ve(a,b,c){yh(b,a.node()),Yj.select("."+g.selectedCircles+td(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function We(a,b,c,d){a?Ue(b,c,d):Ve(b,c,d)}function Xe(a,b){xh(b,a.node()),a.transition().duration(100).style("fill",function(){return $f.rgb(Aj(b)).brighter(.75)})}function Ye(a,b){yh(b,a.node()),a.transition().duration(100).style("fill",function(){return Aj(b) -})}function Ze(a,b,c,d){a?Xe(b,c,d):Ye(b,c,d)}function $e(a,b,c,d){Ze(a,b,c.data,d)}function _e(a){return"circle"===a.nodeName?We:$f.select(a).classed(g.bar)?Ze:$e}function af(a){return a.filter(function(a){return b(a.value)})}function bf(a){return Ai&&!qe(a)?"function"==typeof Bi?Bi(a):Bi:0}function cf(a){return Di?Ei?Ei:1.75*bf(a):bf(a)}function df(a){return Fi?Fi:4*bf(a)}function ef(a,c){return(c?Yj.selectAll("."+g.circles+td(c)):Yj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function ff(a,b){ef(a,b).classed(g.EXPANDED,!0).attr("r",cf)}function gf(a){ef(a).filter(function(){return $f.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",bf)}function hf(a){return Yj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function jf(a){hf(a).classed(g.EXPANDED,!0)}function kf(a){hf(a).classed(g.EXPANDED,!1)}function lf(a,b){var c=$f.svg.area(),d=rf(a,b),e=b?ab:_,f=function(a,b){return fh.length>0?d(a,b)[0][1]:e(a.id)(0)},g=function(a,b){return fh.length>0?d(a,b)[1][1]:e(a.id)(a.value)};return c=Lh?c.x0(f).x1(g).y(Kd):c.x(Kd).y0(f).y1(g),function(a){var b,d,e=af(a.values);return se(a)?c.interpolate(Te(a))(e):(b=Rg(e[0].x),d=_(a.id)(e[0].value),Lh?"M "+d+" "+b:"M "+b+" "+d)}}function mf(a,b){var c=$f.svg.line(),d=tf(a,b),e=b?ab:_,f=b?Nd:Kd,g=function(a,b){return fh.length>0?d(a,b)[0][1]:e(a.id)(a.value)};return c=Lh?c.x(g).y(f):c.x(f).y(g),Gi||(c=c.defined(function(a){return null!=a.value})),function(a){var d=Gi?af(a.values):a.values,f=b?f:Ug,g=e(a.id),h=0,i=0;return pe(a)?lh[a.id]?uf(d,f,g,lh[a.id]):c.interpolate(Te(a))(d):(d[0]&&(h=f(d[0].x),i=g(d[0].value)),Lh?"M "+i+" "+h:"M "+h+" "+i)}}function nf(a,b){var c=sf(a,b);return function(a,b){var d=c(a,b),e=Lh?1:0,f=Lh?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function of(a,b){var c=sf(a,!1),d=b?pf:qf;return function(a,b){return d(c(a,b),a,this)}}function pf(a,b){var c;return Lh?(c=te(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function qf(a,b,c){var d=c.getBoundingClientRect();return Lh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:te(b)?-3:-6)}function rf(a,b){var c=a.__max__+1,d=be(0,c,a,!!b),e=ce(!!b),f=de(se,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Lh&&(0j||a.value<0&&j>c)&&(j=c),[[i,h],[i,j-(c-h)]]}}function sf(a,b){var c=a.__max__+1,d=ge(Xg,c),e=be(d,c,a,!!b),f=ce(!!b),g=de(te,a,!!b),h=b?ab:_;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Lh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function tf(a,b){var c=a.__max__+1,d=be(0,c,a,!!b),e=ce(!!b),f=de(pe,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Lh&&(0j||a.value<0&&j>c)&&(j=c),[[i,j-(c-h)]]}}function uf(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 vf(b){var c=new MutationObserver(function(d){d.forEach(function(d){if("childList"===d.type&&d.previousSibling){c.disconnect();var e=a.setInterval(function(){b.node().parentNode&&(a.clearInterval(e),Ef({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransition:!1,withTransitionForTransform:!1,withLegend:!0}),b.transition().style("opacity",1))},10)}})});c.observe(b.node(),{attributes:!0,childList:!0,characterData:!0})}function wf(b){var c,d,e,f,h=!0;if(ak=$f.select(bg),ak.empty()&&(ak=$f.select(document.createElement("div")).style("opacity",0),vf(ak),h=!1),ak.html("").classed("c3",!0),_f.data.xs={},_f.data.targets=Bc(b),ph&&(_f.data.targets=_f.data.targets.filter(ph)),oh&&Qc(oh===!0?Ic(_f.data.targets):oh),me(_f.data.targets)&&(Fh=!1),p(),W(),Rg.domain($f.extent(fc(_f.data.targets))),Sg.domain(bc(_f.data.targets,"y")),Tg.domain(bc(_f.data.targets,"y2")),Ug.domain(Rg.domain()),Vg.domain(Sg.domain()),Wg.domain(Tg.domain()),bk=Rg.domain(),Uj.scale(Ug),ig&&Vj.scale(Rg),Wj=ak.append("svg").style("overflow","hidden").on("mouseenter",mg).on("mouseleave",ng),Xj=Wj.append("defs"),Xj.append("clipPath").attr("id",lj).append("rect"),Xj.append("clipPath").attr("id",mj).append("rect"),Xj.append("clipPath").attr("id",nj).append("rect"),If(),Yj=Wj.append("g").attr("transform",Lj.main),Zj=Wj.append("g").attr("transform",Lj.context),$j=Wj.append("g").attr("transform",Lj.legend),Bh||Zj.style("visibility","hidden"),Fh||($j.style("visibility","hidden"),Fj=Ic(_f.data.targets)),_j=ak.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Vf(Ic(_f.data.targets),{withTransform:!1,withTransitionForTransform:!1}),e=Yj.append("g").attr("clip-path",oj).attr("class",g.grid),ui&&e.append("g").attr("class",g.xgrids),Me(wi)&&e.append("g").attr("class",g.xgridLines),Ci&&e.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),xi&&e.append("g").attr("class",g.ygrids),Me(yi)&&e.append("g").attr("class",g.ygridLines),Yj.append("g").attr("clip-path",oj).attr("class",g.regions),Yj.append("g").attr("clip-path",oj).attr("class",g.chart),d=Yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",ig?Lh?"ns-resize":"ew-resize":null),Yj.select("."+g.chart).append("g").attr("class",g.chartBars),Yj.select("."+g.chart).append("g").attr("class",g.chartLines),c=Yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",Lj.arc),c.append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Wb()),me(_f.data.targets)&&(c.append("path").attr("class",g.chartArcsBackground).attr("d",function(){var a={data:[{value:Si}],startAngle:-1*(Math.PI/2),endAngle:Math.PI/2};return Nb(a,!0,!0)}),c.append("text").attr("dy",".75em").attr("class",g.chartArcsGaugeUnit).style("text-anchor","middle").style("pointer-events","none").text(Pi?Wi:""),c.append("text").attr("dx",-1*(Cg+(Ag-Cg)/2)+"px").attr("dy","1.2em").attr("class",g.chartArcsGaugeMin).style("text-anchor","middle").style("pointer-events","none").text(Pi?Ri:""),c.append("text").attr("dx",Cg+(Ag-Cg)/2+"px").attr("dy","1.2em").attr("class",g.chartArcsGaugeMax).style("text-anchor","middle").style("pointer-events","none").text(Pi?Si:"")),Yj.select("."+g.chart).append("g").attr("class",g.chartTexts),ig&&Yj.insert("rect",kg?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",ug).attr("height",wg).style("opacity",0).style("cursor",Lh?"ns-resize":"ew-resize").call(Vj).on("dblclick.zoom",null),ai&&Uj.extent("function"!=typeof ai?ai:ai(fc())),Gj.x=Yj.append("g").attr("class",g.axis+" "+g.axisX).attr("clip-path",pj).attr("transform",Lj.x).style("visibility",Mh?"visible":"hidden"),Gj.x.append("text").attr("class",g.axisXLabel).attr("transform",Lh?"rotate(-90)":"").style("text-anchor",Fb),Gj.y=Yj.append("g").attr("class",g.axis+" "+g.axisY).attr("clip-path",qj).attr("transform",Lj.y).style("visibility",ci?"visible":"hidden"),Gj.y.append("text").attr("class",g.axisYLabel).attr("transform",Lh?"":"rotate(-90)").style("text-anchor",Gb),Gj.y2=Yj.append("g").attr("class",g.axis+" "+g.axisY2).attr("transform",Lj.y2).style("visibility",li?"visible":"hidden"),Gj.y2.append("text").attr("class",g.axisY2Label).attr("transform",Lh?"":"rotate(-90)").style("text-anchor",Hb),Zj.append("g").attr("clip-path",oj).attr("class",g.chart),Zj.select("."+g.chart).append("g").attr("class",g.chartBars),Zj.select("."+g.chart).append("g").attr("class",g.chartLines),Zj.append("g").attr("clip-path",oj).attr("class",g.brush).call(Uj).selectAll("rect").attr(Lh?"width":"height",Lh?vg:xg),Gj.subx=Zj.append("g").attr("class",g.axisX).attr("transform",Lj.subx).attr("clip-path",Lh?"":pj),Lf(_f.data.targets),h&&Ef({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ij){if(rj&&"string"==typeof jj){for(jj=He(jj),f=0;f<_f.data.targets[0].values.length&&_f.data.targets[0].values[f].x-jj!==0;f++);jj=f}_j.html(hj(_f.data.targets.map(function(a){return vc(a.values[jj])}),eb(),Ed(oe(_f.data.targets)),Aj)),_j.style("top",kj.top).style("left",kj.left).style("display","block")}null==a.onresize&&(a.onresize=Hf()),a.onresize.add&&(a.onresize.add(og),a.onresize.add(function(){_f.flush()}),a.onresize.add(pg)),_f.element=ak.node()}function xf(a){a.append("rect").attr("class",nd).style("cursor",qh&&rh?"pointer":null).on("mouseover",function(a,b){if(!vj&&!oe(_f.data.targets)){var c=_f.data.targets.map(function(a){return vc(a.values[b])}),d=[];Object.keys(dh).forEach(function(a){for(var b=0;bf&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Td(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ze,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 Bf(a){oe(_f.data.targets)||qh&&(uj=a,Yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),vj=!0,zh())}function Cf(){oe(_f.data.targets)||qh&&(Yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),vj=!1,Ah())}function Df(a,b){"grid"===b&&a.each(function(){var a=$f.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 Ef(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,T,U,V,X,Y,Z,$,_,ab,bb,cb,db=ae(se),eb=ae(te),fb=ae(pe),gb=oe(_f.data.targets),hb=Nc(_f.data.targets);if(a=a||{},F=Qe(a,"withY",!0),G=Qe(a,"withSubchart",!0),H=Qe(a,"withTransition",!0),K=Qe(a,"withTransform",!1),L=Qe(a,"withUpdateXDomain",!1),M=Qe(a,"withUpdateOrgXDomain",!1),O=Qe(a,"withUpdateTranslate",!1),N=Qe(a,"withLegend",!1),I=Qe(a,"withTransitionForExit",H),J=Qe(a,"withTransitionForAxis",H),Z=H?qg:0,$=I?Z:0,_=J?Z:0,c=c||Jf(_),O&&(Lh?(Gj.x.call(Xg),Gj.subx.call($g)):(Gj.y.call(Yg),Gj.y2.call(Zg)),p(),W(),If(),o(!1)),N&&Fh&&Vf(Ic(_f.data.targets),a,c),sj&&0===hb.length&&Rg.domain([0,Gj.x.selectAll(".tick").size()]),hb.length&&(M&&(Rg.domain($f.extent(fc(hb))),bk=Rg.domain(),ig&&Vj.scale(Rg).updateScaleExtent(),Ug.domain(Rg.domain()),Uj.scale(Ug)),L&&(Rg.domain(Uj.empty()?bk:Uj.extent()),ig&&Vj.scale(Rg).updateScaleExtent()),Wh||!Vh&&!Uh||(ab=Pc(Oc(hb),Uh),Xg.tickValues(ab),$g.tickValues(ab))),Sg.domain(bc(hb,"y")),Tg.domain(bc(hb,"y2")),Gj.x.style("opacity",gb?0:1),Gj.y.style("opacity",gb?0:1),Gj.y2.style("opacity",gb?0:1),Gj.subx.style("opacity",gb?0:1),c.axisX.call(Xg),c.axisY.call(Yg),c.axisY2.call(Zg),c.axisSubX.call($g),Jb(H),L&&hb.length)if(Sh&&ab){for(bb=1;bb=0&&$f.select(this).style("display",b%cb?"none":"block")})}else Wj.selectAll("."+g.axisX+" .tick text").style("display","block");!Lh&&Xh&&kb(Gj.x,c.axisX,Xh),P=lf(db,!1),S=nf(eb),U=mf(fb,!1),X=of(eb,!0),Y=of(eb,!1),Vg.domain(Sg.domain()),Wg.domain(Tg.domain()),_j.style("display","none"),q(),Yj.select("line."+g.xgridFocus).style("visibility","hidden"),ui&&(f=_d(vi,Rg),C=sj?Xg.tickOffset():0,e=Lh?{x1:0,x2:ug,y1:function(a){return Rg(a)-C},y2:function(a){return Rg(a)-C}}:{x1:function(a){return Rg(a)+C},x2:function(a){return Rg(a)+C},y1:rg.top,y2:wg},d=Yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+$f.select(this).attr(Lh?"y1":"x1")===(Lh?wg:0)?0:1}),d.exit().remove()),Me(wi)&&(h=Yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(wi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",Lh?"":"rotate(-90)").attr("dx",Lh?0:-rg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Z).attr("x1",Lh?0:Ld).attr("x2",Lh?ug:Ld).attr("y1",Lh?Ld:rg.top).attr("y2",Lh?Ld:wg).style("opacity",1),h.select("text").transition().duration(Z).attr("x",Lh?ug:0).attr("y",Ld).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Z).style("opacity",0).remove()),F&&xi&&(j=Yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Sg.ticks(zi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",Lh?Sg:0).attr("x2",Lh?Sg:ug).attr("y1",Lh?0:Sg).attr("y2",Lh?wg:Sg),j.exit().remove(),Df(j,"grid")),F&&Me(yi)&&(k=Yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(yi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Lh?"rotate(-90)":"").attr("dx",Lh?0:-rg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Z).attr("x1",Lh?Md:0).attr("x2",Lh?Md:ug).attr("y1",Lh?0:Md).attr("y2",Lh?wg:Md).style("opacity",1),k.select("text").transition().duration(Z).attr("x",Lh?0:ug).attr("y",Md).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Z).style("opacity",0).remove()),u=Yj.select("."+g.regions).selectAll("."+g.region).data(dj),u.enter().append("g").attr("class",md).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(Z).attr("x",kc).attr("y",lc).attr("width",mc).attr("height",nc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(Z).style("opacity",0).remove(),s=Yj.selectAll("."+g.bars).selectAll("."+g.bar).data(Be),s.enter().append("path").attr("class",gd).style("stroke",function(a){return Aj(a.id)}).style("fill",function(a){return Aj(a.id)}),s.style("opacity",yd).transition().duration(Z).attr("d",S).style("fill",Aj).style("opacity",1),s.exit().transition().duration($).style("opacity",0).remove(),m=Yj.selectAll("."+g.lines).selectAll("."+g.line).data(ze),m.enter().append("path").attr("class",cd).style("stroke",Aj),m.style("opacity",yd).transition().duration(Z).attr("d",U).style("stroke",Aj).style("opacity",1),m.exit().transition().duration($).style("opacity",0).remove(),n=Yj.selectAll("."+g.areas).selectAll("."+g.area).data(ze),n.enter().append("path").attr("class",kd).style("fill",Aj).style("opacity",function(){return ck=+$f.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Z).attr("d",P).style("fill",Aj).style("opacity",ck),n.exit().transition().duration($).style("opacity",0).remove(),Ai&&(r=Yj.selectAll("."+g.circles).selectAll("."+g.circle).data(Ce),r.enter().append("circle").attr("class",ed).attr("r",bf).style("fill",Aj),r.style("opacity",yd).transition().duration(Z).style("opacity",Ad).style("fill",Aj).attr("cx",Lh?fe:ee).attr("cy",Lh?ee:fe),r.exit().remove()),Cd()&&(v=Yj.selectAll("."+g.texts).selectAll("."+g.text).data(De),v.enter().append("text").attr("class",$c).attr("text-anchor",function(a){return Lh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Aj).style("fill-opacity",0),v.text(function(a){return Jd(a.id)(a.value,a.id)}).style("fill-opacity",zd).transition().duration(Z).attr("x",X).attr("y",Y).style("fill",Aj).style("fill-opacity",Bd),v.exit().transition().duration($).style("fill-opacity",0).remove()),t=Yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(Ae),t.enter().append("path").attr("class",id).style("fill",function(a){return Aj(a.data)}).style("cursor",function(a){return sh(a)?"pointer":null}).style("opacity",0).each(function(a){we(a.data)&&(a.startAngle=a.endAngle=-1*(Math.PI/2)),this._current=a}).on("mouseover",function(a,b){var c,d,e;yj||(c=Kb(a),d=Qb(c),e=Yb(),Sb(c.data.id),Rf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Kb(a),c=Qb(b),d=[c];Xd(d,$f.mouse(this))}).on("mouseout",function(a,b){var c,d,e;yj||(c=Kb(a),d=Qb(c),e=Zb(),Tb(c.data.id),Sf(),Yd(),e(d,b))}).on("click",function(a,b){var c=Kb(a),d=Qb(c),e=Xb();zf(this,a,b),e(d,b)}),t.attr("transform",function(a){return!we(a.data)&&K?"scale(0)":""}).style("opacity",function(a){return a===this._current?0:1}).each(function(){yj=!0}).transition().duration(Z).attrTween("d",function(a){var b,c=Kb(a);return c?(isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle),b=$f.interpolate(this._current,c),this._current=b(0),function(a){return Nb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",K?"scale(1)":"").style("fill",function(a){return Bj?Bj(a.data.values[0].value):Aj(a.data.id)}).style("opacity",1).call(Pe,function(){yj=!1}),t.exit().transition().duration($).style("opacity",0).remove(),Yj.selectAll("."+g.chartArc).select("text").style("opacity",0).attr("class",function(a){return we(a.data)?g.gaugeValue:""}).text(Rb).attr("transform",Ob).transition().duration(Z).style("opacity",function(a){return Lc(a.data.id)&&ye(a.data)?1:0}),Yj.select("."+g.chartArcsTitle).style("opacity",ne(_f.data.targets)||me(_f.data.targets)?1:0),Bh&&($f.event&&"zoom"===$f.event.type&&Uj.extent(Rg.orgDomain()).update(),G&&(!Lh&&Xh&&kb(Gj.subx,c.axisSubX,Xh),Uj.empty()||Uj.extent(Rg.orgDomain()).update(),R=lf(db,!0),T=nf(eb,!0),V=mf(fb,!0),y=Zj.selectAll("."+g.bars).selectAll("."+g.bar).data(Be),y.enter().append("path").attr("class",gd).style("stroke","none").style("fill",Aj),y.style("opacity",yd).transition().duration(Z).attr("d",T).style("opacity",1),y.exit().transition().duration(Z).style("opacity",0).remove(),w=Zj.selectAll("."+g.lines).selectAll("."+g.line).data(ze),w.enter().append("path").attr("class",cd).style("stroke",Aj),w.style("opacity",yd).transition().duration(Z).attr("d",V).style("opacity",1),w.exit().transition().duration(Z).style("opacity",0).remove(),x=Zj.selectAll("."+g.areas).selectAll("."+g.area).data(ze),x.enter().append("path").attr("class",kd).style("fill",Aj).style("opacity",function(){return ck=+$f.select(this).style("opacity"),0}),x.style("opacity",0).transition().duration(Z).attr("d",R).style("fill",Aj).style("opacity",ck),x.exit().transition().duration($).style("opacity",0).remove())),Yj.selectAll("."+g.selectedCircles).filter(function(a){return te(a)}).selectAll("circle").remove(),Yj.selectAll("."+g.selectedCircle).transition().duration(Z).attr("cx",Lh?fe:ee).attr("cy",Lh?ee:fe),lg&&(z=Yj.select("."+g.eventRects),Me(ah)&&!uc(ah)?(z.classed(g.eventRectsMultiple)||z.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),A=Yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),yf(A.enter()),A.attr("x",0).attr("y",0).attr("width",ug).attr("height",wg)):(z.classed(g.eventRectsSingle)||z.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),!tj&&!rj||sj?(E=Q(),D=function(a){return Rg(a.x)-E/2}):(E=function(a,b){var c=Dc(b),d=Ec(b),e=_f.data.xs[a.id][b],f=Rg(d?d:e),g=Rg(c?c:e);return(f-g)/2},D=function(a,b){var c=Dc(b),d=_f.data.xs[a.id][b];return(Rg(d)+Rg(c?c:d))/2}),B=Gc(_f.data.targets),Yj.select("."+g.eventRects).datum(B?B.values:[]),A=Yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),xf(A.enter()),A.attr("class",nd).attr("x",Lh?0:D).attr("y",Lh?D:0).attr("width",Lh?ug:E).attr("height",Lh?E:wg),A.exit().remove())),Ic(_f.data.targets).forEach(function(a){dk[a]=!0})}function Ff(){Ef({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Gf(){if(0!==Nc(_f.data.targets).length){if("mousemove"===$f.event.sourceEvent.type&&Vj.altDomain)return Rg.domain(Vj.altDomain),void Vj.scale(Rg).updateScaleExtent();sj&&Rg.orgDomain()[0]===bk[0]&&Rg.domain([bk[0]-1e-10,Rg.orgDomain()[1]]),Ef({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===$f.event.sourceEvent.type&&(wj=!0)}}function Hf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function If(){Wj.attr("width",yg).attr("height",zg),Wj.select("#"+lj).select("rect").attr("width",ug).attr("height",wg),Wj.select("#"+mj).select("rect").attr("x",G).attr("y",H).attr("width",M).attr("height",N),Wj.select("#"+nj).select("rect").attr("x",I).attr("y",J).attr("width",O).attr("height",P),Wj.select("."+g.zoomRect).attr("width",ug).attr("height",wg),ak.style("max-height",zg+"px")}function Jf(a){return{axisX:a?Gj.x.transition().duration(a):Gj.x,axisY:a?Gj.y.transition().duration(a):Gj.y,axisY2:a?Gj.y2.transition().duration(a):Gj.y2,axisSubX:a?Gj.subx.transition().duration(a):Gj.subx}}function Kf(a){var b;a=a||{},a.withTransition=Qe(a,"withTransition",!0),a.withTransform=Qe(a,"withTransform",!1),a.withLegend=Qe(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&Fh||(b=Jf(a.withTransitionForAxis?qg:0),p(),W(),If(),o(a.withTransition,b)),Ef(a,b)}function Lf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",pd),j=i.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",_c),e=Yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",rd),d=e.enter().append("g").attr("class",rd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",hd).style("cursor",function(a){return sh(a)?"pointer":null}),c=Yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",qd),b=c.enter().append("g").attr("class",qd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",dd),b.append("g").attr("class",ld),b.append("g").attr("class",function(a){return Zc(g.selectedCircles,a.id)}),b.append("g").attr("class",fd).style("cursor",function(a){return sh(a)?"pointer":null}),a.forEach(function(a){Yj.selectAll("."+g.selectedCircles+td(a.id)).selectAll("."+g.selectedCircle).each(function(b){b.value=a.values[b.index].value})}),h=Yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(Ig(a)).attr("class",sd),f=h.enter().append("g").attr("class",sd),f.append("g").attr("class",jd),f.append("text").attr("dy",me(_f.data.targets)?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Bh&&(n=Zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",rd),m=n.enter().append("g").style("opacity",0).attr("class",rd),m.append("g").attr("class",hd),l=Zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",qd),k=l.enter().append("g").style("opacity",0).attr("class",qd),k.append("g").attr("class",dd),k.append("g").attr("class",ld)),Wj.selectAll("."+g.target).filter(function(a){return Lc(a.id)}).transition().duration(qg).style("opacity",1)}function Mf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?he(a.id,b.types[a.id]):he(a.id,b.type)}),_f.data.targets.forEach(function(b){for(var c=0;cf&&(f=(m-l)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=l}var f,h,i=Se(b.textContent,g.legendItem),j=10*Math.ceil((i.width+v)/10),k=10*Math.ceil((i.height+u)/10),l=Mj?k:j,m=Mj?V():U();return d&&(z=0,F=0,w=0,x=0),Fh&&!Mc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=j,C[c]=k,(!w||j>=w)&&(w=j),(!x||k>=x)&&(x=k),h=Mj?x:w,void(Kh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(m-h*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=36,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=$j.selectAll("."+g.legendItemFocused).size();b=b||{},n=Qe(b,"withTransition",!0),q=Qe(b,"withTransitionForTransform",!0),Mj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=$j.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Zc(g.legendItem,a)}).style("visibility",function(a){return Mc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Hh?Hh(a):_f.toggle(a)}).on("mouseover",function(a){$f.select(this).classed(g.legendItemFocused,!0),yj||_f.focus(a),"function"==typeof Ih&&Ih(a)}).on("mouseout",function(a){$f.select(this).classed(g.legendItemFocused,!1),yj||_f.revert(),"function"==typeof Jh&&Jh(a)}),m.append("text").text(function(a){return d(dh[a])?dh[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Mj?h:-200).attr("y",Mj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",Mj?i:-200).attr("y",Mj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Aj).attr("x",Mj?h:-200).attr("y",Mj?-200:j).attr("width",10).attr("height",10),r=$j.selectAll("text").data(a).text(function(a){return d(dh[a])?dh[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=$j.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=$j.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",Aj).attr("x",f).attr("y",j),$j.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Lc(a)}).transition().style("opacity",function(a){var b=$f.select(this);return Lc(a)?!G||b.classed(g.legendItemFocused)?Pf(b):Qf(b):Qj}),S(w),T(x),R(F),p(),W(),If(),o(q,c)}function Wf(a){return Kc(_f.data.targets,a.id)}function Xf(a){return"data"in a&&Kc(_f.data.targets,a.data.id)}function Yf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Zf(a,b,c){var d=!oe(_f.data.targets);yj=!1,he(a,b),Kf(c||{withTransitionForAxis:d})}var $f=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,_f={data:{},axis:{},legend:{}},ag={},bg=i(["bindto"],"#chart"),cg=i(["size","width"]),dg=i(["size","height"]),eg=i(["padding","left"]),fg=i(["padding","right"]),gg=i(["padding","top"]),hg=i(["padding","bottom"]),ig=i(["zoom","enabled"],!1),jg=i(["zoom","extent"]),kg=i(["zoom","privileged"],!1),lg=i(["interaction","enabled"],!0),mg=i(["onenter"],function(){}),ng=i(["onleave"],function(){}),og=i(["onresize"],function(){}),pg=i(["onresized"],function(){}),qg=i(["transition","duration"],350);h("data","data is required in config");var rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng,Og,Pg,Qg,Rg,Sg,Tg,Ug,Vg,Wg,Xg,Yg,Zg,$g,_g=i(["data","x"]),ah=i(["data","xs"],{}),bh=i(["data","x_format"]),ch=i(["data","id_converter"],function(a){return a -}),dh=i(["data","names"],{}),eh=i(["data","classes"],{}),fh=i(["data","groups"],[]),gh=i(["data","axes"],{}),hh=i(["data","type"]),ih=i(["data","types"],{}),jh=i(["data","labels"],{}),kh=i(["data","order"]),lh=i(["data","regions"],{}),mh=i(["data","color"]),nh=i(["data","colors"],{}),oh=i(["data","hide"],!1),ph=i(["data","filter"]),qh=i(["data","selection","enabled"],!1),rh=i(["data","selection","grouped"],!1),sh=i(["data","selection","isselectable"],function(){return!0}),th=i(["data","selection","multiple"],!0),uh=i(["data","onclick"],function(){}),vh=i(["data","onenter"],function(){}),wh=i(["data","onleave"],function(){}),xh=i(["data","onselected"],function(){}),yh=i(["data","onunselected"],function(){}),zh=i(["data","ondragstart"],function(){}),Ah=i(["data","ondragend"],function(){}),Bh=i(["subchart","show"],!1),Ch=i(["subchart","size","height"],60),Dh=i(["color","pattern"],[]),Eh=i(["color","threshold"],{}),Fh=i(["legend","show"],!0),Gh=i(["legend","position"],"bottom"),Hh=i(["legend","item","onclick"]),Ih=i(["legend","item","onmouseover"]),Jh=i(["legend","item","onmouseout"]),Kh=i(["legend","equally"],!1),Lh=i(["axis","rotated"],!1),Mh=i(["axis","x","show"],!0),Nh=i(["axis","x","type"],"indexed"),Oh=i(["axis","x","localtime"],!0),Ph=i(["axis","x","categories"],[]),Qh=i(["axis","x","tick","centered"],!1),Rh=i(["axis","x","tick","format"]),Sh=i(["axis","x","tick","culling"],{}),Th=i(["axis","x","tick","culling","max"],10),Uh=i(["axis","x","tick","count"]),Vh=i(["axis","x","tick","fit"],!0),Wh=i(["axis","x","tick","values"],null),Xh=i(["axis","x","tick","rotate"]),Yh=i(["axis","x","max"],null),Zh=i(["axis","x","min"],null),$h=i(["axis","x","padding"],{}),_h=i(["axis","x","height"]),ai=i(["axis","x","default"]),bi=i(["axis","x","label"],{}),ci=i(["axis","y","show"],!0),di=i(["axis","y","max"]),ei=i(["axis","y","min"]),fi=i(["axis","y","center"]),gi=i(["axis","y","label"],{}),hi=i(["axis","y","inner"],!1),ii=i(["axis","y","tick","format"]),ji=i(["axis","y","padding"]),ki=i(["axis","y","ticks"],10),li=i(["axis","y2","show"],!1),mi=i(["axis","y2","max"]),ni=i(["axis","y2","min"]),oi=i(["axis","y2","center"]),pi=i(["axis","y2","label"],{}),qi=i(["axis","y2","inner"],!1),ri=i(["axis","y2","tick","format"]),si=i(["axis","y2","padding"]),ti=i(["axis","y2","ticks"],10),ui=i(["grid","x","show"],!1),vi=i(["grid","x","type"],"tick"),wi=i(["grid","x","lines"],[]),xi=i(["grid","y","show"],!1),yi=i(["grid","y","lines"],[]),zi=i(["grid","y","ticks"],10),Ai=i(["point","show"],!0),Bi=i(["point","r"],2.5),Ci=i(["point","focus","line","enabled"],!0),Di=i(["point","focus","expand","enabled"],!0),Ei=i(["point","focus","expand","r"]),Fi=i(["point","focus","select","r"]),Gi=i(["line","connect_null"],!1),Hi=i(["bar","width"]),Ii=i(["bar","width","ratio"],.6),Ji=i(["pie","label","show"],!0),Ki=i(["pie","label","format"]),Li=i(["pie","expand"],!0),Mi=i(["pie","onclick"],function(){}),Ni=i(["pie","onmouseover"],function(){}),Oi=i(["pie","onmouseout"],function(){}),Pi=i(["gauge","label","show"],!0),Qi=i(["gauge","label","format"]),Ri=i(["gauge","min"],0),Si=i(["gauge","max"],100),Ti=i(["gauge","onclick"],function(){}),Ui=i(["gauge","onmouseover"],function(){}),Vi=i(["gauge","onmouseout"],function(){}),Wi=i(["gauge","units"]),Xi=i(["gauge","width"]),Yi=i(["donut","label","show"],!0),Zi=i(["donut","label","format"]),$i=i(["donut","expand"],!0),_i=i(["donut","title"],""),aj=i(["donut","onclick"],function(){}),bj=i(["donut","onmouseover"],function(){}),cj=i(["donut","onmouseout"],function(){}),dj=i(["regions"],[]),ej=i(["tooltip","show"],!0),fj=i(["tooltip","format","title"]),gj=i(["tooltip","format","value"]),hj=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k,l=fj?fj:b,m=gj?gj:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=m(a[f].value,a[f].ratio,a[f].id,a[f].index),k=Bj?Bj(a[f].value):d(a[f].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),ij=i(["tooltip","init","show"],!1),jj=i(["tooltip","init","x"],0),kj=i(["tooltip","init","position"],{top:"0px",left:"50px"}),lj="c3-"+ +new Date+"-clip",mj=lj+"-xaxis",nj=lj+"-yaxis",oj=j(lj),pj=j(mj),qj=j(nj),rj="timeseries"===Nh,sj="categorized"===Nh,tj=!rj&&(_g||Me(ah)),uj=null,vj=!1,wj=!1,xj=!1,yj=!1,zj=$f.scale.category10().range(),Aj=Fe(nh,Me(Dh)?Dh:zj,mh),Bj=Me(Eh)?Ge(Dh,Eh):null,Cj=Oh?$f.time.format:$f.time.format.utc,Dj=Cj.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}]]),Ej=[],Fj=[],Gj={},Hj=Lh?"left":"bottom",Ij=Lh?hi?"top":"bottom":hi?"right":"left",Jj=Lh?qi?"bottom":"top":qi?"left":"right",Kj=Lh?"left":"bottom",Lj={main:function(){return"translate("+k(rg.left)+","+k(rg.top)+")"},context:function(){return"translate("+k(sg.left)+","+k(sg.top)+")"},legend:function(){return"translate("+tg.left+","+tg.top+")"},x:function(){return"translate(0,"+(Lh?0:wg)+")"},y:function(){return"translate(0,"+(Lh?wg:0)+")"},y2:function(){return"translate("+(Lh?0:ug)+","+(Lh?1:0)+")"},subx:function(){return"translate(0,"+(Lh?0:xg)+")"},arc:function(){return"translate("+Dg/2+","+Eg/2+")"}},Mj="right"===Gh,Nj=0,Oj=0,Pj=0,Qj=.15,Rj=30,Sj=Lh&&!Mh?0:30,Tj=5;Ig=$f.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Uj,Vj=function(){};Uj=$f.svg.brush().on("brush",Ff),Uj.update=function(){return Zj&&Zj.select("."+g.brush).call(this),this},Uj.scale=function(a){return Lh?this.y(a):this.x(a)},ig&&(Vj=$f.behavior.zoom().on("zoomstart",function(){Vj.altDomain=$f.event.sourceEvent.altKey?Rg.orgDomain():null}).on("zoom",ig?Gf:null),Vj.scale=function(a){return Lh?this.y(a):this.x(a)},Vj.orgScaleExtent=function(){var a=jg?jg:[1,10];return[a[0],Math.max(Fc()/a[1],a[1])]},Vj.updateScaleExtent=function(){var a=gc(Rg.orgDomain())/gc(bk),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Wj,Xj,Yj,Zj,$j,_j,ak,bk,ck,dk={};if(_f.focus=function(a){function b(a){Nc(a).transition().duration(100).style("opacity",1)}var c=Wj.selectAll(ud(a)),d=c.filter(Wf),e=c.filter(Xf);_f.revert(),_f.defocus(),b(d.classed(g.focused,!0)),b(e),oe(_f.data.targets)&&Sb(a,!0),Rf(a,!0)},_f.defocus=function(a){function b(a){Nc(a).transition().duration(100).style("opacity",.3)}var c=Wj.selectAll(ud(a)),d=c.filter(Wf),e=c.filter(Xf);_f.revert(),b(d.classed(g.focused,!1)),b(e),oe(_f.data.targets)&&Tb(a),Rf(a,!1)},_f.revert=function(a){function b(a){Nc(a).transition().duration(100).style("opacity",1)}var c=Wj.selectAll(ud(a)),d=c.filter(Wf),e=c.filter(Xf);b(d.classed(g.focused,!1)),b(e),oe(_f.data.targets)&&Tb(a),Sf()},_f.show=function(a,b){a=Jc(a),b=b||{},Rc(a),Wj.selectAll(vd(a)).transition().style("opacity",1),b.withLegend&&Tf(a),Ef({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},_f.hide=function(a,b){a=Jc(a),b=b||{},Qc(a),Wj.selectAll(vd(a)).transition().style("opacity",0),b.withLegend&&Uf(a),Ef({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},_f.toggle=function(a){Lc(a)?_f.hide(a):_f.show(a)},_f.unzoom=function(){Uj.clear().update(),Ef({withUpdateXDomain:!0})},_f.load=function(a){return a.xs&&tc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){eh[b]=a.classes[b]}),"categories"in a&&sj&&(Ph=a.categories,Xg.categories(Ph)),"cacheIds"in a&&hc(a.cacheIds)?void Mf(jc(a.cacheIds),a.done):void("unload"in a?Of(Jc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Nf(a)}):Nf(a))},_f.unload=function(a,b){Of(Jc(a),function(){Ef({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},_f.selected=function(a){return $f.merge(Yj.selectAll("."+g.shapes+td(a)).selectAll("."+g.shape).filter(function(){return $f.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},_f.select=function(a,b,c){qh&&Yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=$f.select(this),i=e.data?e.data.id:e.id,j=_e(this),k=rh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?sh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},_f.unselect=function(a,b){qh&&Yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=$f.select(this),f=c.data?c.data.id:c.id,h=_e(this),i=rh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&sh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},_f.toLine=function(a){Zf(a,"line")},_f.toSpline=function(a){Zf(a,"spline")},_f.toBar=function(a){Zf(a,"bar")},_f.toScatter=function(a){Zf(a,"scatter")},_f.toArea=function(a){Zf(a,"area")},_f.toAreaSpline=function(a){Zf(a,"area-spline")},_f.toPie=function(a){Zf(a,"pie",{withTransform:!0})},_f.toDonut=function(a){Zf(a,"donut",{withTransform:!0})},_f.groups=function(a){return c(a)?fh:(fh=a,Ef(),fh)},_f.xgrids=function(a){return a?(wi=a,Ef(),wi):wi},_f.xgrids.add=function(a){return a?_f.xgrids(wi.concat(a)):void 0},_f.xgrids.remove=function(a){var b=Yf(a);return _f.xgrids(wi.filter(b))},_f.ygrids=function(a){return a?(yi=a,Ef(),yi):yi},_f.ygrids.add=function(a){return a?_f.ygrids(yi.concat(a)):void 0},_f.ygrids.remove=function(a){var b=Yf(a);return _f.ygrids(yi.filter(b))},_f.regions=function(a){return a?(dj=a,Ef(),dj):dj},_f.regions.add=function(a){return a?(dj=dj.concat(a),Ef(),dj):dj},_f.regions.remove=function(a){var b,c,d;return a=a||{},b=Qe(a,"duration",qg),c=Qe(a,"classes",[g.region]),d=Yj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),dj=dj.filter(function(a){var b=!1;return a.class?(a.class.split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0})},_f.data.get=function(a){var b=_f.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},_f.data.getAsTarget=function(a){var b=_f.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},_f.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){dh[b]=a[b]}),Ef({withLegend:!0}),dh):dh},_f.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){nh[b]=a[b]}),Ef({withLegend:!0}),nh):nh},_f.x=function(a){return arguments.length&&(wc(_f.data.targets,a),Ef({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),_f.data.xs},_f.xs=function(a){return arguments.length&&(xc(_f.data.targets,a),Ef({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),_f.data.xs},_f.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){hb(b,a[b])}),Jb())},_f.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Yh=+a.x),b(a.y)&&(di=+a.y),b(a.y2)&&(mi=+a.y2)):di=mi=+a,Ef({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},_f.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Zh=+a.x),b(a.y)&&(ei=+a.y),b(a.y2)&&(ni=+a.y2)):ei=ni=+a,Ef({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},_f.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&_f.axis.max(a.max),"undefined"!=typeof a.min&&_f.axis.min(a.min))},_f.legend.show=function(a){Tf(Jc(a)),Ef({withLegend:!0})},_f.legend.hide=function(a){Uf(Jc(a)),Ef({withLegend:!0})},_f.resize=function(a){cg=a?a.width:null,dg=a?a.height:null,_f.flush(),_f.flush()},_f.flush=function(){Kf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},_f.destroy=function(){_f.data.targets=void 0,_f.data.xs={},ak.classed("c3",!1).html(""),a.onresize=null},"url"in f.data)$f.xhr(f.data.url,function(a,b){var c,d=$f.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=$f.csv.parse(b.response),wf(c)});else if("rows"in f.data)wf(zc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");wf(Ac(f.data.columns))}return _f},"function"==typeof define&&define.amd?define("c3",["d3"],f):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=f:a.c3=f}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=bk.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=bk.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=bk.select("."+g.axisY2),a&&(e=e.transition())),bk.attr("transform",Qj.main),c.attr("transform",Qj.x),d.attr("transform",Qj.y),e.attr("transform",Qj.y2),bk.select("."+g.chartArcs).attr("transform",Qj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=ck.select("."+g.axisX),a&&(c=c.transition())),ck.attr("transform",Qj.context),c.attr("transform",Qj.subx)}function n(a){(a?dk.transition():dk).attr("transform",Qj.legend)}function o(a,b){l(a,b),Gh&&m(a,b),n(a)}function p(){var a=V(),b=U(),c=Rj?0:a,d=se(eg.data.targets),e=Qh||d?0:A("x"),f=Gh&&!d?Hh+e:0;Dg=t(),Eg=u(),Qh?(wg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},xg={top:wg.top,right:0/0,bottom:20+c,left:Wj}):(wg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},xg={top:Eg-f-c,right:0/0,bottom:e+c,left:wg.left}),yg={top:Rj?0:Eg-a,right:0/0,bottom:0,left:Rj?Dg-b:0},zg=Dg-wg.left-wg.right,Bg=Eg-wg.top-wg.bottom,0>zg&&(zg=0),0>Bg&&(Bg=0),Ag=Qh?wg.left-Wj-Xj:zg,Cg=Qh?Bg:Eg-xg.top-xg.bottom,0>Ag&&(Ag=0),0>Cg&&(Cg=0),Ig=zg-(Rj?b+10:0),Jg=Bg-(Rj?0:10),r(),Rj&&d&&(yg.left=Ig/2+1.1*Gg)}function q(){bk.select("line."+g.xgridFocus).attr("x1",Qh?0:-10).attr("x2",Qh?zg:-10).attr("y1",Qh?-10:wg.top).attr("y2",Qh?-10:Bg)}function r(){var a;Gg=Math.min(Ig,Jg)/2,Fg=.95*Gg,a=aj?(Fg-aj)/Fg:.6,Hg=re(eg.data.targets)||qe(eg.data.targets)?Fg*a:0}function s(){var a=Qh?g.axisX:g.axisY,b=bk.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=fk.node().getBoundingClientRect(),e=se(eg.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return hg?hg:C()}function u(){var a=ig?ig:D();return a>0?a:320}function v(){return lg?lg:0}function w(){return mg?mg:0}function x(){return jg?jg:Qh?Rh?Math.max(We(z("x")),40):1:!hi||mi?1:We(z("y"))}function y(){var a=10,b=Rj?U()+20:0;return kg?kg:Qh?a+b:(!qi||vi?a:We(z("y2")))+b}function z(a){var b=pb(a);return b.isInner?20+Ib(a):40+Ib(a)}function A(a){return"x"!==a||Rh?"x"===a&&ei?ei:"y"!==a||hi?"y2"!==a||qi?(pb(a).isInner?30:40)+("y2"===a?-10:0):Yj:Kh&&!Rj?10:1:0}function B(a){for(var b,c=fk.node();c&&"BODY"!==c.tagName&&!(b=c.getBoundingClientRect()[a]);)c=c.parentNode;return b}function C(){return B("width")}function D(){var a=fk.style("height");return a.indexOf("px")>0?+a.replace("px",""):0}function E(a){return a?-31:-(wg.left-1)}function F(a){return a?-20:-4}function G(){return E(!Qh)}function H(){return F(!Qh)}function I(){return E(Qh)}function J(){return F(Qh)}function K(a){return a?zg+2+30+30:wg.left+20}function L(a){return a?(ei?ei:0)+80:Bg+8}function M(){return K(!Qh)}function N(){return L(!Qh)}function O(){return K(Qh)}function P(){return L(Qh)}function Q(){var a,b,c,d,e,f,g=Kc(eg.data.targets);return g?(a=g.values[0],b=g.values[g.values.length-1],c=Wg(b.x)-Wg(a.x),0===c?Qh?Bg:zg:(d=Jc(),e=ne(eg.data.targets)?(d-(xj?.25:1))/d:1,f=d>1?c*e/(d-1):c,1>f?1:f)):0}function R(a){Sj=a}function S(a){Tj=a}function T(a){Uj=a}function U(){return Kh?Rj?Tj*(Sj+1):Dg:0}function V(){return Kh?Rj?Eg:Uj*(Sj+1):0}function W(){var a,b,c=!Wg;Og=Qh?1:0,Pg=Qh?Bg:zg,Qg=Qh?0:Bg,Rg=Qh?zg:1,Sg=Og,Tg=Pg,Ug=Qh?0:Cg,Vg=Qh?Ag:1,Wg=Z(Og,Pg,c?void 0:Wg.domain(),function(){return ah.tickOffset()}),Xg=$(Qg,Rg,c?void 0:Xg.domain()),Yg=$(Qg,Rg,c?void 0:Yg.domain()),Zg=Z(Og,Pg,gk,function(a){return a%1?0:dh.tickOffset()}),$g=$(Ug,Vg,c?void 0:$g.domain()),_g=$(Ug,Vg,c?void 0:_g.domain()),a=eb(),b=_h?_h:c?void 0:ah.tickValues(),ah=bb(Wg,Mj,a,b),dh=bb(Zg,Pj,a,b),bh=cb(Xg,Nj,ni,pi),ch=cb(Yg,Oj,wi,yi),c||(Zj.scale(Zg),ng&&$j.scale(Wg)),X()}function X(){Kg=Lb(),Lg=Mb(),Mg=Mb(.98)}function Y(a,b,c){return(c?dg.time.scale():dg.scale.linear()).range([a,b])}function Z(a,b,c,d){var e,f=Y(a,b,wj),g=c?f.domain(c):f;xj?(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 gk&&gk[0]===a[0]&&gk[1]a?a.toFixed(0):a};return Wh&&("function"==typeof Wh?a=Wh:wj&&(a=function(a){return a?Hj(Wh)(a):""})),a}function fb(a){var b;return"y"===a?b=li:"y2"===a?b=ui:"x"===a&&(b=gi),b}function gb(a){var b=fb(a);return"string"==typeof b?b:b?b.text:null}function hb(a,b){var c=fb(a);"string"==typeof c?"y"===a?li=b:"y2"===a?ui=b:"x"===a&&(gi=b):c&&(c.text=b)}function ib(a){return 10*Math.sin(Math.PI*(a/180))}function jb(a){return 11.5-2.5*(a/15)}function kb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",jb(c)).attr("x",ib(c)).attr("transform","rotate("+c+")")}function lb(a,b){var c=fb(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function mb(){return lb("x",Qh?"inner-top":"inner-right")}function nb(){return lb("y",Qh?"inner-right":"inner-top")}function ob(){return lb("y2",Qh?"inner-right":"inner-top")}function pb(a){return"y2"===a?ob():"y"===a?nb():mb()}function qb(){return gb("x")}function rb(){return gb("y")}function sb(){return gb("y2")}function tb(a,b){return a?b.isLeft?0:b.isCenter?zg/2:zg:b.isBottom?-Bg:b.isMiddle?-Bg/2:0}function ub(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function vb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function wb(){return tb(!Qh,mb())}function xb(){return tb(Qh,nb())}function yb(){return tb(Qh,ob())}function zb(){return ub(!Qh,mb())}function Ab(){return ub(Qh,nb())}function Bb(){return ub(Qh,ob())}function Cb(){var a=mb();return Qh?a.isInner?"1.2em":-25-Ib("x"):a.isInner?"-0.5em":ei?ei-10:"3em"}function Db(){var a=nb();return Qh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Ib("y")}function Eb(){var a=ob();return Qh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Ib("y2")}function Fb(){return vb(!Qh,mb())}function Gb(){return vb(Qh,nb())}function Hb(){return vb(Qh,ob())}function Ib(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return dg.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Jb(a){var b=bk.select("."+g.axisX+" ."+g.axisXLabel),c=bk.select("."+g.axisY+" ."+g.axisYLabel),d=bk.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",wb).attr("dx",zb).attr("dy",Cb).text(qb),(a?c.transition():c).attr("x",xb).attr("dx",Ab).attr("dy",Db).attr("dy",Db).text(rb),(a?d.transition():d).attr("x",yb).attr("dx",Bb).attr("dy",Eb).text(sb)}function Kb(a){var b=!1;if(Ng(Rc(eg.data.targets)).forEach(function(c){b||c.data.id!==a.data.id||(b=!0,a=c)}),isNaN(a.endAngle)&&(a.endAngle=a.startAngle),Ae(a.data)){var c=Wi,d=Xi,e=Math.abs(c)+d,f=Math.PI/e;a.startAngle=-1*(Math.PI/2)+f*Math.abs(c),a.endAngle=a.startAngle+f*(a.value>d?d:a.value)}return b?a:null}function Lb(){var a=dg.svg.arc().outerRadius(Fg).innerRadius(Hg),b=function(b,c){var d;return c?a(b):(d=Kb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Mb(a){var b=dg.svg.arc().outerRadius(Gg*(a?a:1)).innerRadius(Hg);return function(a){var c=Kb(a);return c?b(c):"M 0 0"}}function Nb(a,b,c){return c||Ce(a.data)?Kg(a,b):"M 0 0"}function Ob(a){var b,c,d,e,f,g=Kb(a),h="";return g&&!qe(eg.data.targets)&&(b=Kg.centroid(g),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),f=(36/Fg>.375?1.175-36/Fg:.8)*Fg/e,h="translate("+c*f+","+d*f+")"),h}function Pb(a){var b=qe(eg.data.targets)?Math.PI:2*Math.PI;return a?(a.endAngle-a.startAngle)/b:null}function Qb(a){return yc({id:a.data.id,value:a.value,ratio:Pb(a)})}function Rb(a){var b,c,d,e;return Ub()?(b=Kb(a),c=b?b.value:null,d=Pb(b),e=Vb(),e?e(c,d):Md(c,d)):""}function Sb(a,b){var c=_j.selectAll("."+g.chartArc+yd(a)),d=_j.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});Ie(a)&&c.selectAll("path").transition().duration(50).attr("d",Lg).transition().duration(100).attr("d",Mg).each(function(a){Be(a.data)}),b||d.style("opacity",.3)}function Tb(a){var b=_j.selectAll("."+g.chartArc+yd(a));b.selectAll("path."+g.arc).transition().duration(50).attr("d",Kg),_j.selectAll("."+g.arc).style("opacity",1)}function Ub(){var a=!0;return re(eg.data.targets)?a=bj:pe(eg.data.targets)&&(a=Oi),a}function Vb(){var a=Pi;return qe(eg.data.targets)?a=Vi:re(eg.data.targets)&&(a=cj),a}function Wb(){return re(eg.data.targets)?ej:""}function Xb(){var a=Ri;return qe(eg.data.targets)?a=Yi:re(eg.data.targets)&&(a=fj),"function"==typeof a?a:function(){}}function Yb(){var a=Si;return qe(eg.data.targets)?a=Zi:re(eg.data.targets)&&(a=gj),"function"==typeof a?a:function(){}}function Zb(){var a=Ti;return qe(eg.data.targets)?a=$i:re(eg.data.targets)&&(a=hj),"function"==typeof a?a:function(){}}function $b(a,c,d,e){var f="ratio"===a.unit?e:1;return b(a[c])?a[c]*f:d}function _b(a){var b,c,d,e,f,g,h=Mc(a),i=Yc(a);if(kh.length>0)for(g=$c(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return dg.min(Object.keys(i).map(function(a){return dg.min(i[a])}))}function ac(a){var b,c,d,e,f,g,h=Mc(a),i=Yc(a);if(kh.length>0)for(g=_c(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return dg.max(Object.keys(i).map(function(a){return dg.max(i[a])}))}function bc(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return db(a.id)===c}),m="y2"===c?si:ji,n="y2"===c?ri:ii,o=b(m)?m:_b(l),p=b(n)?n:ac(l),q="y2"===c?ti:ki,r=Gd()&&Qh;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=Hd(o,p),j=hc(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&&oi&&(f=$b(oi,"top",e,d),g=$b(oi,"bottom",e,d)),"y2"===c&&xi&&(f=$b(xi,"top",e,d),g=$b(xi,"bottom",e,d)),ne(l)&&!$c(l)&&(g=o),[o-g,p+f])}function cc(a){return ci?wj?Le(ci):ci:dg.min(a,function(a){return dg.min(a.values,function(a){return a.x})})}function dc(a){return bi?wj?Le(bi):bi:dg.max(a,function(a){return dg.max(a.values,function(a){return a.x})})}function ec(a){var c,d,e,f,g=Lc(a),h=g[1]-g[0];return xj?d=0:ne(a)?(c=Jc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof di&&Qe(di)?(e=b(di.left)?di.left:d,f=b(di.right)?di.right:d):e=f="number"==typeof di?di:d,{left:e,right:f}}function fc(a){var b=[cc(a),dc(a)],c=b[0],d=b[1],e=ec(a),f=0,g=0;return c-d!==0||xj||(c=wj?new Date(.5*c.getTime()):-.5,d=wj?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=wj?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=wj?new Date(d.getTime()+e.right):d+e.right),[f,g]}function gc(a,b,c){c&&(Wg.domain(dg.extent(fc(a))),gk=Wg.domain(),ng&&$j.scale(Wg).updateScaleExtent(),Zg.domain(Wg.domain()),Zj.scale(Zg)),b&&(Wg.domain(Zj.empty()?gk:Zj.extent()),ng&&$j.scale(Wg).updateScaleExtent())}function hc(a){return a[1]-a[0]}function ic(a){for(var b=0;bb?0:b-c}function oc(a){var b,c=mc(a),d="y"===a.axis?Xg:Yg;return b="y"===a.axis||"y2"===a.axis?Qh?Bg:"start"in a?d(a.start):Bg:Qh?"end"in a?Wg(wj?Le(a.end):a.end):Bg:Bg,c>b?0:b-c}function pc(a){return eh&&a===eh||Qe(fh)&&Re(fh,a)}function qc(a){return!pc(a)}function rc(a){return eh?eh:Qe(fh)?fh[a]:null}function sc(a,b){var c,d=b&&Qe(b)?Mc(b):[];return d.forEach(function(b){rc(b)===a&&(c=eg.data.xs[b])}),c}function tc(a,b){return a in eg.data.xs&&eg.data.xs[a]&&eg.data.xs[a][b]?eg.data.xs[a][b]:b}function uc(){var a=Object.keys(eg.data.xs);return a.length?eg.data.xs[a[0]]:null}function vc(a){var b=uc();return b&&a=0?eg.data.xs[d]=(c&&eg.data.xs[d]?eg.data.xs[d]:[]).concat(a.map(function(a){return a[e]}).filter(b).map(function(a,b){return Cc(a,d,b)})):eh?eg.data.xs[d]=uc():Qe(fh)&&(eg.data.xs[d]=sc(e,eg.data.targets)):eg.data.xs[d]=a.map(function(a,b){return b})}),e.forEach(function(a){if(!eg.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),d=e.map(function(b,c){var d=hh(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=rc(b),g=a[f],h=Cc(g,b,e);return yj&&xj&&0===c&&g&&(0===e&&(Uh=[]),Uh.push(g)),("undefined"==typeof a[b]||eg.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})}}),d.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),mh&&le(Mc(d).filter(function(a){return!(a in nh)}),mh),d.forEach(function(a){jc(a.id_org,a)}),d}function Gc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function Hc(a){var b=zc(eg.data.targets[0].values,a-1);return b?b.x:null}function Ic(a){var b=zc(eg.data.targets[0].values,a+1);return b?b.x:null}function Jc(){return dg.max(eg.data.targets,function(a){return a.values.length})}function Kc(a){var b,c=a.length,d=0;return c>1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Lc(a){var b,c,d=Kc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Mc(a){return a.map(function(a){return a.id})}function Nc(a){return a?"string"==typeof a?[a]:a:Mc(eg.data.targets)}function Oc(a,b){var c,d=Mc(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(wj?new Date(i):i);j.push(e)}return wj||(j=j.sort(function(a,b){return a-b})),j}function Uc(a){Jj=Jj.concat(a)}function Vc(a){Jj=Jj.filter(function(b){return a.indexOf(b)<0})}function Wc(a){Kj=Kj.concat(a)}function Xc(a){Kj=Kj.filter(function(b){return a.indexOf(b)<0})}function Yc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Zc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function _c(a){return Zc(a,function(a){return a>0})}function ad(a){return a=0&&d===a[c].x;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(Sd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Sd(a,g))),Vd(e,b)):Td(a,b,f,g)}function Ud(a,b){var c;return c=a.map(function(a){return Td(a.values,b)}),Vd(c,b)}function Vd(a,b){var c,d;return a.forEach(function(a){var e=Se(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Wd(a,b){return dg.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Xd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Yd(){return ph&&"desc"===ph.toLowerCase()}function Zd(){return ph&&"asc"===ph.toLowerCase()}function $d(a){var b=Zd(),c=Yd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof ph&&a.sort(ph),a}function _d(a,c){var d,e,f,g,h,i,j,k=se(eg.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&jj&&(ek.html(mj(a,eb(),Id(k),Fj)).style("display","block"),d=ek.property("offsetWidth"),e=ek.property("offsetHeight"),k?(g=zg/2+c[0],i=Bg/2+c[1]+20):(Qh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Wg(l[0].x)+20):(f=s(),g=f+x()+Wg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=h-j),i+e>u()&&(i-=e+30)),ek.style("top",i+"px").style("left",g+"px"))}function ae(){ek.style("display","none")}function be(a){var c=a.filter(function(a){return a&&b(a.value)});if(jj&&!oe(eg.data.targets)&&!se(eg.data.targets)){var d=bk.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(Qh?"y1":"x1",Od).attr(Qh?"y2":"x2",Od),If(d,"grid")}}function ce(){bk.select("line."+g.xgridFocus).style("visibility","hidden")}function de(a,b){var c,d,e,f,h=[],i=bk.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=fc(),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 ee(a){var b,d,e={},f=0;return Rc(eg.data.targets.filter(a)).forEach(function(a){for(b=0;b0&&(i+=g(c.values[f].value)-h)}),i}}function ie(a){return a.x||0===a.x?Wg(a.x):null}function je(a,b){var c=ee(te),d=yf(c);return kh.length>0?d(a,b)[0][1]:_(a.id)(a.value)}function ke(a,b){return"number"==typeof Mi?Mi:b?2*a.tickOffset()*Ni/b:0}function le(a,b){Nc(a).forEach(function(a){ik[a]=b===nh[a],nh[a]=b}),a||(mh=b)}function me(a,b){var c=!1;return a.forEach(function(a){nh[a.id]===b&&(c=!0),a.id in nh||"line"!==b||(c=!0)}),c}function ne(a){return me(a,"bar")}function oe(a){return me(a,"scatter")}function pe(a){return"pie"===mh||me(a,"pie")}function qe(a){return me(a,"gauge")}function re(a){return"donut"===mh||me(a,"donut")}function se(a){return pe(a)||re(a)||qe(a)}function te(a){var b="string"==typeof a?a:a.id;return!(b in nh)||["line","spline","area","area-spline","step","area-step"].indexOf(nh[b])>=0}function ue(a){var b="string"==typeof a?a:a.id;return["step","area-step"].indexOf(nh[b])>=0}function ve(a){var b="string"==typeof a?a:a.id;return["spline","area-spline"].indexOf(nh[b])>=0}function we(a){var b="string"==typeof a?a:a.id;return["area","area-spline","area-step"].indexOf(nh[b])>=0}function xe(a){var b="string"==typeof a?a:a.id;return"bar"===nh[b]}function ye(a){var b="string"==typeof a?a:a.id;return"scatter"===nh[b]}function ze(a){var b="string"==typeof a?a:a.id;return"pie"===nh[b]}function Ae(a){var b="string"==typeof a?a:a.id;return"gauge"===nh[b]}function Be(a){var b="string"==typeof a?a:a.id;return"donut"===nh[b]}function Ce(a){return ze(a)||Be(a)||Ae(a)}function De(a){return te(a)?[a]:[]}function Ee(a){return Ce(a.data)?[a]:[]}function Fe(a){return xe(a)?a.values:[]}function Ge(a){return te(a)||ye(a)?a.values:[]}function He(a){return xe(a)||te(a)?a.values:[]}function Ie(a){return Be(a)&&dj||ze(a)&&Qi}function Je(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 Ke(a,b){var c="value"===b.unit,d=b.values&&b.values.length?b.values:[],e=b.max||100;return function(b){var f,g,h=a[a.length-1];for(f=0;f0}function Re(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Se(a,b){var c="y"===db(a.id)?Xg:Yg,d=Qh?1:0,e=Qh?0:1;return Math.pow(Wg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Te(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ue(){var a=[],b=function(b,c){var d=setInterval(function(){var b=0;a.forEach(function(a){if(a.empty())return void(b+=1);try{a.transition()}catch(c){b+=1}}),b===a.length&&(clearInterval(d),c&&c())},10)};return b.add=function(b){a.push(b)},b}function Ve(a,b,c){return d(a[b])?a[b]:c}function We(a){return 10*Math.ceil(a/10)}function Xe(a,b){var c;return dg.select("body").selectAll(".dummy").data([a]).enter().append("text").classed(b?b:"",!0).text(a).each(function(){c=this.getBoundingClientRect()}).remove(),c}function Ye(a){return ve(a)?"cardinal":ue(a)?"step-after":"linear" +}function Ze(a,b,c){Ch(b,a.node()),bk.select("."+g.selectedCircles+xd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return bd(g.selectedCircle,c)}).attr("cx",Qh?je:ie).attr("cy",Qh?ie:je).attr("stroke",function(){return Fj(b)}).attr("r",1.4*jf(b)).transition().duration(100).attr("r",jf)}function $e(a,b,c){Dh(b,a.node()),bk.select("."+g.selectedCircles+xd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function _e(a,b,c,d){a?Ze(b,c,d):$e(b,c,d)}function af(a,b){Ch(b,a.node()),a.transition().duration(100).style("fill",function(){return dg.rgb(Fj(b)).brighter(.75)})}function bf(a,b){Dh(b,a.node()),a.transition().duration(100).style("fill",function(){return Fj(b)})}function cf(a,b,c,d){a?af(b,c,d):bf(b,c,d)}function df(a,b,c,d){cf(a,b,c.data,d)}function ef(a){return"circle"===a.nodeName?_e:dg.select(a).classed(g.bar)?cf:df}function ff(a){return a.filter(function(a){return b(a.value)})}function gf(a){return Fi&&!ue(a)?"function"==typeof Gi?Gi(a):Gi:0}function hf(a){return Ii?Ji?Ji:1.75*gf(a):gf(a)}function jf(a){return Ki?Ki:4*gf(a)}function kf(a,c){return(c?bk.selectAll("."+g.circles+xd(c)):bk).selectAll("."+g.circle+(b(a)?"-"+a:""))}function lf(a,b){kf(a,b).classed(g.EXPANDED,!0).attr("r",hf)}function mf(a){kf(a).filter(function(){return dg.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",gf)}function nf(a){return bk.selectAll("."+g.bar+(b(a)?"-"+a:""))}function of(a){nf(a).classed(g.EXPANDED,!0)}function pf(a){nf(a).classed(g.EXPANDED,!1)}function qf(a,b){var c=dg.svg.area(),d=wf(a,b),e=b?ab:_,f=function(a,b){return kh.length>0?d(a,b)[0][1]:e(a.id)(0)},g=function(a,b){return kh.length>0?d(a,b)[1][1]:e(a.id)(a.value)};return c=Qh?c.x0(f).x1(g).y(Od):c.x(Od).y0(f).y1(g),function(a){var b,d,e=ff(a.values);return we(a)?c.interpolate(Ye(a))(e):(b=Wg(e[0].x),d=_(a.id)(e[0].value),Qh?"M "+d+" "+b:"M "+b+" "+d)}}function rf(a,b){var c=dg.svg.line(),d=yf(a,b),e=b?ab:_,f=b?Rd:Od,g=function(a,b){return kh.length>0?d(a,b)[0][1]:e(a.id)(a.value)};return c=Qh?c.x(g).y(f):c.x(f).y(g),Li||(c=c.defined(function(a){return null!=a.value})),function(a){var d=Li?ff(a.values):a.values,f=b?f:Zg,g=e(a.id),h=0,i=0;return te(a)?qh[a.id]?zf(d,f,g,qh[a.id]):c.interpolate(Ye(a))(d):(d[0]&&(h=f(d[0].x),i=g(d[0].value)),Qh?"M "+i+" "+h:"M "+h+" "+i)}}function sf(a,b){var c=xf(a,b);return function(a,b){var d=c(a,b),e=Qh?1:0,f=Qh?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function tf(a,b){var c=xf(a,!1),d=b?uf:vf;return function(a,b){return d(c(a,b),a,this)}}function uf(a,b){var c;return Qh?(c=xe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function vf(a,b,c){var d=c.getBoundingClientRect();return Qh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:xe(b)?-3:-6)}function wf(a,b){var c=a.__max__+1,d=fe(0,c,a,!!b),e=ge(!!b),f=he(we,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Qh&&(0j||a.value<0&&j>c)&&(j=c),[[i,h],[i,j-(c-h)]]}}function xf(a,b){var c=a.__max__+1,d=ke(ah,c),e=fe(d,c,a,!!b),f=ge(!!b),g=he(xe,a,!!b),h=b?ab:_;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Qh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function yf(a,b){var c=a.__max__+1,d=fe(0,c,a,!!b),e=ge(!!b),f=he(te,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Qh&&(0j||a.value<0&&j>c)&&(j=c),[[i,j-(c-h)]]}}function zf(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 Af(b){var c=new MutationObserver(function(d){d.forEach(function(d){if("childList"===d.type&&d.previousSibling){c.disconnect();var e=a.setInterval(function(){b.node().parentNode&&(a.clearInterval(e),Jf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransition:!1,withTransitionForTransform:!1,withLegend:!0}),b.transition().style("opacity",1))},10)}})});c.observe(b.node(),{attributes:!0,childList:!0,characterData:!0})}function Bf(b){var c,d,e,f,h=!0;if(fk=dg.select(gg),fk.empty()&&(fk=dg.select(document.createElement("div")).style("opacity",0),Af(fk),h=!1),fk.html("").classed("c3",!0),eg.data.xs={},eg.data.targets=Fc(b),uh&&(eg.data.targets=eg.data.targets.filter(uh)),th&&Uc(th===!0?Mc(eg.data.targets):th),qe(eg.data.targets)&&(Kh=!1),p(),W(),Wg.domain(dg.extent(fc(eg.data.targets))),Xg.domain(bc(eg.data.targets,"y")),Yg.domain(bc(eg.data.targets,"y2")),Zg.domain(Wg.domain()),$g.domain(Xg.domain()),_g.domain(Yg.domain()),gk=Wg.domain(),Zj.scale(Zg),ng&&$j.scale(Wg),_j=fk.append("svg").style("overflow","hidden").on("mouseenter",rg).on("mouseleave",sg),ak=_j.append("defs"),ak.append("clipPath").attr("id",qj).append("rect"),ak.append("clipPath").attr("id",rj).append("rect"),ak.append("clipPath").attr("id",sj).append("rect"),Nf(),bk=_j.append("g").attr("transform",Qj.main),ck=_j.append("g").attr("transform",Qj.context),dk=_j.append("g").attr("transform",Qj.legend),Gh||ck.style("visibility","hidden"),Kh||(dk.style("visibility","hidden"),Kj=Mc(eg.data.targets)),ek=fk.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),$f(Mc(eg.data.targets),{withTransform:!1,withTransitionForTransform:!1}),e=bk.append("g").attr("clip-path",tj).attr("class",g.grid),zi&&e.append("g").attr("class",g.xgrids),Qe(Bi)&&e.append("g").attr("class",g.xgridLines),Hi&&e.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),Ci&&e.append("g").attr("class",g.ygrids),Qe(Di)&&e.append("g").attr("class",g.ygridLines),bk.append("g").attr("clip-path",tj).attr("class",g.regions),bk.append("g").attr("clip-path",tj).attr("class",g.chart),d=bk.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",ng?Qh?"ns-resize":"ew-resize":null),bk.select("."+g.chart).append("g").attr("class",g.chartBars),bk.select("."+g.chart).append("g").attr("class",g.chartLines),c=bk.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",Qj.arc),c.append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Wb()),qe(eg.data.targets)&&(c.append("path").attr("class",g.chartArcsBackground).attr("d",function(){var a={data:[{value:Xi}],startAngle:-1*(Math.PI/2),endAngle:Math.PI/2};return Nb(a,!0,!0)}),c.append("text").attr("dy",".75em").attr("class",g.chartArcsGaugeUnit).style("text-anchor","middle").style("pointer-events","none").text(Ui?_i:""),c.append("text").attr("dx",-1*(Hg+(Fg-Hg)/2)+"px").attr("dy","1.2em").attr("class",g.chartArcsGaugeMin).style("text-anchor","middle").style("pointer-events","none").text(Ui?Wi:""),c.append("text").attr("dx",Hg+(Fg-Hg)/2+"px").attr("dy","1.2em").attr("class",g.chartArcsGaugeMax).style("text-anchor","middle").style("pointer-events","none").text(Ui?Xi:"")),bk.select("."+g.chart).append("g").attr("class",g.chartTexts),ng&&bk.insert("rect",pg?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",zg).attr("height",Bg).style("opacity",0).style("cursor",Qh?"ns-resize":"ew-resize").call($j).on("dblclick.zoom",null),fi&&Zj.extent("function"!=typeof fi?fi:fi(fc())),Lj.x=bk.append("g").attr("class",g.axis+" "+g.axisX).attr("clip-path",uj).attr("transform",Qj.x).style("visibility",Rh?"visible":"hidden"),Lj.x.append("text").attr("class",g.axisXLabel).attr("transform",Qh?"rotate(-90)":"").style("text-anchor",Fb),Lj.y=bk.append("g").attr("class",g.axis+" "+g.axisY).attr("clip-path",vj).attr("transform",Qj.y).style("visibility",hi?"visible":"hidden"),Lj.y.append("text").attr("class",g.axisYLabel).attr("transform",Qh?"":"rotate(-90)").style("text-anchor",Gb),Lj.y2=bk.append("g").attr("class",g.axis+" "+g.axisY2).attr("transform",Qj.y2).style("visibility",qi?"visible":"hidden"),Lj.y2.append("text").attr("class",g.axisY2Label).attr("transform",Qh?"":"rotate(-90)").style("text-anchor",Hb),ck.append("g").attr("clip-path",tj).attr("class",g.chart),ck.select("."+g.chart).append("g").attr("class",g.chartBars),ck.select("."+g.chart).append("g").attr("class",g.chartLines),ck.append("g").attr("clip-path",tj).attr("class",g.brush).call(Zj).selectAll("rect").attr(Qh?"width":"height",Qh?Ag:Cg),Lj.subx=ck.append("g").attr("class",g.axisX).attr("transform",Qj.subx).attr("clip-path",Qh?"":uj),Qf(eg.data.targets),h&&Jf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),nj){if(wj&&"string"==typeof oj){for(oj=Le(oj),f=0;ff&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Xd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=cf,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 Gf(a){se(eg.data.targets)||vh&&(zj=a,bk.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Aj=!0,Eh())}function Hf(){se(eg.data.targets)||vh&&(bk.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),bk.selectAll("."+g.shape).classed(g.INCLUDED,!1),Aj=!1,Fh())}function If(a,b){"grid"===b&&a.each(function(){var a=dg.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 Jf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,T,U,V,X,Y,Z,$,_,ab,bb,cb,db=ee(we),eb=ee(xe),fb=ee(te),gb=se(eg.data.targets),hb=Ue(),ib=Rc(eg.data.targets);if(a=a||{},F=Ve(a,"withY",!0),G=Ve(a,"withSubchart",!0),H=Ve(a,"withTransition",!0),K=Ve(a,"withTransform",!1),L=Ve(a,"withUpdateXDomain",!1),M=Ve(a,"withUpdateOrgXDomain",!1),O=Ve(a,"withUpdateTranslate",!1),N=Ve(a,"withLegend",!1),I=Ve(a,"withTransitionForExit",H),J=Ve(a,"withTransitionForAxis",H),Z=H?vg:0,$=I?Z:0,_=J?Z:0,c=c||Of(_),O&&(Qh?(Lj.x.call(ah),Lj.subx.call(dh)):(Lj.y.call(bh),Lj.y2.call(ch)),p(),W(),Nf(),o(!1)),N&&Kh&&$f(Mc(eg.data.targets),a,c),xj&&0===ib.length&&Wg.domain([0,Lj.x.selectAll(".tick").size()]),ib.length&&(gc(ib,L,M),_h||!$h&&!Zh||(ab=Tc(Sc(ib),Zh),ah.tickValues(ab),dh.tickValues(ab))),Xg.domain(bc(ib,"y")),Yg.domain(bc(ib,"y2")),Lj.x.style("opacity",gb?0:1),Lj.y.style("opacity",gb?0:1),Lj.y2.style("opacity",gb?0:1),Lj.subx.style("opacity",gb?0:1),c.axisX.call(ah),c.axisY.call(bh),c.axisY2.call(ch),c.axisSubX.call(dh),Jb(H),L&&ib.length)if(Xh&&ab){for(bb=1;bb=0&&dg.select(this).style("display",b%cb?"none":"block")})}else _j.selectAll("."+g.axisX+" .tick text").style("display","block");!Qh&&ai&&kb(Lj.x,c.axisX,ai),P=qf(db,!1),S=sf(eb),U=rf(fb,!1),X=tf(eb,!0),Y=tf(eb,!1),$g.domain(Xg.domain()),_g.domain(Yg.domain()),ek.style("display","none"),q(),bk.select("line."+g.xgridFocus).style("visibility","hidden"),zi&&(f=de(Ai,Wg),C=xj?ah.tickOffset():0,e=Qh?{x1:0,x2:zg,y1:function(a){return Wg(a)-C},y2:function(a){return Wg(a)-C}}:{x1:function(a){return Wg(a)+C},x2:function(a){return Wg(a)+C},y1:wg.top,y2:Bg},d=bk.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+dg.select(this).attr(Qh?"y1":"x1")===(Qh?Bg:0)?0:1}),d.exit().remove()),Qe(Bi)&&(h=bk.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(Bi),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",Qh?"":"rotate(-90)").attr("dx",Qh?0:-wg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Z).attr("x1",Qh?0:Pd).attr("x2",Qh?zg:Pd).attr("y1",Qh?Pd:wg.top).attr("y2",Qh?Pd:Bg).style("opacity",1),h.select("text").transition().duration(Z).attr("x",Qh?zg:0).attr("y",Pd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Z).style("opacity",0).remove()),F&&Ci&&(j=bk.select("."+g.ygrids).selectAll("."+g.ygrid).data(Xg.ticks(Ei)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",Qh?Xg:0).attr("x2",Qh?Xg:zg).attr("y1",Qh?0:Xg).attr("y2",Qh?Bg:Xg),j.exit().remove(),If(j,"grid")),F&&Qe(Di)&&(k=bk.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(Di),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Qh?"rotate(-90)":"").attr("dx",Qh?0:-wg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Z).attr("x1",Qh?Qd:0).attr("x2",Qh?Qd:zg).attr("y1",Qh?0:Qd).attr("y2",Qh?Bg:Qd).style("opacity",1),k.select("text").transition().duration(Z).attr("x",Qh?0:zg).attr("y",Qd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Z).style("opacity",0).remove()),u=bk.select("."+g.regions).selectAll("."+g.region).data(ij),u.enter().append("g").attr("class",qd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(Z).attr("x",lc).attr("y",mc).attr("width",nc).attr("height",oc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(Z).style("opacity",0).remove(),s=bk.selectAll("."+g.bars).selectAll("."+g.bar).data(Fe),s.enter().append("path").attr("class",kd).style("stroke",function(a){return Fj(a.id)}).style("fill",function(a){return Fj(a.id)}),s.style("opacity",Cd),s.exit().transition().duration($).style("opacity",0).remove(),m=bk.selectAll("."+g.lines).selectAll("."+g.line).data(De),m.enter().append("path").attr("class",gd).style("stroke",Fj),m.style("opacity",Cd).attr("transform",null),m.exit().transition().duration($).style("opacity",0).remove(),n=bk.selectAll("."+g.areas).selectAll("."+g.area).data(De),n.enter().append("path").attr("class",od).style("fill",Fj).style("opacity",function(){return hk=+dg.select(this).style("opacity"),0}),n.style("opacity",hk),n.exit().transition().duration($).style("opacity",0).remove(),Fi?(r=bk.selectAll("."+g.circles).selectAll("."+g.circle).data(Ge),r.enter().append("circle").attr("class",id).attr("r",gf).style("fill",Fj),r.style("opacity",Cd),r.exit().remove()):r=dg.selectAll([]),Gd()&&(v=bk.selectAll("."+g.texts).selectAll("."+g.text).data(He),v.enter().append("text").attr("class",cd).attr("text-anchor",function(a){return Qh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Fj).style("fill-opacity",0),v.text(function(a){return Nd(a.id)(a.value,a.id)}).style("fill-opacity",Dd).transition().duration(Z).attr("x",X).attr("y",Y).style("fill",Fj).style("fill-opacity",Fd),v.exit().transition().duration($).style("fill-opacity",0).remove()),t=bk.selectAll("."+g.arcs).selectAll("."+g.arc).data(Ee),t.enter().append("path").attr("class",md).style("fill",function(a){return Fj(a.data)}).style("cursor",function(a){return xh(a)?"pointer":null}).style("opacity",0).each(function(a){Ae(a.data)&&(a.startAngle=a.endAngle=-1*(Math.PI/2)),this._current=a}).on("mouseover",function(a,b){var c,d,e;Dj||(c=Kb(a),d=Qb(c),e=Yb(),Sb(c.data.id),Wf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Kb(a),c=Qb(b),d=[c];_d(d,dg.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Dj||(c=Kb(a),d=Qb(c),e=Zb(),Tb(c.data.id),Xf(),ae(),e(d,b))}).on("click",function(a,b){var c=Kb(a),d=Qb(c),e=Xb();Ef(this,a,b),e(d,b)}),t.attr("transform",function(a){return!Ae(a.data)&&K?"scale(0)":""}).style("opacity",function(a){return a===this._current?0:1}).each(function(){Dj=!0}).transition().duration(Z).attrTween("d",function(a){var b,c=Kb(a);return c?(isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle),b=dg.interpolate(this._current,c),this._current=b(0),function(a){return Nb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",K?"scale(1)":"").style("fill",function(a){return Gj?Gj(a.data.values[0].value):Fj(a.data.id)}).style("opacity",1).call(Te,function(){Dj=!1}),t.exit().transition().duration($).style("opacity",0).remove(),bk.selectAll("."+g.chartArc).select("text").style("opacity",0).attr("class",function(a){return Ae(a.data)?g.gaugeValue:""}).text(Rb).attr("transform",Ob).transition().duration(Z).style("opacity",function(a){return Pc(a.data.id)&&Ce(a.data)?1:0}),bk.select("."+g.chartArcsTitle).style("opacity",re(eg.data.targets)||qe(eg.data.targets)?1:0),Gh&&(dg.event&&"zoom"===dg.event.type&&Zj.extent(Wg.orgDomain()).update(),G&&(!Qh&&ai&&kb(Lj.subx,c.axisSubX,ai),Zj.empty()||Zj.extent(Wg.orgDomain()).update(),R=qf(db,!0),T=sf(eb,!0),V=rf(fb,!0),y=ck.selectAll("."+g.bars).selectAll("."+g.bar).data(Fe),y.enter().append("path").attr("class",kd).style("stroke","none").style("fill",Fj),y.style("opacity",Cd).transition().duration(Z).attr("d",T).style("opacity",1),y.exit().transition().duration(Z).style("opacity",0).remove(),w=ck.selectAll("."+g.lines).selectAll("."+g.line).data(De),w.enter().append("path").attr("class",gd).style("stroke",Fj),w.style("opacity",Cd).transition().duration(Z).attr("d",V).style("opacity",1),w.exit().transition().duration(Z).style("opacity",0).remove(),x=ck.selectAll("."+g.areas).selectAll("."+g.area).data(De),x.enter().append("path").attr("class",od).style("fill",Fj).style("opacity",function(){return hk=+dg.select(this).style("opacity"),0}),x.style("opacity",0).transition().duration(Z).attr("d",R).style("fill",Fj).style("opacity",hk),x.exit().transition().duration($).style("opacity",0).remove())),bk.selectAll("."+g.selectedCircles).filter(function(a){return xe(a)}).selectAll("circle").remove(),qg&&(z=bk.select("."+g.eventRects),Qe(fh)&&!xc(fh)?(z.classed(g.eventRectsMultiple)||z.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),A=bk.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),Df(A.enter()),A.attr("x",0).attr("y",0).attr("width",zg).attr("height",Bg)):(z.classed(g.eventRectsSingle)||z.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),!yj&&!wj||xj?(E=Q(),D=function(a){return Wg(a.x)-E/2}):(E=function(a){var b=Hc(a.index),c=Ic(a.index),d=eg.data.xs[a.id][a.index];return(Wg(c?c:d)-Wg(b?b:d))/2},D=function(a){var b=Hc(a.index),c=eg.data.xs[a.id][a.index];return(Wg(c)+Wg(b?b:c))/2}),B=Kc(eg.data.targets),bk.select("."+g.eventRects).datum(B?B.values:[]),A=bk.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),Cf(A.enter()),A.attr("class",rd).attr("x",Qh?0:D).attr("y",Qh?D:0).attr("width",Qh?zg:E).attr("height",Qh?E:Bg),A.exit().remove())),dg.transition().duration(Z).each(function(){hb.add(s.transition().attr("d",S).style("fill",Fj).style("opacity",1)),hb.add(m.transition().attr("d",U).style("stroke",Fj).style("opacity",1)),hb.add(n.transition().attr("d",P).style("fill",Fj).style("opacity",hk)),hb.add(r.transition().style("opacity",Ed).style("fill",Fj).attr("cx",Qh?je:ie).attr("cy",Qh?ie:je)),hb.add(bk.selectAll("."+g.selectedCircle).transition().attr("cx",Qh?je:ie).attr("cy",Qh?ie:je))}).call(hb,a.flow?function(){var b,c,d=1,e=a.flow.index,f=a.flow.length,h=zc(eg.data.targets[0].values,e),i=zc(eg.data.targets[0].values,e+f),j=Wg.domain(),k=Ue();eg.data.targets.forEach(function(a){a.values.splice(0,f)}),gc(ib,!0,!0),b=Wg(h.x)-Wg(i.x),wj&&(b=.9*b,d=hc(j)/hc(Wg.domain())),c="translate("+b+",0) scale("+d+",1)",dg.transition().ease("linear").each(function(){k.add(Lj.x.transition().call(ah)),k.add(s.transition().attr("transform",c)),k.add(m.transition().attr("transform",c)),k.add(n.transition().attr("transform",c)),k.add(r.transition().attr("transform",c))}).call(k,function(){var a,b=[],c=[];for(a=0;f>a;a++)b.push("."+g.shape+"-"+(e+a)),c.push("."+g.eventRect+"-"+(e+a));_j.selectAll("."+g.shapes).selectAll(b).remove(),_j.selectAll("."+g.eventRects).selectAll(c).remove(),s.attr("transform",null).attr("d",S),m.attr("transform",null).attr("d",U),n.attr("transform",null).attr("d",P),r.attr("transform",null).attr("cx",Qh?je:ie).attr("cy",Qh?ie:je),A.attr("x",Qh?0:D).attr("y",Qh?D:0).attr("width",Qh?zg:E).attr("height",Qh?E:Bg)})}:null),Mc(eg.data.targets).forEach(function(a){ik[a]=!0})}function Kf(){Jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Lf(){if(0!==Rc(eg.data.targets).length){if("mousemove"===dg.event.sourceEvent.type&&$j.altDomain)return Wg.domain($j.altDomain),void $j.scale(Wg).updateScaleExtent();xj&&Wg.orgDomain()[0]===gk[0]&&Wg.domain([gk[0]-1e-10,Wg.orgDomain()[1]]),Jf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===dg.event.sourceEvent.type&&(Bj=!0)}}function Mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Nf(){_j.attr("width",Dg).attr("height",Eg),_j.select("#"+qj).select("rect").attr("width",zg).attr("height",Bg),_j.select("#"+rj).select("rect").attr("x",G).attr("y",H).attr("width",M).attr("height",N),_j.select("#"+sj).select("rect").attr("x",I).attr("y",J).attr("width",O).attr("height",P),_j.select("."+g.zoomRect).attr("width",zg).attr("height",Bg),fk.style("max-height",Eg+"px")}function Of(a){return{axisX:a?Lj.x.transition().duration(a):Lj.x,axisY:a?Lj.y.transition().duration(a):Lj.y,axisY2:a?Lj.y2.transition().duration(a):Lj.y2,axisSubX:a?Lj.subx.transition().duration(a):Lj.subx}}function Pf(a){var b;a=a||{},a.withTransition=Ve(a,"withTransition",!0),a.withTransform=Ve(a,"withTransform",!1),a.withLegend=Ve(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&Kh||(b=Of(a.withTransitionForAxis?vg:0),p(),W(),Nf(),o(a.withTransition,b)),Jf(a,b)}function Qf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=bk.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",td),j=i.enter().append("g").attr("class",td).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",dd),e=bk.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",vd),d=e.enter().append("g").attr("class",vd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",ld).style("cursor",function(a){return xh(a)?"pointer":null}),c=bk.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ud),b=c.enter().append("g").attr("class",ud).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",hd),b.append("g").attr("class",pd),b.append("g").attr("class",function(a){return bd(g.selectedCircles,a.id)}),b.append("g").attr("class",jd).style("cursor",function(a){return xh(a)?"pointer":null}),a.forEach(function(a){bk.selectAll("."+g.selectedCircles+xd(a.id)).selectAll("."+g.selectedCircle).each(function(b){b.value=a.values[b.index].value})}),h=bk.select("."+g.chartArcs).selectAll("."+g.chartArc).data(Ng(a)).attr("class",wd),f=h.enter().append("g").attr("class",wd),f.append("g").attr("class",nd),f.append("text").attr("dy",qe(eg.data.targets)?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Gh&&(n=ck.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",vd),m=n.enter().append("g").style("opacity",0).attr("class",vd),m.append("g").attr("class",ld),l=ck.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ud),k=l.enter().append("g").style("opacity",0).attr("class",ud),k.append("g").attr("class",hd),k.append("g").attr("class",pd)),_j.selectAll("."+g.target).filter(function(a){return Pc(a.id)}).transition().duration(vg).style("opacity",1)}function Rf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?le(a.id,b.types[a.id]):le(a.id,b.type)}),eg.data.targets.forEach(function(b){for(var c=0;cf&&(f=(m-l)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=l}var f,h,i=Xe(b.textContent,g.legendItem),j=10*Math.ceil((i.width+v)/10),k=10*Math.ceil((i.height+u)/10),l=Rj?k:j,m=Rj?V():U();return d&&(z=0,F=0,w=0,x=0),Kh&&!Qc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=j,C[c]=k,(!w||j>=w)&&(w=j),(!x||k>=x)&&(x=k),h=Rj?x:w,void(Ph?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(m-h*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=36,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=dk.selectAll("."+g.legendItemFocused).size();b=b||{},n=Ve(b,"withTransition",!0),q=Ve(b,"withTransitionForTransform",!0),Rj?(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=dk.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return bd(g.legendItem,a)}).style("visibility",function(a){return Qc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Mh?Mh(a):eg.toggle(a)}).on("mouseover",function(a){dg.select(this).classed(g.legendItemFocused,!0),Dj||eg.focus(a),"function"==typeof Nh&&Nh(a)}).on("mouseout",function(a){dg.select(this).classed(g.legendItemFocused,!1),Dj||eg.revert(),"function"==typeof Oh&&Oh(a)}),m.append("text").text(function(a){return d(ih[a])?ih[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Rj?h:-200).attr("y",Rj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",Rj?i:-200).attr("y",Rj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Fj).attr("x",Rj?h:-200).attr("y",Rj?-200:j).attr("width",10).attr("height",10),r=dk.selectAll("text").data(a).text(function(a){return d(ih[a])?ih[a]:a +}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=dk.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=dk.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",Fj).attr("x",f).attr("y",j),dk.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Pc(a)}).transition().style("opacity",function(a){var b=dg.select(this);return Pc(a)?!G||b.classed(g.legendItemFocused)?Uf(b):Vf(b):Vj}),S(w),T(x),R(F),p(),W(),Nf(),o(q,c)}function _f(a){return Oc(eg.data.targets,a.id)}function ag(a){return"data"in a&&Oc(eg.data.targets,a.data.id)}function bg(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function cg(a,b,c){var d=!se(eg.data.targets);Dj=!1,le(a,b),Pf(c||{withTransitionForAxis:d})}var dg=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,eg={data:{},axis:{},legend:{}},fg={},gg=i(["bindto"],"#chart"),hg=i(["size","width"]),ig=i(["size","height"]),jg=i(["padding","left"]),kg=i(["padding","right"]),lg=i(["padding","top"]),mg=i(["padding","bottom"]),ng=i(["zoom","enabled"],!1),og=i(["zoom","extent"]),pg=i(["zoom","privileged"],!1),qg=i(["interaction","enabled"],!0),rg=i(["onenter"],function(){}),sg=i(["onleave"],function(){}),tg=i(["onresize"],function(){}),ug=i(["onresized"],function(){}),vg=i(["transition","duration"],350);h("data","data is required in config");var wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng,Og,Pg,Qg,Rg,Sg,Tg,Ug,Vg,Wg,Xg,Yg,Zg,$g,_g,ah,bh,ch,dh,eh=i(["data","x"]),fh=i(["data","xs"],{}),gh=i(["data","x_format"]),hh=i(["data","id_converter"],function(a){return a}),ih=i(["data","names"],{}),jh=i(["data","classes"],{}),kh=i(["data","groups"],[]),lh=i(["data","axes"],{}),mh=i(["data","type"]),nh=i(["data","types"],{}),oh=i(["data","labels"],{}),ph=i(["data","order"]),qh=i(["data","regions"],{}),rh=i(["data","color"]),sh=i(["data","colors"],{}),th=i(["data","hide"],!1),uh=i(["data","filter"]),vh=i(["data","selection","enabled"],!1),wh=i(["data","selection","grouped"],!1),xh=i(["data","selection","isselectable"],function(){return!0}),yh=i(["data","selection","multiple"],!0),zh=i(["data","onclick"],function(){}),Ah=i(["data","onenter"],function(){}),Bh=i(["data","onleave"],function(){}),Ch=i(["data","onselected"],function(){}),Dh=i(["data","onunselected"],function(){}),Eh=i(["data","ondragstart"],function(){}),Fh=i(["data","ondragend"],function(){}),Gh=i(["subchart","show"],!1),Hh=i(["subchart","size","height"],60),Ih=i(["color","pattern"],[]),Jh=i(["color","threshold"],{}),Kh=i(["legend","show"],!0),Lh=i(["legend","position"],"bottom"),Mh=i(["legend","item","onclick"]),Nh=i(["legend","item","onmouseover"]),Oh=i(["legend","item","onmouseout"]),Ph=i(["legend","equally"],!1),Qh=i(["axis","rotated"],!1),Rh=i(["axis","x","show"],!0),Sh=i(["axis","x","type"],"indexed"),Th=i(["axis","x","localtime"],!0),Uh=i(["axis","x","categories"],[]),Vh=i(["axis","x","tick","centered"],!1),Wh=i(["axis","x","tick","format"]),Xh=i(["axis","x","tick","culling"],{}),Yh=i(["axis","x","tick","culling","max"],10),Zh=i(["axis","x","tick","count"]),$h=i(["axis","x","tick","fit"],!0),_h=i(["axis","x","tick","values"],null),ai=i(["axis","x","tick","rotate"]),bi=i(["axis","x","max"],null),ci=i(["axis","x","min"],null),di=i(["axis","x","padding"],{}),ei=i(["axis","x","height"]),fi=i(["axis","x","default"]),gi=i(["axis","x","label"],{}),hi=i(["axis","y","show"],!0),ii=i(["axis","y","max"]),ji=i(["axis","y","min"]),ki=i(["axis","y","center"]),li=i(["axis","y","label"],{}),mi=i(["axis","y","inner"],!1),ni=i(["axis","y","tick","format"]),oi=i(["axis","y","padding"]),pi=i(["axis","y","ticks"],10),qi=i(["axis","y2","show"],!1),ri=i(["axis","y2","max"]),si=i(["axis","y2","min"]),ti=i(["axis","y2","center"]),ui=i(["axis","y2","label"],{}),vi=i(["axis","y2","inner"],!1),wi=i(["axis","y2","tick","format"]),xi=i(["axis","y2","padding"]),yi=i(["axis","y2","ticks"],10),zi=i(["grid","x","show"],!1),Ai=i(["grid","x","type"],"tick"),Bi=i(["grid","x","lines"],[]),Ci=i(["grid","y","show"],!1),Di=i(["grid","y","lines"],[]),Ei=i(["grid","y","ticks"],10),Fi=i(["point","show"],!0),Gi=i(["point","r"],2.5),Hi=i(["point","focus","line","enabled"],!0),Ii=i(["point","focus","expand","enabled"],!0),Ji=i(["point","focus","expand","r"]),Ki=i(["point","focus","select","r"]),Li=i(["line","connect_null"],!1),Mi=i(["bar","width"]),Ni=i(["bar","width","ratio"],.6),Oi=i(["pie","label","show"],!0),Pi=i(["pie","label","format"]),Qi=i(["pie","expand"],!0),Ri=i(["pie","onclick"],function(){}),Si=i(["pie","onmouseover"],function(){}),Ti=i(["pie","onmouseout"],function(){}),Ui=i(["gauge","label","show"],!0),Vi=i(["gauge","label","format"]),Wi=i(["gauge","min"],0),Xi=i(["gauge","max"],100),Yi=i(["gauge","onclick"],function(){}),Zi=i(["gauge","onmouseover"],function(){}),$i=i(["gauge","onmouseout"],function(){}),_i=i(["gauge","units"]),aj=i(["gauge","width"]),bj=i(["donut","label","show"],!0),cj=i(["donut","label","format"]),dj=i(["donut","expand"],!0),ej=i(["donut","title"],""),fj=i(["donut","onclick"],function(){}),gj=i(["donut","onmouseover"],function(){}),hj=i(["donut","onmouseout"],function(){}),ij=i(["regions"],[]),jj=i(["tooltip","show"],!0),kj=i(["tooltip","format","title"]),lj=i(["tooltip","format","value"]),mj=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k,l=kj?kj:b,m=lj?lj:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=m(a[f].value,a[f].ratio,a[f].id,a[f].index),k=Gj?Gj(a[f].value):d(a[f].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),nj=i(["tooltip","init","show"],!1),oj=i(["tooltip","init","x"],0),pj=i(["tooltip","init","position"],{top:"0px",left:"50px"}),qj="c3-"+ +new Date+"-clip",rj=qj+"-xaxis",sj=qj+"-yaxis",tj=j(qj),uj=j(rj),vj=j(sj),wj="timeseries"===Sh,xj="categorized"===Sh,yj=!wj&&(eh||Qe(fh)),zj=null,Aj=!1,Bj=!1,Cj=!1,Dj=!1,Ej=dg.scale.category10().range(),Fj=Je(sh,Qe(Ih)?Ih:Ej,rh),Gj=Qe(Jh)?Ke(Ih,Jh):null,Hj=Th?dg.time.format:dg.time.format.utc,Ij=Hj.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}]]),Jj=[],Kj=[],Lj={},Mj=Qh?"left":"bottom",Nj=Qh?mi?"top":"bottom":mi?"right":"left",Oj=Qh?vi?"bottom":"top":vi?"left":"right",Pj=Qh?"left":"bottom",Qj={main:function(){return"translate("+k(wg.left)+","+k(wg.top)+")"},context:function(){return"translate("+k(xg.left)+","+k(xg.top)+")"},legend:function(){return"translate("+yg.left+","+yg.top+")"},x:function(){return"translate(0,"+(Qh?0:Bg)+")"},y:function(){return"translate(0,"+(Qh?Bg:0)+")"},y2:function(){return"translate("+(Qh?0:zg)+","+(Qh?1:0)+")"},subx:function(){return"translate(0,"+(Qh?0:Cg)+")"},arc:function(){return"translate("+Ig/2+","+Jg/2+")"}},Rj="right"===Lh,Sj=0,Tj=0,Uj=0,Vj=.15,Wj=30,Xj=Qh&&!Rh?0:30,Yj=5;Ng=dg.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zj,$j=function(){};Zj=dg.svg.brush().on("brush",Kf),Zj.update=function(){return ck&&ck.select("."+g.brush).call(this),this},Zj.scale=function(a){return Qh?this.y(a):this.x(a)},ng&&($j=dg.behavior.zoom().on("zoomstart",function(){$j.altDomain=dg.event.sourceEvent.altKey?Wg.orgDomain():null}).on("zoom",ng?Lf:null),$j.scale=function(a){return Qh?this.y(a):this.x(a)},$j.orgScaleExtent=function(){var a=og?og:[1,10];return[a[0],Math.max(Jc()/a[1],a[1])]},$j.updateScaleExtent=function(){var a=hc(Wg.orgDomain())/hc(gk),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var _j,ak,bk,ck,dk,ek,fk,gk,hk,ik={};if(eg.focus=function(a){function b(a){Rc(a).transition().duration(100).style("opacity",1)}var c=_j.selectAll(yd(a)),d=c.filter(_f),e=c.filter(ag);eg.revert(),eg.defocus(),b(d.classed(g.focused,!0)),b(e),se(eg.data.targets)&&Sb(a,!0),Wf(a,!0)},eg.defocus=function(a){function b(a){Rc(a).transition().duration(100).style("opacity",.3)}var c=_j.selectAll(yd(a)),d=c.filter(_f),e=c.filter(ag);eg.revert(),b(d.classed(g.focused,!1)),b(e),se(eg.data.targets)&&Tb(a),Wf(a,!1)},eg.revert=function(a){function b(a){Rc(a).transition().duration(100).style("opacity",1)}var c=_j.selectAll(yd(a)),d=c.filter(_f),e=c.filter(ag);b(d.classed(g.focused,!1)),b(e),se(eg.data.targets)&&Tb(a),Xf()},eg.show=function(a,b){a=Nc(a),b=b||{},Vc(a),_j.selectAll(zd(a)).transition().style("opacity",1),b.withLegend&&Yf(a),Jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},eg.hide=function(a,b){a=Nc(a),b=b||{},Uc(a),_j.selectAll(zd(a)).transition().style("opacity",0),b.withLegend&&Zf(a),Jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},eg.toggle=function(a){Pc(a)?eg.hide(a):eg.show(a)},eg.unzoom=function(){Zj.clear().update(),Jf({withUpdateXDomain:!0})},eg.load=function(a){return a.xs&&wc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){jh[b]=a.classes[b]}),"categories"in a&&xj&&(Uh=a.categories,ah.categories(Uh)),"cacheIds"in a&&ic(a.cacheIds)?void Rf(kc(a.cacheIds),a.done):void("unload"in a?Tf(Nc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Sf(a)}):Sf(a))},eg.unload=function(a,b){Tf(Nc(a),function(){Jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},eg.flow=function(a){var b,c,d=Fc(Ec(a.columns),!0),e=[];eg.data.targets.forEach(function(a){var f,g,h=!1;for(f=0;ff;f++)a.values.push({id:a.id,index:c+f,x:wj?vc(c+f):c+f,value:null})}),d.forEach(function(a){var b,d=[];for(b=eg.data.targets[0].values[0].index;c>b;b++)d.push({id:a.id,index:b,x:wj?vc(b):b,value:null});a.values.forEach(function(a){a.index+=c,wj||(a.x+=c)}),a.values=d.concat(a.values)}),eg.data.targets=eg.data.targets.concat(d),Qf(eg.data.targets),Jf({flow:{index:eg.data.targets[0].values[0].index,length:b},withLegend:!0})},eg.selected=function(a){return dg.merge(bk.selectAll("."+g.shapes+xd(a)).selectAll("."+g.shape).filter(function(){return dg.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},eg.select=function(a,b,c){vh&&bk.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=dg.select(this),i=e.data?e.data.id:e.id,j=ef(this),k=wh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?xh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},eg.unselect=function(a,b){vh&&bk.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=dg.select(this),f=c.data?c.data.id:c.id,h=ef(this),i=wh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&xh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},eg.toLine=function(a){cg(a,"line")},eg.toSpline=function(a){cg(a,"spline")},eg.toBar=function(a){cg(a,"bar")},eg.toScatter=function(a){cg(a,"scatter")},eg.toArea=function(a){cg(a,"area")},eg.toAreaSpline=function(a){cg(a,"area-spline")},eg.toPie=function(a){cg(a,"pie",{withTransform:!0})},eg.toDonut=function(a){cg(a,"donut",{withTransform:!0})},eg.groups=function(a){return c(a)?kh:(kh=a,Jf(),kh)},eg.xgrids=function(a){return a?(Bi=a,Jf(),Bi):Bi},eg.xgrids.add=function(a){return a?eg.xgrids(Bi.concat(a)):void 0},eg.xgrids.remove=function(a){var b=bg(a);return eg.xgrids(Bi.filter(b))},eg.ygrids=function(a){return a?(Di=a,Jf(),Di):Di},eg.ygrids.add=function(a){return a?eg.ygrids(Di.concat(a)):void 0},eg.ygrids.remove=function(a){var b=bg(a);return eg.ygrids(Di.filter(b))},eg.regions=function(a){return a?(ij=a,Jf(),ij):ij},eg.regions.add=function(a){return a?(ij=ij.concat(a),Jf(),ij):ij},eg.regions.remove=function(a){var b,c,d;return a=a||{},b=Ve(a,"duration",vg),c=Ve(a,"classes",[g.region]),d=bk.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),ij=ij.filter(function(a){var b=!1;return a.class?(a.class.split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0})},eg.data.get=function(a){var b=eg.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},eg.data.getAsTarget=function(a){var b=eg.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},eg.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ih[b]=a[b]}),Jf({withLegend:!0}),ih):ih},eg.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){sh[b]=a[b]}),Jf({withLegend:!0}),sh):sh},eg.x=function(a){return arguments.length&&(Ac(eg.data.targets,a),Jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),eg.data.xs},eg.xs=function(a){return arguments.length&&(Bc(eg.data.targets,a),Jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),eg.data.xs},eg.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){hb(b,a[b])}),Jb())},eg.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(bi=+a.x),b(a.y)&&(ii=+a.y),b(a.y2)&&(ri=+a.y2)):ii=ri=+a,Jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},eg.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(ci=+a.x),b(a.y)&&(ji=+a.y),b(a.y2)&&(si=+a.y2)):ji=si=+a,Jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},eg.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&eg.axis.max(a.max),"undefined"!=typeof a.min&&eg.axis.min(a.min))},eg.legend.show=function(a){Yf(Nc(a)),Jf({withLegend:!0})},eg.legend.hide=function(a){Zf(Nc(a)),Jf({withLegend:!0})},eg.resize=function(a){hg=a?a.width:null,ig=a?a.height:null,eg.flush(),eg.flush()},eg.flush=function(){Pf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},eg.destroy=function(){eg.data.targets=void 0,eg.data.xs={},fk.classed("c3",!1).html(""),a.onresize=null},"url"in f.data)dg.xhr(f.data.url,function(a,b){var c,d=dg.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=dg.csv.parse(b.response),Bf(c)});else if("rows"in f.data)Bf(Dc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");Bf(Ec(f.data.columns))}return eg},"function"==typeof define&&define.amd?define("c3",["d3"],f):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=f:a.c3=f}(window); \ No newline at end of file diff --git a/htdocs/samples/api_flow.html b/htdocs/samples/api_flow.html new file mode 100644 index 0000000..133ece5 --- /dev/null +++ b/htdocs/samples/api_flow.html @@ -0,0 +1,75 @@ + + + + + +
+ + + + + + diff --git a/htdocs/samples/api_flow_timeseries.html b/htdocs/samples/api_flow_timeseries.html new file mode 100644 index 0000000..6ffca24 --- /dev/null +++ b/htdocs/samples/api_flow_timeseries.html @@ -0,0 +1,84 @@ + + + + + +
+ + + + + +