diff --git a/c3.js b/c3.js
index dd0ce32..ba3746b 100644
--- a/c3.js
+++ b/c3.js
@@ -19,6 +19,9 @@
chartArc: 'c3-chart-arc',
chartArcs: 'c3-chart-arcs',
chartArcsTitle: 'c3-chart-arcs-title',
+ gaugeArc: 'c3-gauge-arc',
+ gaugeArcs: 'c3-gauge-arcs',
+ gaugeArcsTitle: 'c3-gauge-arcs-title',
selectedCircle: 'c3-selected-circle',
selectedCircles: 'c3-selected-circles',
eventRect: 'c3-event-rect',
@@ -36,6 +39,8 @@
shapes: 'c3-shapes',
line: 'c3-line',
lines: 'c3-lines',
+ step: 'c3-step',
+ steps: 'c3-steps',
bar: 'c3-bar',
bars: 'c3-bars',
circle: 'c3-circle',
@@ -161,12 +166,20 @@
__data_ondragstart = getConfig(['data', 'ondragstart'], function () {}),
__data_ondragend = getConfig(['data', 'ondragend'], function () {});
+ // configuration for no plot-able data supplied.
+ var __data_empty_abort = getConfig(['data', 'empty', 'abort'], true),
+ __data_empty_label_text = getConfig(['data', 'empty', 'label', 'text'], ""),
+ __data_empty_label_size = getConfig(['data', 'empty', 'label', 'size'], false),
+ __data_empty_label_fill = getConfig(['data', 'empty', 'label', 'fill'], false);
+
// subchart
var __subchart_show = getConfig(['subchart', 'show'], false),
__subchart_size_height = getConfig(['subchart', 'size', 'height'], 60);
// color
- var __color_pattern = getConfig(['color', 'pattern'], []);
+ var __color_pattern = getConfig(['color', 'pattern'], []),
+ __color_opacity = getConfig(['color', 'opacity'], null),
+ __color_values = getConfig(['color', 'values'], []);
// legend
var __legend_show = getConfig(['legend', 'show'], true),
@@ -215,6 +228,8 @@
__axis_y2_padding = getConfig(['axis', 'y2', 'padding']),
__axis_y2_ticks = getConfig(['axis', 'y2', 'ticks'], 10);
+ var __zero_padding = getConfig(['zeropadding'], false);
+
// grid
var __grid_x_show = getConfig(['grid', 'x', 'show'], false),
__grid_x_type = getConfig(['grid', 'x', 'type'], 'tick'),
@@ -247,6 +262,19 @@
__pie_onmouseover = getConfig(['pie', 'onmouseover'], function () {}),
__pie_onmouseout = getConfig(['pie', 'onmouseout'], function () {});
+ // gauge
+ var __gauge_color = getConfig(['gauge', 'color'], "#e0e0e0"),
+ __gauge_label_show = getConfig(['gauge', 'label', 'show'], true),
+ __gauge_label_format = getConfig(['gauge', 'label', 'format']),
+ __gauge_max = getConfig(['gauge', 'max']),
+ __gauge_min = getConfig(['gauge', 'min']),
+ __gauge_onclick = getConfig(['gauge', 'onclick'], function () {}),
+ __gauge_onmouseover = getConfig(['gauge', 'onmouseover'], function () {}),
+ __gauge_onmouseout = getConfig(['gauge', 'onmouseout'], function () {}),
+ __gauge_style = getConfig(['gauge', 'style']),
+ __gauge_units = getConfig(['gauge', 'units']),
+ __gauge_width = getConfig(['gauge', 'width'], false);
+
// donut
var __donut_label_show = getConfig(['donut', 'label', 'show'], true),
__donut_label_format = getConfig(['donut', 'label', 'format']),
@@ -266,7 +294,7 @@
__tooltip_contents = getConfig(['tooltip', 'contents'], function (d, defaultTitleFormat, defaultValueFormat, color) {
var titleFormat = __tooltip_format_title ? __tooltip_format_title : defaultTitleFormat,
valueFormat = __tooltip_format_value ? __tooltip_format_value : defaultValueFormat,
- text, i, title, value, name;
+ text, i, title, value, name, bgcolor;
for (i = 0; i < d.length; i++) {
if (! (d[i] && (d[i].value || d[i].value === 0))) { continue; }
@@ -277,9 +305,10 @@
name = d[i].name;
value = valueFormat(d[i].value, d[i].ratio, d[i].id, d[i].index);
+ bgcolor = (__gauge_style === 'arc' && __color_values) ? levelColor(d[i].value) : color(d[i].id);
text += "
";
- text += "" + name + " | ";
+ text += "" + name + " | ";
text += "" + value + " | ";
text += "
";
}
@@ -306,7 +335,8 @@
var dragStart = null, dragging = false, cancelClick = false, mouseover = false, transiting = false;
var defaultColorPattern = d3.scale.category10().range(),
- color = generateColor(__data_colors, notEmpty(__color_pattern) ? __color_pattern : defaultColorPattern, __data_color);
+ color = generateColor(__data_colors, notEmpty(__color_pattern) ? __color_pattern : defaultColorPattern, __data_color),
+ levelColor = generateLevelColor(__color_pattern, __color_values);
var timeFormat = __axis_x_localtime ? d3.time.format : d3.time.format.utc,
defaultTimeFormat = timeFormat.multi([
@@ -487,7 +517,8 @@
function updateRadius() {
radiusExpanded = Math.min(arcWidth, arcHeight) / 2;
radius = radiusExpanded * 0.95;
- innerRadius = hasDonutType(c3.data.targets) ? radius * 0.6 : 0;
+ var innerRadiusRatio = __gauge_width ? ((radius-__gauge_width)/radius) : 0.6;
+ innerRadius = hasDonutType(c3.data.targets) || hasGaugeType(c3.data.targets) ? radius * innerRadiusRatio : 0;
}
function getSvgLeft() {
var leftAxisClass = __axis_rotated ? CLASS.axisX : CLASS.axisY,
@@ -962,6 +993,15 @@
d = t;
}
});
+ if (isNaN(d.endAngle)) d.endAngle = d.startAngle;
+ if (isGaugeType(d.data)) {
+ var sA = d.startAngle, eA = d.endAngle;
+ var gMin = __gauge_min, gMax = __gauge_max,
+ gF = Math.abs(gMin)+gMax, fA = Math.abs(sA)+eA,
+ aTic = (Math.PI)/gF;
+ d.startAngle = (-1*(Math.PI/2))+(aTic*Math.abs(gMin));
+ d.endAngle = d.startAngle+(aTic*( (d.value > gMax) ? gMax : d.value ));
+ }
return found ? d : null;
}
@@ -996,12 +1036,13 @@
h = Math.sqrt(x * x + y * y);
// TODO: ratio should be an option?
ratio = (36 / radius > 0.375 ? 1.175 - 36 / radius : 0.8) * radius / h;
- translate = "translate(" + (x * ratio) + ',' + (y * ratio) + ")";
+ translate = __gauge_style == 'arc' ? "translate(1,1)" : "translate(" + (x * ratio) + ',' + (y * ratio) + ")";
}
return translate;
}
function getArcRatio(d) {
- return d ? (d.endAngle - d.startAngle) / (Math.PI * 2) : null;
+ var whole = __gauge_style == 'arc' ? Math.PI : (Math.PI * 2);
+ return d ? (d.endAngle - d.startAngle) / whole : null;
}
function convertToArcData(d) {
return addName({
@@ -1035,36 +1076,52 @@
}
});
}
+
if (!withoutFadeOut) {
noneTargets.style("opacity", 0.3);
}
}
function unexpandArc(id) {
var target = svg.selectAll('.' + CLASS.chartArc + selectorTarget(id));
- target.selectAll('path')
+ target.selectAll('path.c3-arc')
.transition().duration(50)
.attr("d", svgArc);
svg.selectAll('.' + CLASS.arc)
- .style("opacity", 1);
+ .style("opacity", (__color_opacity) ? __color_opacity : 1);
}
function shouldShowArcLable() {
+ if (hasGaugeType(c3.data.targets)) {
+ return true;
+ }
return hasDonutType(c3.data.targets) ? __donut_label_show : __pie_label_show;
}
function getArcLabelFormat() {
+ if (hasGaugeType(c3.data.targets)) {
+ return __gauge_label_format;
+ }
return hasDonutType(c3.data.targets) ? __donut_label_format : __pie_label_format;
}
function getArcTitle() {
return hasDonutType(c3.data.targets) ? __donut_title : "";
}
function getArcOnClick() {
+ if (hasGaugeType(c3.data.targets)) {
+ return typeof __gauge_onclick === 'function' ? __gauge_onclick : function () {};
+ }
var callback = hasDonutType(c3.data.targets) ? __donut_onclick : __pie_onclick;
return typeof callback === 'function' ? callback : function () {};
}
function getArcOnMouseOver() {
+ if (hasGaugeType(c3.data.targets)) {
+ return typeof __gauge_onmouseover === 'function' ? __gauge_onmouseover : function () {};
+ }
var callback = hasDonutType(c3.data.targets) ? __donut_onmouseover : __pie_onmouseover;
return typeof callback === 'function' ? callback : function () {};
}
function getArcOnMouseOut() {
+ if (hasGaugeType(c3.data.targets)) {
+ return typeof __gauge_onmouseout === 'function' ? __gauge_onmouseout : function () {};
+ }
var callback = hasDonutType(c3.data.targets) ? __donut_onmouseout : __pie_onmouseout;
return typeof callback === 'function' ? callback : function () {};
}
@@ -1172,6 +1229,9 @@
if (hasBarType(yTargets) && !hasNegativeValueInTargets(yTargets)) {
padding_bottom = yDomainMin;
}
+ if (__zero_padding && !hasNegativeValueInTargets(yTargets)) {
+ padding_bottom -= padding_bottom;
+ }
return [yDomainMin - padding_bottom, yDomainMax + padding_top];
}
function getXDomainMin(targets) {
@@ -1188,6 +1248,8 @@
} else if (hasBarType(targets)) {
maxDataCount = getMaxDataCount();
padding = maxDataCount > 1 ? (diff / (maxDataCount - 1)) / 2 : 0.5;
+ } else if (__zero_padding) {
+ padding = diff * 0.001;
} else {
padding = diff * 0.01;
}
@@ -1615,6 +1677,8 @@
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 classStep(d) { return classShape(d) + generateClass(CLASS.step, d.id); }
+ function classSteps(d) { return classShapes(d) + generateClass(CLASS.steps, d.id); }
function classTarget(id) {
var additionalClassSuffix = __data_classes[id], additionalClass = '';
if (additionalClassSuffix) {
@@ -1667,8 +1731,8 @@
return widths;
}
function getYFormat(forArc) {
- var formatForY = forArc ? defaultArcValueFormat : yFormat,
- formatForY2 = forArc ? defaultArcValueFormat : y2Format;
+ var formatForY = forArc && !hasGaugeType(c3.data.targets) ? defaultArcValueFormat : yFormat,
+ formatForY2 = forArc && !hasGaugeType(c3.data.targets) ? defaultArcValueFormat : y2Format;
return function (v, ratio, id) {
var format = getAxisId(id) === 'y2' ? formatForY2 : formatForY;
return format(v, ratio);
@@ -1821,6 +1885,7 @@
return;
}
tooltip.html(__tooltip_contents(selectedData, getXAxisTickFormat(), getYFormat(forArc), color)).style("display", "block");
+
// Get tooltip dimensions
tWidth = tooltip.property('offsetWidth');
tHeight = tooltip.property('offsetHeight');
@@ -1896,7 +1961,9 @@
function circleX(d) {
return d.x || d.x === 0 ? x(d.x) : null;
}
- function circleY(d) {
+ function circleY(d,i) {
+ var lineIndices = getLineIndices(), getPoint = generateGetLinePoint(lineIndices);
+ if (__data_groups.length > 0) { var point = getPoint(d,i); return point[0][1]; }
return getYScale(d.id)(d.value);
}
@@ -1951,6 +2018,102 @@
return typeof __bar_width === 'number' ? __bar_width : barTargetsNum ? (axis.tickOffset() * 2 * __bar_width_ratio) / barTargetsNum : 0;
}
+ //-- Area --//
+
+ function getAreaIndices() { // replication of getBarIndices
+ var indices = {}, i = 0, j, k;
+ filterTargetsToShow(c3.data.targets.filter(isAreaType)).forEach(function (d) {
+ for (j = 0; j < __data_groups.length; j++) {
+ if (__data_groups[j].indexOf(d.id) < 0) { continue; }
+ for (k = 0; k < __data_groups[j].length; k++) {
+ if (__data_groups[j][k] in indices) {
+ indices[d.id] = indices[__data_groups[j][k]];
+ break;
+ }
+ }
+ }
+ if (isUndefined(indices[d.id])) { indices[d.id] = i++; }
+ });
+ indices.__max__ = i - 1;
+ return indices;
+ }
+ function getAreaX(areaTargetsNum, areaIndices, isSub) { // partial duplication of getBarX
+ var scale = isSub ? subX : x;
+ return function (d) {
+ var areaIndex = d.id in areaIndices ? areaIndices[d.id] : 0;
+ return d.x || d.x === 0 ? scale(d.x) - 0 * (areaTargetsNum / 2 - areaIndex) : 0;
+ };
+ }
+ function getAreaY(isSub) { // replication of getBarY
+ return function (d) {
+ var scale = isSub ? getSubYScale(d.id) : getYScale(d.id);
+ return scale(d.value);
+ };
+ }
+ function getAreaOffset(areaIndices, isSub) { // partial duplication of getBarOffset
+ var targets = orderTargets(filterTargetsToShow(c3.data.targets.filter(isAreaType))),
+ targetIds = targets.map(function (t) { return t.id; });
+ return function (d, i) {
+ var scale = isSub ? getSubYScale(d.id) : getYScale(d.id),
+ y0 = scale(0), offset = y0;
+ targets.forEach(function (t) {
+ if (t.id === d.id || areaIndices[t.id] !== areaIndices[d.id]) { return; }
+ if (targetIds.indexOf(t.id) < targetIds.indexOf(d.id) && t.values[i].value > 0) {
+ offset += scale(t.values[i].value) - y0;
+ }
+ });
+ return offset;
+ };
+ }
+
+ //-- Line --//
+
+ function getLineIndices() { // replication of getBarIndices
+ var indices = {}, i = 0, j, k;
+ filterTargetsToShow(c3.data.targets.filter(isLineType)).forEach(function (d) {
+ for (j = 0; j < __data_groups.length; j++) {
+ if (__data_groups[j].indexOf(d.id) < 0) { continue; }
+ for (k = 0; k < __data_groups[j].length; k++) {
+ if (__data_groups[j][k] in indices) {
+ indices[d.id] = indices[__data_groups[j][k]];
+ break;
+ }
+ }
+ }
+ if (isUndefined(indices[d.id])) { indices[d.id] = i++; }
+ });
+ indices.__max__ = i - 1;
+ return indices;
+ }
+ function getLineX(lineTargetsNum, lineIndices, isSub) { // partial duplication of getBarX
+ var scale = isSub ? subX : x;
+ return function (d) {
+ var lineIndex = d.id in lineIndices ? lineIndices[d.id] : 0;
+ return d.x || d.x === 0 ? scale(d.x) - 0 * (lineTargetsNum / 2 - lineIndex) : 0;
+ };
+ }
+ function getLineY(isSub) { // replication of getBarY
+ return function (d) {
+ var scale = isSub ? getSubYScale(d.id) : getYScale(d.id);
+ return scale(d.value);
+ };
+ }
+ function getLineOffset(lineIndices, isSub) { // partial duplication of getBarOffset
+ var targets = orderTargets(filterTargetsToShow(c3.data.targets.filter(isLineType))),
+ targetIds = targets.map(function (t) { return t.id; });
+ return function (d, i) {
+ var scale = isSub ? getSubYScale(d.id) : getYScale(d.id),
+ y0 = scale(0), offset = y0;
+ targets.forEach(function (t) {
+ if (t.id === d.id || lineIndices[t.id] !== lineIndices[d.id]) { return; }
+ if (targetIds.indexOf(t.id) < targetIds.indexOf(d.id) && t.values[i].value > 0) {
+ offset += scale(t.values[i].value) - y0;
+ }
+ });
+ return offset;
+ };
+ }
+
//-- Type --//
function setTargetType(targetIds, type) {
@@ -1985,20 +2148,31 @@
function hasPieType(targets) {
return __data_type === 'pie' || hasType(targets, 'pie');
}
+ function hasGaugeType(targets) {
+ return hasType(targets, 'gauge');
+ }
function hasDonutType(targets) {
return __data_type === 'donut' || hasType(targets, 'donut');
}
function hasArcType(targets) {
- return hasPieType(targets) || hasDonutType(targets);
+ return hasPieType(targets) || hasDonutType(targets) || hasGaugeType(targets);
}
function isLineType(d) {
var id = (typeof d === 'string') ? d : d.id;
return !(id in __data_types) || __data_types[id] === 'line' || __data_types[id] === 'spline' || __data_types[id] === 'area' || __data_types[id] === 'area-spline';
}
+ function isStepType(d) {
+ var id = (typeof d === 'string') ? d : d.id;
+ return !(id in __data_types) || __data_types[id] === 'step' || __data_types[id] === 'area-step';
+ }
function isSplineType(d) {
var id = (typeof d === 'string') ? d : d.id;
return __data_types[id] === 'spline' || __data_types[id] === 'area-spline';
}
+ function isAreaType(d) {
+ var id = (typeof d === 'string') ? d : d.id;
+ return __data_types[id] === 'area';
+ }
function isBarType(d) {
var id = (typeof d === 'string') ? d : d.id;
return __data_types[id] === 'bar';
@@ -2011,16 +2185,23 @@
var id = (typeof d === 'string') ? d : d.id;
return __data_types[id] === 'pie';
}
+ function isGaugeType(d) {
+ var id = (typeof d === 'string') ? d : d.id;
+ return __data_types[id] === 'gauge';
+ }
function isDonutType(d) {
var id = (typeof d === 'string') ? d : d.id;
return __data_types[id] === 'donut';
}
function isArcType(d) {
- return isPieType(d) || isDonutType(d);
+ return isPieType(d) || isDonutType(d) || isGaugeType(d);
}
function lineData(d) {
return isLineType(d) ? [d] : [];
}
+ function stepData(d) {
+ return isStepType(d) ? [d] : [];
+ }
function arcData(d) {
return isArcType(d.data) ? [d] : [];
}
@@ -2035,6 +2216,9 @@
function lineOrScatterData(d) {
return isLineType(d) || isScatterType(d) ? d.values : [];
}
+ function lineOrStepData(d) {
+ return isLineType(d) || isStepType(d) ? [d] : [];
+ }
function barOrLineData(d) {
return isBarType(d) || isLineType(d) ? d.values : [];
}
@@ -2068,6 +2252,23 @@
};
}
+ function generateLevelColor(_colors, _values) {
+ var colors = _colors,
+ levels = _values;
+
+ return function (value) {
+ for (var a=1; a 0) { var point = getPoint(d,i); return point[0][1]; } return yScaleGetter(d.id)(0); })
+ .y1(function (d, i) { if (__data_groups.length > 0) { var point = getPoint(d,i); return point[1][1]; } return yScaleGetter(d.id)(d.value); });
+ }
+
+ return function (d, i) {
+ var data = filterRemoveNull(d.values), x0, y0;
+
+ if (hasType([d], 'area') || hasType([d], 'area-spline')) {
+ isSplineType(d) ? area.interpolate("cardinal") : area.interpolate("linear");
+ return area(data);
+ } else if (hasType([d], 'area-step')) {
+ isStepType(d) ? area.interpolate("step-after") : area.interpolate("linear");
+ return area(data);
+ } else {
+ x0 = x(data[0].x);
+ y0 = getYScale(d.id)(data[0].value);
+ return __axis_rotated ? "M " + y0 + " " + x0 : "M " + x0 + " " + y0;
+ }
+ };
+ }
+
+ function generateDrawLine(lineIndices, isSub) {
+ var getPoint = generateGetLinePoint(lineIndices, isSub),
+ yScaleGetter = isSub ? getSubYScale : getYScale,
+ xValue = isSub ? subxx : xx,
+ yValue = function (d,i) { if (__data_groups.length > 0) { var point = getPoint(d,i); return point[0][1]; } return yScaleGetter(d.id)(d.value); },
line = d3.svg.line()
.x(__axis_rotated ? yValue : xValue)
.y(__axis_rotated ? xValue : yValue);
@@ -2290,6 +2494,9 @@
line.interpolate(isSplineType(d) ? "cardinal" : "linear");
return line(data);
}
+ } else if (isStepType(d)) {
+ line.interpolate("step-after");
+ return line(data);
} else {
if (data[0]) {
x0 = x(data[0].x);
@@ -2344,6 +2551,28 @@
}
}
+ function generateGetAreaPoint(areaIndices, isSub) { // partial duplication of generateGetBarPoints
+ var areaTargetsNum = areaIndices.__max__ + 1,
+ x = getAreaX(areaTargetsNum, areaIndices, !!isSub),
+ y = getAreaY(!!isSub),
+ areaOffset = getAreaOffset(areaIndices, !!isSub),
+ yScale = isSub ? getSubYScale : getYScale;
+ return function (d, i) {
+ var y0 = yScale(d.id)(0),
+ offset = areaOffset(d, i) || y0, // offset is for stacked area chart
+ posX = x(d), posY = y(d);
+ // fix posY not to overflow opposite quadrant
+ if (__axis_rotated) {
+ if ((d.value > 0 && posY < offset) || (d.value < 0 && posY > offset)) { posY = offset; }
+ }
+ // 1 point that marks the area position
+ return [
+ [posX, offset],
+ [posX, posY - (y0 - offset)]
+ ];
+ };
+ }
+
function generateGetBarPoints(barIndices, isSub) {
var barTargetsNum = barIndices.__max__ + 1,
barW = getBarW(xAxis, barTargetsNum),
@@ -2369,6 +2598,27 @@
};
}
+ function generateGetLinePoint(lineIndices, isSub) { // partial duplication of generateGetBarPoints
+ var lineTargetsNum = lineIndices.__max__ + 1,
+ x = getLineX(lineTargetsNum, lineIndices, !!isSub),
+ y = getLineY(!!isSub),
+ lineOffset = getLineOffset(lineIndices, !!isSub),
+ yScale = isSub ? getSubYScale : getYScale;
+ return function (d, i) {
+ var y0 = yScale(d.id)(0),
+ offset = lineOffset(d, i) || y0, // offset is for stacked area chart
+ posX = x(d), posY = y(d);
+ // fix posY not to overflow opposite quadrant
+ if (__axis_rotated) {
+ if ((d.value > 0 && posY < offset) || (d.value < 0 && posY > offset)) { posY = offset; }
+ }
+ // 1 point that marks the line position
+ return [
+ [posX, posY - (y0 - offset)]
+ ];
+ };
+ }
+
function lineWithRegions(d, x, y, _regions) {
var prev = -1, i, j;
var s = "M", sWithRegion;
@@ -2595,6 +2845,15 @@
updateLegend(mapToIds(c3.data.targets), {withTransform: false, withTransitionForTransform: false});
/*-- Main Region --*/
+ if (c3.data.targets.length == 0) {
+ main.append("text")
+ .attr("class", CLASS.text)
+ .attr("x", (main[0][0].parentNode.width.baseVal.value / 2) - margin.left)
+ .attr("y", (main[0][0].parentNode.height.baseVal.value / 2) - margin.top)
+ .attr("text-anchor", "middle")
+ .attr("style", (__data_empty_label_fill ? "fill:"+ __data_empty_label_fill +"; " : "") + (__data_empty_label_size ? "font-size:"+ __data_empty_label_size +"; " : "") )
+ .text(__data_empty_label_text);
+ }
// Grids
grid = main.append('g')
@@ -3097,15 +3356,20 @@
function redraw(options, transitions) {
var xgrid, xgridAttr, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine;
- var mainLine, mainArea, mainCircle, mainBar, mainArc, mainRegion, mainText, contextLine, contextBar, eventRect, eventRectUpdate;
- var barIndices = getBarIndices(), maxDataCountTarget, tickOffset;
+ var mainLine, mainStep, mainArea, mainCircle, mainBar, mainArc, mainRegion, mainText, contextLine, contextStep, contextArea, contextBar, eventRect, eventRectUpdate;
+ var areaIndices = getAreaIndices(), barIndices = getBarIndices(), lineIndices = getLineIndices(), maxDataCountTarget, tickOffset;
var rectX, rectW;
var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend, withUpdateTranslate;
var hideAxis = hasArcType(c3.data.targets);
- var drawBar, drawBarOnSub, xForText, yForText;
+ var drawArea, drawAreaOnSub, drawBar, drawBarOnSub, drawLine, drawLineOnSub, xForText, yForText;
var duration, durationForExit, durationForAxis;
var targetsToShow = filterTargetsToShow(c3.data.targets), tickValues, i, intervalForCulling;
+ // abort if no targets to show
+ if (targetsToShow.length === 0 && __data_empty_abort) {
+ return;
+ }
+
options = options || {};
withY = getOption(options, "withY", true);
withSubchart = getOption(options, "withSubchart", true);
@@ -3212,7 +3476,9 @@
}
// setup drawer - MEMO: these must be called after axis updated
+ drawArea = generateDrawArea(areaIndices, false);
drawBar = generateDrawBar(barIndices);
+ drawLine = generateDrawLine(lineIndices, false);
xForText = generateXYForText(barIndices, true);
yForText = generateXYForText(barIndices, false);
@@ -3352,8 +3618,11 @@
.data(barData);
mainBar.enter().append('path')
.attr("class", classBar)
- .style("stroke", 'none')
- .style("fill", color);
+ .style("stroke", function (d) { return color(d.id); })//'none')
+ .style("stroke-width", 2)
+ .style("opacity", 0)
+ .style("fill", function (d) { return color(d.id); })
+ .style("fill-opacity", function () { if (__color_opacity) { return __color_opacity; } return initialOpacity; });
mainBar
.style("opacity", initialOpacity)
.transition().duration(duration)
@@ -3373,15 +3642,30 @@
mainLine
.style("opacity", initialOpacity)
.transition().duration(duration)
- .attr("d", lineOnMain)
+ .attr("d", drawLine)
.style("stroke", color)
.style("opacity", 1);
mainLine.exit().transition().duration(durationForExit)
.style('opacity', 0)
.remove();
-
+ // steps
+ mainStep = main.selectAll('.' + CLASS.steps).selectAll('.' + CLASS.step)
+ .data(stepData);
+ mainStep.enter().append('path')
+ .attr('class', classStep)
+ .style("stroke", color);
+ mainStep
+ .style("opacity", initialOpacity)
+ .transition().duration(duration)
+ .attr("d", drawLine)
+ .style("stroke", color)
+ .style("opacity", 1);
+ mainStep.exit().transition().duration(durationForExit)
+ .style('opacity', 0)
+ .remove();
+ // area
mainArea = main.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area)
- .data(lineData);
+ .data(lineOrStepData);
mainArea.enter().append('path')
.attr("class", classArea)
.style("fill", color)
@@ -3389,7 +3673,7 @@
mainArea
.style("opacity", 0)
.transition().duration(duration)
- .attr("d", areaOnMain)
+ .attr("d", drawArea)//areaOnMain)
.style("fill", color)
.style("opacity", orgAreaOpacity);
mainArea.exit().transition().duration(durationForExit)
@@ -3439,6 +3723,23 @@
// arc
mainArc = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arc)
.data(arcData);
+ if (__gauge_style === "arc") {
+ mainArc.enter().append("path")
+ .attr("class", "")
+ .style("opacity", 1)
+ .style("fill", __gauge_color) // Where background color would receive customization.
+ .style("cursor", "pointer")
+ .attr("transform", "scale(1,1)")
+ .attr("d", function (d) {
+ d.value = __gauge_max;
+ d.startAngle = -1*(Math.PI/2);
+ d.endAngle = Math.PI/2;
+ return getArc(d, true);
+ });
+ mainArc.exit().transition().duration(durationForExit)
+ .style('opacity', 0)
+ .remove();
+ }
mainArc.enter().append('path')
.attr("class", classArc)
.style("fill", function (d) { return color(d.data); })
@@ -3499,13 +3800,14 @@
};
}
*/
+ if (isNaN(this._current.endAngle)) this._current.endAngle = this._current.startAngle;
interpolate = d3.interpolate(this._current, updated);
this._current = interpolate(0);
return function (t) { return getArc(interpolate(t), true); };
})
.attr("transform", withTransform ? "scale(1)" : "")
- .style("fill", function (d) { return color(d.data); })
- .style("opacity", 1)
+ .style("fill", function (d) { return (__gauge_style === 'arc' && __color_values) ? levelColor(d.data.values[0].value) : color(d.data.id); }) // Where gauge reading color would receive customization.//color(d.data); })
+ .style("opacity", (__color_opacity) ? __color_opacity : 1)//1)
.call(endall, function () {
transiting = false;
});
@@ -3518,8 +3820,28 @@
.attr("transform", transformForArcLabel)
.transition().duration(duration)
.style("opacity", function (d) { return isTargetToShow(d.data.id) && isArcType(d.data) ? 1 : 0; });
+ if (__gauge_style === "arc") {
+ main.selectAll('.' + CLASS.chartArc).select('text.units')
+ .attr("transform", transformForArcLabel)
+ .style("opacity", 0)
+ .transition().duration(duration)
+ .text((__gauge_label_show) ? __gauge_units : '')
+ .style("opacity", function (d) { return isTargetToShow(d.data.id) && isArcType(d.data) ? 1 : 0; });
+ main.selectAll('.' + CLASS.chartArc).select('text.min')
+ .attr("transform", transformForArcLabel)
+ .style("opacity", 0)
+ .transition().duration(duration)
+ .text((__gauge_label_show) ? __gauge_min : '')
+ .style("opacity", function (d) { return isTargetToShow(d.data.id) && isArcType(d.data) ? 1 : 0; });
+ main.selectAll('.' + CLASS.chartArc).select('text.max')
+ .attr("transform", transformForArcLabel)
+ .style("opacity", 0)
+ .transition().duration(duration)
+ .text((__gauge_label_show) ? __gauge_max : '')
+ .style("opacity", function (d) { return isTargetToShow(d.data.id) && isArcType(d.data) ? 1 : 0; });
+ }
main.select('.' + CLASS.chartArcsTitle)
- .style("opacity", hasDonutType(c3.data.targets) ? 1 : 0);
+ .style("opacity", hasDonutType(c3.data.targets) || hasGaugeType(c3.data.targets) ? 1 : 0);
// subchart
if (__subchart_show) {
@@ -3540,7 +3862,9 @@
brush.extent(x.orgDomain()).update();
}
// setup drawer - MEMO: this must be called after axis updated
+ drawAreaOnSub = generateDrawArea(areaIndices, true);
drawBarOnSub = generateDrawBar(barIndices, true);
+ drawLineOnSub = generateDrawLine(lineIndices, true);
// bars
contextBar = context.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar)
.data(barData);
@@ -3565,11 +3889,41 @@
contextLine
.style("opacity", initialOpacity)
.transition().duration(duration)
- .attr("d", lineOnSub)
+ .attr("d", drawLineOnSub)
.style('opacity', 1);
contextLine.exit().transition().duration(duration)
.style('opacity', 0)
.remove();
+ // steps
+ contextStep = context.selectAll('.' + CLASS.steps).selectAll('.' + CLASS.step)
+ .data(stepData);
+ contextStep.enter().append('path')
+ .attr('class', classLine)
+ .style('stroke', color);
+ contextStep
+ .style("opacity", initialOpacity)
+ .transition().duration(duration)
+ .attr("d", drawLineOnSub)
+ .style('opacity', 1);
+ contextStep.exit().transition().duration(duration)
+ .style('opacity', 0)
+ .remove();
+ // area
+ contextArea = context.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area)
+ .data((isStepType ? stepData : lineData));
+ contextArea.enter().append('path')
+ .attr("class", classArea)
+ .style("fill", color)
+ .style("opacity", function () { orgAreaOpacity = +d3.select(this).style('opacity'); return 0; });
+ contextArea
+ .style("opacity", 0)
+ .transition().duration(duration)
+ .attr("d", drawAreaOnSub)
+ .style("fill", color)
+ .style("opacity", orgAreaOpacity);
+ contextArea.exit().transition().duration(durationForExit)
+ .style('opacity', 0)
+ .remove();
}
}
@@ -3614,11 +3968,13 @@
if ((isCustomX || isTimeSeries) && !isCategorized) {
rectW = function (d, i) {
var prevX = getPrevX(i), nextX = getNextX(i), dx = c3.data.xs[d.id][i];
- return (x(nextX ? nextX : dx * 1.1) - x(prevX ? prevX : dx * 0.9)) / 2;
+ var xnX = x(nextX ? nextX : dx);
+ var xpX = x(prevX ? prevX : dx);
+ return (xnX - xpX) / 2;
};
rectX = function (d, i) {
var prevX = getPrevX(i), dx = c3.data.xs[d.id][i];
- return (x(dx) + x(prevX ? prevX : dx * 0.9)) / 2;
+ return (x(dx) + x(prevX ? prevX : dx)) / 2;
};
} else {
rectW = getEventRectWidth();
@@ -3792,6 +4148,9 @@
// Lines for each data
mainLineEnter.append('g')
.attr("class", classLines);
+ // Steps
+ mainLineEnter.append('g')
+ .attr('class', classSteps);
// Areas
mainLineEnter.append('g')
.attr('class', classAreas);
@@ -3819,10 +4178,40 @@
mainPieEnter.append('g')
.attr('class', classArcs);
mainPieEnter.append("text")
- .attr("dy", ".35em")
+ .attr("dy", __gauge_style === "arc" ? "-0.35em" : ".35em")
.style("opacity", 0)
.style("text-anchor", "middle")
- .style("pointer-events", "none");
+ .style("pointer-events", "none")
+ .style("font-size", width / 10 + "px");
+ if (__gauge_style === "arc") {
+ mainPieEnter.select('text').style('fill', '#000');
+ mainPieEnter.append("text")
+ .attr("dy", ".75em")
+ .attr("class", "units")
+ .style("opacity", 0)
+ .style("text-anchor", "middle")
+ .style("pointer-events", "none")
+ .style('fill', '#000')
+ .style("font-size", width / 15 + "px");
+ mainPieEnter.append("text")
+ .attr("dx", -1*(innerRadius+((radius-innerRadius)/2)) + "px")
+ .attr("dy", "1em")
+ .attr("class", "min")
+ .style("opacity", 0)
+ .style("text-anchor", "middle")
+ .style("pointer-events", "none")
+ .style('fill', '#777')
+ .style("font-size", width / 20 + "px");
+ mainPieEnter.append("text")
+ .attr("dx", innerRadius+((radius-innerRadius)/2) + "px")
+ .attr("dy", "1em")
+ .attr("class", "max")
+ .style("opacity", 0)
+ .style("text-anchor", "middle")
+ .style("pointer-events", "none")
+ .style('fill', '#777')
+ .style("font-size", width / 20 + "px");
+ }
// MEMO: can not keep same color..., but not bad to update color in redraw
//mainPieUpdate.exit().remove();
@@ -3848,8 +4237,14 @@
.style('opacity', 0)
.attr('class', classChartLine);
// Lines for each data
- contextLineEnter.append('g')
+ contextLineEnter.append("g")
.attr("class", classLines);
+ // Steps
+ contextLineEnter.append("g")
+ .attr("class", classSteps);
+ // Area
+ contextLineEnter.append("g")
+ .attr("class", classAreas);
}
/*-- Show --*/
@@ -4656,7 +5051,7 @@
}
function generateTicks(scale) {
var i, domain, ticks = [];
- if (scale.ticks) {
+ if (scale.ticks && tickArguments != undefined) {
return scale.ticks.apply(scale, tickArguments);
}
domain = scale.domain();
diff --git a/c3.min.js b/c3.min.js
index 276b0e6..b0ccc80 100644
--- a/c3.min.js
+++ b/c3.min.js
@@ -1,3 +1 @@
-!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=Gj.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Gj.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Gj.select("."+g.axisY2),a&&(e=e.transition())),Gj.attr("transform",qj.main),c.attr("transform",qj.x),d.attr("transform",qj.y),e.attr("transform",qj.y2),Gj.select("."+g.chartArcs).attr("transform",qj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Hj.select("."+g.axisX),a&&(c=c.transition())),Hj.attr("transform",qj.context),c.attr("transform",qj.subx)}function n(a){(a?Ij.transition():Ij).attr("transform",qj.legend)}function o(a,b){l(a,b),rh&&m(a,b),n(a)}function p(){var a=V(),b=U(),c=rj?0:a,d=me(Rf.data.targets),e=Ah||d?0:A("x"),f=rh&&!d?sh+e:0;og=t(),pg=u(),Ah?(hg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},ig={top:hg.top,right:0/0,bottom:20+c,left:wj}):(hg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},ig={top:pg-f-c,right:0/0,bottom:e+c,left:hg.left}),jg={top:rj?0:pg-a,right:0/0,bottom:0,left:rj?og-b:0},kg=og-hg.left-hg.right,mg=pg-hg.top-hg.bottom,0>kg&&(kg=0),0>mg&&(mg=0),lg=Ah?hg.left-wj-xj:kg,ng=Ah?mg:pg-ig.top-ig.bottom,0>lg&&(lg=0),0>ng&&(ng=0),tg=kg-(rj?b+10:0),ug=mg-(rj?0:10),r(),rj&&d&&(jg.left=tg/2+1.1*rg)}function q(){Gj.select("line."+g.xgridFocus).attr("x1",Ah?0:-10).attr("x2",Ah?kg:-10).attr("y1",Ah?-10:hg.top).attr("y2",Ah?-10:mg)}function r(){rg=Math.min(tg,ug)/2,qg=.95*rg,sg=le(Rf.data.targets)?.6*qg:0}function s(){var a=Ah?g.axisX:g.axisY,b=Gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Kj.node().getBoundingClientRect(),e=me(Rf.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return Uf?Uf:C()}function u(){var a=Vf?Vf:D();return a>0?a:320}function v(){return Yf?Yf:0}function w(){return Zf?Zf:0}function x(){return Wf?Wf:Ah?Bh?Math.max(Le(z("x")),40):1:!Th||Yh?1:Le(z("y"))}function y(){var a=10,b=rj?U()+20:0;return Xf?Xf:Ah?a+b:(!ai||fi?a:Le(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||Bh?"x"===a&&Qh?Qh:"y"!==a||Th?"y2"!==a||ai?(pb(a).isInner?30:40)+("y2"===a?-10:0):yj:uh&&!rj?10:1:0}function B(a){for(var b,c=Kj.node();c&&"BODY"!==c.tagName&&!(b=c.getBoundingClientRect()[a]);)c=c.parentNode;return b}function C(){return B("width")}function D(){var a=Kj.style("height");return a.indexOf("px")>0?+a.replace("px",""):0}function E(a){return a?-31:-(hg.left-1)}function F(a){return a?-20:-4}function G(){return E(!Ah)}function H(){return F(!Ah)}function I(){return E(Ah)}function J(){return F(Ah)}function K(a){return a?kg+2+30+30:hg.left+20}function L(a){return a?(Qh?Qh:0)+80:mg+8}function M(){return K(!Ah)}function N(){return L(!Ah)}function O(){return K(Ah)}function P(){return L(Ah)}function Q(){var a,b,c,d,e,f,g=Fc(Rf.data.targets);return g?(a=g.values[0],b=g.values[g.values.length-1],c=Hg(b.x)-Hg(a.x),0===c?Ah?mg:kg:(d=Ec(),e=ie(Rf.data.targets)?(d-($i?.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 uh?rj?tj*(sj+1):og:0}function V(){return uh?rj?pg:uj*(sj+1):0}function W(){var a,b,c=!Hg;zg=Ah?1:0,Ag=Ah?mg:kg,Bg=Ah?0:mg,Cg=Ah?kg:1,Dg=zg,Eg=Ag,Fg=Ah?0:ng,Gg=Ah?lg:1,Hg=Z(zg,Ag,c?void 0:Hg.domain(),function(){return Ng.tickOffset()}),Ig=$(Bg,Cg,c?void 0:Ig.domain()),Jg=$(Bg,Cg,c?void 0:Jg.domain()),Kg=Z(zg,Ag,Lj,function(a){return a%1?0:Qg.tickOffset()}),Lg=$(Fg,Gg,c?void 0:Lg.domain()),Mg=$(Fg,Gg,c?void 0:Mg.domain()),a=eb(),b=Lh?Lh:c?void 0:Ng.tickValues(),Ng=bb(Hg,mj,a,b),Qg=bb(Kg,pj,a,b),Og=cb(Ig,nj,Zh,_h),Pg=cb(Jg,oj,gi,ii),c||(zj.scale(Kg),$f&&Dj.scale(Hg)),X()}function X(){vg=Lb(),wg=Mb(),xg=Mb(.98)}function Y(a,b,c){return(c?Qf.time.scale():Qf.scale.linear()).range([a,b])}function Z(a,b,c,d){var e,f=Y(a,b,Zi),g=c?f.domain(c):f;$i?(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 Lj&&Lj[0]===a[0]&&Lj[1]a?a.toFixed(0):a};return Gh&&("function"==typeof Gh?a=Gh:Zi&&(a=function(a){return a?hj(Gh)(a):""})),a}function fb(a){var b;return"y"===a?b=Xh:"y2"===a?b=ei:"x"===a&&(b=Sh),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?Xh=b:"y2"===a?ei=b:"x"===a&&(Sh=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",Ah?"inner-top":"inner-right")}function nb(){return lb("y",Ah?"inner-right":"inner-top")}function ob(){return lb("y2",Ah?"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?kg/2:kg:b.isBottom?-mg:b.isMiddle?-mg/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(!Ah,mb())}function xb(){return tb(Ah,nb())}function yb(){return tb(Ah,ob())}function zb(){return ub(!Ah,mb())}function Ab(){return ub(Ah,nb())}function Bb(){return ub(Ah,ob())}function Cb(){var a=mb();return Ah?a.isInner?"1.2em":-25-Ib("x"):a.isInner?"-0.5em":Qh?Qh-10:"3em"}function Db(){var a=nb();return Ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Ib("y")}function Eb(){var a=ob();return Ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Ib("y2")}function Fb(){return vb(!Ah,mb())}function Gb(){return vb(Ah,nb())}function Hb(){return vb(Ah,ob())}function Ib(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Qf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Jb(a){var b=Gj.select("."+g.axisX+" ."+g.axisXLabel),c=Gj.select("."+g.axisY+" ."+g.axisYLabel),d=Gj.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;return yg(Mc(Rf.data.targets)).forEach(function(c){b||c.data.id!==a.data.id||(b=!0,a=c)}),b?a:null}function Lb(){var a=Qf.svg.arc().outerRadius(qg).innerRadius(sg),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=Qf.svg.arc().outerRadius(rg*(a?a:1)).innerRadius(sg);return function(a){var c=Kb(a);return c?b(c):"M 0 0"}}function Nb(a,b){return te(a.data)?vg(a,b):"M 0 0"}function Ob(a){var b,c,d,e,f,g=Kb(a),h="";return g&&(b=vg.centroid(g),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),f=(36/qg>.375?1.175-36/qg:.8)*qg/e,h="translate("+c*f+","+d*f+")"),h}function Pb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Qb(a){return uc({id:a.data.id,value:a.value,ratio:Pb(a)})}function Rb(a){var b,c,d,e;return Ub()?(b=Kb(a),c=b?b.value:null,d=Pb(b),e=Vb(),e?e(c,d):Hd(c,d)):""}function Sb(a,b){var c=Ej.selectAll("."+g.chartArc+td(a)),d=Ej.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ze(a)&&c.selectAll("path").transition().duration(50).attr("d",wg).transition().duration(100).attr("d",xg).each(function(a){se(a.data)}),b||d.style("opacity",.3)}function Tb(a){var b=Ej.selectAll("."+g.chartArc+td(a));b.selectAll("path").transition().duration(50).attr("d",vg),Ej.selectAll("."+g.arc).style("opacity",1)}function Ub(){return le(Rf.data.targets)?Ei:yi}function Vb(){return le(Rf.data.targets)?Fi:zi}function Wb(){return le(Rf.data.targets)?Hi:""}function Xb(){var a=le(Rf.data.targets)?Ii:Bi;return"function"==typeof a?a:function(){}}function Yb(){var a=le(Rf.data.targets)?Ji:Ci;return"function"==typeof a?a:function(){}}function Zb(){var a=le(Rf.data.targets)?Ki:Di;return"function"==typeof a?a:function(){}}function $b(a){var b,c,d,e,f,g,h=Hc(a),i=Tc(a);if(Xg.length>0)for(g=Vc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Qf.min(Object.keys(i).map(function(a){return Qf.min(i[a])}))}function _b(a){var b,c,d,e,f,g,h=Hc(a),i=Tc(a);if(Xg.length>0)for(g=Wc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Qf.max(Object.keys(i).map(function(a){return Qf.max(i[a])}))}function ac(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return db(a.id)===c}),m="y2"===c?ci:Vh,n="y2"===c?bi:Uh,o=b(m)?m:$b(l),p=b(n)?n:_b(l),q="y2"===c?di:Wh,r=Bd()&&Ah;return 0===l.length?"y2"===c?Jg.domain():Ig.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Cd(o,p),j=fc(Ig.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&&$h&&(f=b($h.top)?$h.top:e,g=b($h.bottom)?$h.bottom:e),"y2"===c&&hi&&(f=b(hi.top)?hi.top:e,g=b(hi.bottom)?hi.bottom:e),ie(l)&&!Vc(l)&&(g=o),[o-g,p+f])}function bc(a){return Oh?Zi?Be(Oh):Oh:Qf.min(a,function(a){return Qf.min(a.values,function(a){return a.x})})}function cc(a){return Nh?Zi?Be(Nh):Nh:Qf.max(a,function(a){return Qf.max(a.values,function(a){return a.x})})}function dc(a){var c,d,e,f,g=Gc(a),h=g[1]-g[0];return $i?d=0:ie(a)?(c=Ec(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Ph&&Ge(Ph)?(e=b(Ph.left)?Ph.left:d,f=b(Ph.right)?Ph.right:d):e=f="number"==typeof Ph?Ph:d,{left:e,right:f}}function ec(a){var b=[bc(a),cc(a)],c=b[0],d=b[1],e=dc(a),f=0,g=0;return c-d!==0||$i||(c=Zi?new Date(.5*c.getTime()):-.5,d=Zi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Zi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function fc(a){return a[1]-a[0]}function gc(a){for(var b=0;bb?0:b-c}function mc(a){var b,c=kc(a),d="y"===a.axis?Ig:Jg;return b="y"===a.axis||"y2"===a.axis?Ah?mg:"start"in a?d(a.start):mg:Ah?"end"in a?Hg(Zi?Be(a.end):a.end):mg:mg,c>b?0:b-c}function nc(a){return Rg&&a===Rg||Ge(Sg)&&He(Sg,a)}function oc(a){return!nc(a)}function pc(a){return Rg?Rg:Ge(Sg)?Sg[a]:null}function qc(a,b){var c,d=b&&Ge(b)?Hc(b):[];return d.forEach(function(b){pc(b)===a&&(c=Rf.data.xs[b])}),c}function rc(a,b){return a in Rf.data.xs&&Rf.data.xs[a]&&Rf.data.xs[a][b]?Rf.data.xs[a][b]:b}function sc(a){Object.keys(a).forEach(function(b){Sg[b]=a[b]})}function tc(a){return 1===Qf.set(Object.keys(a).map(function(b){return a[b]})).size()}function uc(a){var b;return a&&(b=Vg[a.id],a.name=b?b:a.id),a}function vc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=xc(b[d],a.id,d)}),Rf.data.xs[a.id]=b})}function wc(a,b){a.forEach(function(a){b[a.id]&&vc([a],b[a.id])})}function xc(a,c,d){var e;return e=Zi?a?a instanceof Date?a:Be(a):Be(rc(c,d)):_i&&!$i?b(a)?+a:rc(c,d):d}function yc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Rf.data.xs[c]=a.map(function(a){return a[f]}).filter(b).map(function(a,b){return xc(a,c,b)}):Rg?(d=Object.keys(Rf.data.xs),Rf.data.xs[c]=d.length>0?Rf.data.xs[d[0]]:void 0):Ge(Sg)&&(Rf.data.xs[c]=qc(f,Rf.data.targets)):Rf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Rf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ug(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=pc(b),g=a[f],h=xc(g,b,e);return _i&&$i&&0===c&&g&&(0===e&&(Eh=[]),Eh.push(g)),("undefined"==typeof a[b]||Rf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Zg&&ge(Hc(c).filter(function(a){return!(a in $g)}),Zg),c.forEach(function(a){hc(a.id_org,a)}),c}function Bc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function Cc(a){return a>0&&Rf.data.targets[0].values[a-1]?Rf.data.targets[0].values[a-1].x:void 0}function Dc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Gc(a){var b,c,d=Fc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Hc(a){return a.map(function(a){return a.id})}function Ic(a){return a?"string"==typeof a?[a]:a:Hc(Rf.data.targets)}function Jc(a,b){var c,d=Hc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Zi?new Date(i):i);j.push(e)}return Zi||(j=j.sort(function(a,b){return a-b})),j}function Pc(a){jj=jj.concat(a)}function Qc(a){jj=jj.filter(function(b){return a.indexOf(b)<0})}function Rc(a){kj=kj.concat(a)}function Sc(a){kj=kj.filter(function(b){return a.indexOf(b)<0})}function Tc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Uc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Wc(a){return Uc(a,function(a){return a>0})}function Xc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Nd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Nd(a,g))),Qd(e,b)):Od(a,b,f,g)}function Pd(a,b){var c;return c=a.map(function(a){return Od(a.values,b)}),Qd(c,b)}function Qd(a,b){var c,d;return a.forEach(function(a){var e=Ie(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Rd(a,b){return Qf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Sd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Td(){return ah&&"desc"===ah.toLowerCase()}function Ud(){return ah&&"asc"===ah.toLowerCase()}function Vd(a){var b=Ud(),c=Td();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof ah&&a.sort(ah),a}function Wd(a,c){var d,e,f,g,h,i,j,k=me(Rf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Mi&&(Jj.html(Pi(a,eb(),Dd(k),gj)).style("display","block"),d=Jj.property("offsetWidth"),e=Jj.property("offsetHeight"),k?(g=kg/2+c[0],i=mg/2+c[1]+20):(Ah?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Hg(l[0].x)+20):(f=s(),g=f+x()+Hg(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)),Jj.style("top",i+"px").style("left",g+"px"))}function Xd(){Jj.style("display","none")}function Yd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Mi&&!je(Rf.data.targets)&&!me(Rf.data.targets)){var d=Gj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(Ah?"y1":"x1",Jd).attr(Ah?"y2":"x2",Jd),tf(d,"grid")}}function Zd(){Gj.select("line."+g.xgridFocus).style("visibility","hidden")}function $d(a,b){var c,d,e,f,h=[],i=Gj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=ec(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function _d(a){return a.x||0===a.x?Hg(a.x):null}function ae(a){return _(a.id)(a.value)}function be(){var a,b,d={},e=0;return Mc(Rf.data.targets.filter(pe)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function fe(a,b){return"number"==typeof wi?wi:b?2*a.tickOffset()*xi/b:0}function ge(a,b){Ic(a).forEach(function(a){Nj[a]=b===$g[a],$g[a]=b}),a||(Zg=b)}function he(a,b){var c=!1;return a.forEach(function(a){$g[a.id]===b&&(c=!0),a.id in $g||"line"!==b||(c=!0)}),c}function ie(a){return he(a,"bar")}function je(a){return he(a,"scatter")}function ke(a){return"pie"===Zg||he(a,"pie")}function le(a){return"donut"===Zg||he(a,"donut")}function me(a){return ke(a)||le(a)}function ne(a){var b="string"==typeof a?a:a.id;return!(b in $g)||"line"===$g[b]||"spline"===$g[b]||"area"===$g[b]||"area-spline"===$g[b]}function oe(a){var b="string"==typeof a?a:a.id;return"spline"===$g[b]||"area-spline"===$g[b]}function pe(a){var b="string"==typeof a?a:a.id;return"bar"===$g[b]}function qe(a){var b="string"==typeof a?a:a.id;return"scatter"===$g[b]}function re(a){var b="string"==typeof a?a:a.id;return"pie"===$g[b]}function se(a){var b="string"==typeof a?a:a.id;return"donut"===$g[b]}function te(a){return re(a)||se(a)}function ue(a){return ne(a)?[a]:[]}function ve(a){return te(a.data)?[a]:[]}function we(a){return pe(a)?a.values:[]}function xe(a){return ne(a)||qe(a)?a.values:[]}function ye(a){return pe(a)||ne(a)?a.values:[]}function ze(a){return se(a)&&Gi||re(a)&&Ai}function Ae(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):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 Be(b){var c;try{c=Tg?Qf.time.format(Tg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Tg)}return c}function Ce(a,b){var c=Qf.mouse(a),d=Qf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function He(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ie(a,b){var c="y"===db(a.id)?Ig:Jg,d=Ah?1:0,e=Ah?0:1;return Math.pow(Hg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Je(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ke(a,b,c){return d(a[b])?a[b]:c}function Le(a){return 10*Math.ceil(a/10)}function Me(a,b){var c;return Qf.select("body").selectAll(".dummy").data([a]).enter().append("text").classed(b?b:"",!0).text(a).each(function(){c=this.getBoundingClientRect()}).remove(),c}function Ne(a,b,c){nh(b,a.node()),Gj.select("."+g.selectedCircles+sd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Yc(g.selectedCircle,c)}).attr("cx",Ah?ae:_d).attr("cy",Ah?_d:ae).attr("stroke",function(){return gj(b)}).attr("r",1.4*Ye(b)).transition().duration(100).attr("r",Ye)}function Oe(a,b,c){oh(b,a.node()),Gj.select("."+g.selectedCircles+sd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Pe(a,b,c,d){a?Ne(b,c,d):Oe(b,c,d)}function Qe(a,b){nh(b,a.node()),a.transition().duration(100).style("fill",function(){return Qf.rgb(gj(b)).brighter(.75)})}function Re(a,b){oh(b,a.node()),a.transition().duration(100).style("fill",function(){return gj(b)})}function Se(a,b,c,d){a?Qe(b,c,d):Re(b,c,d)}function Te(a,b,c,d){Se(a,b,c.data,d)}function Ue(a){return"circle"===a.nodeName?Pe:Qf.select(a).classed(g.bar)?Se:Te}function Ve(a){return a.filter(function(a){return b(a.value)})}function We(a){return pi?"function"==typeof qi?qi(a):qi:0}function Xe(a){return si?ti?ti:1.75*We(a):We(a)}function Ye(a){return ui?ui:4*We(a)}function Ze(a,c){return(c?Gj.selectAll("."+g.circles+sd(c)):Gj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function $e(a,b){Ze(a,b).classed(g.EXPANDED,!0).attr("r",Xe)}function _e(a){Ze(a).filter(function(){return Qf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",We)}function af(a){return Gj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function bf(a){af(a).classed(g.EXPANDED,!0)}function cf(a){af(a).classed(g.EXPANDED,!1)}function df(a){var b=a?ab:_,c=a?Jd:Md,d=function(a){return b(a.id)(a.value)},e=Qf.svg.line().x(Ah?d:c).y(Ah?c:d);return vi||(e=e.defined(function(a){return null!=a.value})),function(c){var d=vi?Ve(c.values):c.values,f=a?f:Kg,g=b(c.id),h=0,i=0;return ne(c)?bh[c.id]?kf(d,f,g,bh[c.id]):(e.interpolate(oe(c)?"cardinal":"linear"),e(d)):(d[0]&&(h=f(d[0].x),i=g(d[0].value)),Ah?"M "+i+" "+h:"M "+h+" "+i)}}function ef(a,b){var c=jf(a,b);return function(a,b){var d=c(a,b),e=Ah?1:0,f=Ah?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";
-return g}}function ff(a,b){var c=jf(a,!1),d=b?gf:hf;return function(a,b){return d(c(a,b),a,this)}}function gf(a,b){var c;return Ah?(c=pe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function hf(a,b,c){var d=c.getBoundingClientRect();return Ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:pe(b)?-3:-6)}function jf(a,b){var c=a.__max__+1,d=fe(Ng,c),e=ce(d,c,a,!!b),f=de(!!b),g=ee(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 Ah&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function kf(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 lf(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),uf({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 mf(b){var c,d,e,f=!0;if(Kj=Qf.select(Tf),Kj.empty()&&(Kj=Qf.select(document.createElement("div")).style("opacity",0),lf(Kj),f=!1),Kj.html("").classed("c3",!0),Rf.data.xs={},Rf.data.targets=Ac(b),fh&&(Rf.data.targets=Rf.data.targets.filter(fh)),eh&&Pc(eh===!0?Hc(Rf.data.targets):eh),p(),W(),Hg.domain(Qf.extent(ec(Rf.data.targets))),Ig.domain(ac(Rf.data.targets,"y")),Jg.domain(ac(Rf.data.targets,"y2")),Kg.domain(Hg.domain()),Lg.domain(Ig.domain()),Mg.domain(Jg.domain()),Lj=Hg.domain(),zj.scale(Kg),$f&&Dj.scale(Hg),Ej=Kj.append("svg").style("overflow","hidden").on("mouseenter",cg).on("mouseleave",dg),Fj=Ej.append("defs"),Fj.append("clipPath").attr("id",Ti).append("rect"),Fj.append("clipPath").attr("id",Ui).append("rect"),Fj.append("clipPath").attr("id",Vi).append("rect"),yf(),Gj=Ej.append("g").attr("transform",qj.main),Hj=Ej.append("g").attr("transform",qj.context),Ij=Ej.append("g").attr("transform",qj.legend),rh||Hj.style("visibility","hidden"),uh||(Ij.style("visibility","hidden"),kj=Hc(Rf.data.targets)),Jj=Kj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Lf(Hc(Rf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Gj.append("g").attr("clip-path",Wi).attr("class",g.grid),ji&&d.append("g").attr("class",g.xgrids),Ge(li)&&d.append("g").attr("class",g.xgridLines),ri&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),mi&&d.append("g").attr("class",g.ygrids),Ge(ni)&&d.append("g").attr("class",g.ygridLines),Gj.append("g").attr("clip-path",Wi).attr("class",g.regions),Gj.append("g").attr("clip-path",Wi).attr("class",g.chart),c=Gj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",$f?Ah?"ns-resize":"ew-resize":null),Gj.select("."+g.chart).append("g").attr("class",g.chartBars),Gj.select("."+g.chart).append("g").attr("class",g.chartLines),Gj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",qj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Wb()),Gj.select("."+g.chart).append("g").attr("class",g.chartTexts),$f&&Gj.insert("rect",ag?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",kg).attr("height",mg).style("opacity",0).style("cursor",Ah?"ns-resize":"ew-resize").call(Dj).on("dblclick.zoom",null),Rh&&zj.extent("function"!=typeof Rh?Rh:Rh(ec())),lj.x=Gj.append("g").attr("class",g.axisX).attr("clip-path",Xi).attr("transform",qj.x).style("visibility",Bh?"visible":"hidden"),lj.x.append("text").attr("class",g.axisXLabel).attr("transform",Ah?"rotate(-90)":"").style("text-anchor",Fb),lj.y=Gj.append("g").attr("class",g.axisY).attr("clip-path",Yi).attr("transform",qj.y).style("visibility",Th?"visible":"hidden"),lj.y.append("text").attr("class",g.axisYLabel).attr("transform",Ah?"":"rotate(-90)").style("text-anchor",Gb),lj.y2=Gj.append("g").attr("class",g.axisY2).attr("transform",qj.y2).style("visibility",ai?"visible":"hidden"),lj.y2.append("text").attr("class",g.axisY2Label).attr("transform",Ah?"":"rotate(-90)").style("text-anchor",Hb),Hj.append("g").attr("clip-path",Wi).attr("class",g.chart),Hj.select("."+g.chart).append("g").attr("class",g.chartBars),Hj.select("."+g.chart).append("g").attr("class",g.chartLines),Hj.append("g").attr("clip-path",Wi).attr("class",g.brush).call(zj).selectAll("rect").attr(Ah?"width":"height",Ah?lg:ng),lj.subx=Hj.append("g").attr("class",g.axisX).attr("transform",qj.subx).attr("clip-path",Ah?"":Xi),Bf(Rf.data.targets),f&&uf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Qi){if(Zi&&"string"==typeof Ri){for(Ri=Be(Ri),e=0;ef&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Sd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Se,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 rf(a){me(Rf.data.targets)||gh&&(aj=a,Gj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),bj=!0,ph())}function sf(){me(Rf.data.targets)||gh&&(Gj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Gj.selectAll("."+g.shape).classed(g.INCLUDED,!1),bj=!1,qh())}function tf(a,b){"grid"===b&&a.each(function(){var a=Qf.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 uf(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,$=be(),_=me(Rf.data.targets),ab=Mc(Rf.data.targets);if(a=a||{},E=Ke(a,"withY",!0),F=Ke(a,"withSubchart",!0),G=Ke(a,"withTransition",!0),J=Ke(a,"withTransform",!1),K=Ke(a,"withUpdateXDomain",!1),L=Ke(a,"withUpdateOrgXDomain",!1),N=Ke(a,"withUpdateTranslate",!1),M=Ke(a,"withLegend",!1),H=Ke(a,"withTransitionForExit",G),I=Ke(a,"withTransitionForAxis",G),T=G?gg:0,U=H?T:0,V=I?T:0,c=c||zf(V),N&&(Ah?(lj.x.call(Ng),lj.subx.call(Qg)):(lj.y.call(Og),lj.y2.call(Pg)),p(),W(),yf(),o(!1)),M&&uh&&Lf(Hc(Rf.data.targets),a,c),$i&&0===ab.length&&Hg.domain([0,lj.x.selectAll(".tick").size()]),ab.length&&(L&&(Hg.domain(Qf.extent(ec(ab))),Lj=Hg.domain(),$f&&Dj.scale(Hg).updateScaleExtent(),Kg.domain(Hg.domain()),zj.scale(Kg)),K&&(Hg.domain(zj.empty()?Lj:zj.extent()),$f&&Dj.scale(Hg).updateScaleExtent()),Lh||!Kh&&!Jh||(X=Oc(Nc(ab),Jh),Ng.tickValues(X),Qg.tickValues(X))),Ig.domain(ac(ab,"y")),Jg.domain(ac(ab,"y2")),lj.x.style("opacity",_?0:1),lj.y.style("opacity",_?0:1),lj.y2.style("opacity",_?0:1),lj.subx.style("opacity",_?0:1),c.axisX.call(Ng),c.axisY.call(Og),c.axisY2.call(Pg),c.axisSubX.call(Qg),Jb(G),K&&ab.length)if(Hh&&X){for(Y=1;Y=0&&Qf.select(this).style("display",b%Z?"none":"block")})}else Ej.selectAll("."+g.axisX+" .tick text").style("display","block");!Ah&&Mh&&kb(lj.x,c.axisX,Mh),O=ef($),R=ff($,!0),S=ff($,!1),Lg.domain(Ig.domain()),Mg.domain(Jg.domain()),Jj.style("display","none"),q(),Gj.select("line."+g.xgridFocus).style("visibility","hidden"),ji&&(f=$d(ki,Hg),B=$i?Ng.tickOffset():0,e=Ah?{x1:0,x2:kg,y1:function(a){return Hg(a)-B},y2:function(a){return Hg(a)-B}}:{x1:function(a){return Hg(a)+B},x2:function(a){return Hg(a)+B},y1:hg.top,y2:mg},d=Gj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Qf.select(this).attr(Ah?"y1":"x1")===(Ah?mg:0)?0:1}),d.exit().remove()),Ge(li)&&(h=Gj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(li),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",Ah?"":"rotate(-90)").attr("dx",Ah?0:-hg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(T).attr("x1",Ah?0:Kd).attr("x2",Ah?kg:Kd).attr("y1",Ah?Kd:hg.top).attr("y2",Ah?Kd:mg).style("opacity",1),h.select("text").transition().duration(T).attr("x",Ah?kg:0).attr("y",Kd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(T).style("opacity",0).remove()),E&&mi&&(j=Gj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Ig.ticks(oi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",Ah?Ig:0).attr("x2",Ah?Ig:kg).attr("y1",Ah?0:Ig).attr("y2",Ah?mg:Ig),j.exit().remove(),tf(j,"grid")),E&&Ge(ni)&&(k=Gj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(ni),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",Ah?"rotate(-90)":"").attr("dx",Ah?0:-hg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",Ah?Ld:0).attr("x2",Ah?Ld:kg).attr("y1",Ah?0:Ld).attr("y2",Ah?mg:Ld).style("opacity",1),k.select("text").transition().duration(T).attr("x",Ah?0:kg).attr("y",Ld).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),u=Gj.select("."+g.regions).selectAll("."+g.region).data(Li),u.enter().append("g").attr("class",ld).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(T).attr("x",jc).attr("y",kc).attr("width",lc).attr("height",mc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(T).style("opacity",0).remove(),s=Gj.selectAll("."+g.bars).selectAll("."+g.bar).data(we),s.enter().append("path").attr("class",fd).style("stroke","none").style("fill",gj),s.style("opacity",xd).transition().duration(T).attr("d",O).style("fill",gj).style("opacity",1),s.exit().transition().duration(U).style("opacity",0).remove(),m=Gj.selectAll("."+g.lines).selectAll("."+g.line).data(ue),m.enter().append("path").attr("class",bd).style("stroke",gj),m.style("opacity",xd).transition().duration(T).attr("d",Aj).style("stroke",gj).style("opacity",1),m.exit().transition().duration(U).style("opacity",0).remove(),n=Gj.selectAll("."+g.areas).selectAll("."+g.area).data(ue),n.enter().append("path").attr("class",jd).style("fill",gj).style("opacity",function(){return Mj=+Qf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(T).attr("d",Cj).style("fill",gj).style("opacity",Mj),n.exit().transition().duration(U).style("opacity",0).remove(),pi&&(r=Gj.selectAll("."+g.circles).selectAll("."+g.circle).data(xe),r.enter().append("circle").attr("class",dd).attr("r",We).style("fill",gj),r.style("opacity",xd).transition().duration(T).style("opacity",zd).style("fill",gj).attr("cx",Ah?ae:_d).attr("cy",Ah?_d:ae),r.exit().remove()),Bd()&&(v=Gj.selectAll("."+g.texts).selectAll("."+g.text).data(ye),v.enter().append("text").attr("class",Zc).attr("text-anchor",function(a){return Ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",gj).style("fill-opacity",0),v.text(function(a){return Id(a.id)(a.value,a.id)}).style("fill-opacity",yd).transition().duration(T).attr("x",R).attr("y",S).style("fill",gj).style("fill-opacity",Ad),v.exit().transition().duration(U).style("fill-opacity",0).remove()),t=Gj.selectAll("."+g.arcs).selectAll("."+g.arc).data(ve),t.enter().append("path").attr("class",hd).style("fill",function(a){return gj(a.data)}).style("cursor",function(a){return ih(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;ej||(c=Kb(a),d=Qb(c),e=Yb(),Sb(c.data.id),Hf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Kb(a),c=Qb(b),d=[c];Wd(d,Qf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;ej||(c=Kb(a),d=Qb(c),e=Zb(),Tb(c.data.id),If(),Xd(),e(d,b))}).on("click",function(a,b){var c=Kb(a),d=Qb(c),e=Xb();pf(this,a,b),e(d,b)}),t.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){ej=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Kb(a);return c?(b=Qf.interpolate(this._current,c),this._current=b(0),function(a){return Nb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return gj(a.data)}).style("opacity",1).call(Je,function(){ej=!1}),t.exit().transition().duration(U).style("opacity",0).remove(),Gj.selectAll("."+g.chartArc).select("text").style("opacity",0).text(Rb).attr("transform",Ob).transition().duration(T).style("opacity",function(a){return Kc(a.data.id)&&te(a.data)?1:0}),Gj.select("."+g.chartArcsTitle).style("opacity",le(Rf.data.targets)?1:0),rh&&(Qf.event&&"zoom"===Qf.event.type&&zj.extent(Hg.orgDomain()).update(),F&&(!Ah&&Mh&&kb(lj.subx,c.axisSubX,Mh),zj.empty()||zj.extent(Hg.orgDomain()).update(),P=ef($,!0),x=Hj.selectAll("."+g.bars).selectAll("."+g.bar).data(we),x.enter().append("path").attr("class",fd).style("stroke","none").style("fill",gj),x.style("opacity",xd).transition().duration(T).attr("d",P).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove(),w=Hj.selectAll("."+g.lines).selectAll("."+g.line).data(ue),w.enter().append("path").attr("class",bd).style("stroke",gj),w.style("opacity",xd).transition().duration(T).attr("d",Bj).style("opacity",1),w.exit().transition().duration(T).style("opacity",0).remove())),Gj.selectAll("."+g.selectedCircles).filter(function(a){return pe(a)}).selectAll("circle").remove(),Gj.selectAll("."+g.selectedCircle).transition().duration(T).attr("cx",Ah?ae:_d).attr("cy",Ah?_d:ae),bg&&(y=Gj.select("."+g.eventRects),Ge(Sg)&&!tc(Sg)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Gj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),of(z.enter()),z.attr("x",0).attr("y",0).attr("width",kg).attr("height",mg)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),!_i&&!Zi||$i?(D=Q(),C=function(a){return Hg(a.x)-D/2}):(D=function(a,b){var c=Cc(b),d=Dc(b),e=Rf.data.xs[a.id][b];return(Hg(d?d:1.1*e)-Hg(c?c:.9*e))/2},C=function(a,b){var c=Cc(b),d=Rf.data.xs[a.id][b];return(Hg(d)+Hg(c?c:.9*d))/2}),A=Fc(Rf.data.targets),Gj.select("."+g.eventRects).datum(A?A.values:[]),z=Gj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),nf(z.enter()),z.attr("class",md).attr("x",Ah?0:C).attr("y",Ah?C:0).attr("width",Ah?kg:D).attr("height",Ah?D:mg),z.exit().remove())),Hc(Rf.data.targets).forEach(function(a){Nj[a]=!0})}function vf(){uf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function wf(){if(0!==Mc(Rf.data.targets).length){if("mousemove"===Qf.event.sourceEvent.type&&Dj.altDomain)return Hg.domain(Dj.altDomain),void Dj.scale(Hg).updateScaleExtent();$i&&Hg.orgDomain()[0]===Lj[0]&&Hg.domain([Lj[0]-1e-10,Hg.orgDomain()[1]]),uf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Qf.event.sourceEvent.type&&(cj=!0)}}function xf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function yf(){Ej.attr("width",og).attr("height",pg),Ej.select("#"+Ti).select("rect").attr("width",kg).attr("height",mg),Ej.select("#"+Ui).select("rect").attr("x",G).attr("y",H).attr("width",M).attr("height",N),Ej.select("#"+Vi).select("rect").attr("x",I).attr("y",J).attr("width",O).attr("height",P),Ej.select("."+g.zoomRect).attr("width",kg).attr("height",mg),Kj.style("max-height",pg+"px")}function zf(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 Af(a){var b;a=a||{},a.withTransition=Ke(a,"withTransition",!0),a.withTransform=Ke(a,"withTransform",!1),a.withLegend=Ke(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&uh||(b=zf(a.withTransitionForAxis?gg:0),p(),W(),yf(),o(a.withTransition,b)),uf(a,b)}function Bf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Gj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",od),j=i.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",$c),e=Gj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",qd),d=e.enter().append("g").attr("class",qd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",gd).style("cursor",function(a){return ih(a)?"pointer":null}),c=Gj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",pd),b=c.enter().append("g").attr("class",pd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",cd),b.append("g").attr("class",kd),b.append("g").attr("class",function(a){return Yc(g.selectedCircles,a.id)}),b.append("g").attr("class",ed).style("cursor",function(a){return ih(a)?"pointer":null}),a.forEach(function(a){Gj.selectAll("."+g.selectedCircles+sd(a.id)).selectAll("."+g.selectedCircle).each(function(b){b.value=a.values[b.index].value})}),h=Gj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(yg(a)).attr("class",rd),f=h.enter().append("g").attr("class",rd),f.append("g").attr("class",id),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),rh&&(n=Hj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",qd),m=n.enter().append("g").style("opacity",0).attr("class",qd),m.append("g").attr("class",gd),l=Hj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",pd),k=l.enter().append("g").style("opacity",0).attr("class",pd),k.append("g").attr("class",cd)),Ej.selectAll("."+g.target).filter(function(a){return Kc(a.id)}).transition().duration(gg).style("opacity",1)}function Cf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?ge(a.id,b.types[a.id]):ge(a.id,b.type)}),Rf.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=Me(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),uh&&!Lc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=j,C[c]=k,(!w||j>=w)&&(w=j),(!x||k>=x)&&(x=k),h=rj?x:w,void(zh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(m-h*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ij.selectAll("."+g.legendItemFocused).size();b=b||{},n=Ke(b,"withTransition",!0),q=Ke(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=Ij.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Yc(g.legendItem,a)}).style("visibility",function(a){return Lc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof wh?wh(a):Rf.toggle(a)}).on("mouseover",function(a){Qf.select(this).classed(g.legendItemFocused,!0),ej||Rf.focus(a),"function"==typeof xh&&xh(a)}).on("mouseout",function(a){Qf.select(this).classed(g.legendItemFocused,!1),ej||Rf.revert(),"function"==typeof yh&&yh(a)}),m.append("text").text(function(a){return d(Vg[a])?Vg[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",gj).attr("x",rj?h:-200).attr("y",rj?-200:j).attr("width",10).attr("height",10),r=Ij.selectAll("text").data(a).text(function(a){return d(Vg[a])?Vg[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ij.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=Ij.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",gj).attr("x",f).attr("y",j),Ij.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Kc(a)}).transition().style("opacity",function(a){var b=Qf.select(this);return Kc(a)?!G||b.classed(g.legendItemFocused)?Ff(b):Gf(b):vj}),S(w),T(x),R(F),p(),W(),yf(),o(q,c)}function Mf(a){return Jc(Rf.data.targets,a.id)}function Nf(a){return"data"in a&&Jc(Rf.data.targets,a.data.id)}function Of(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Pf(a,b,c){var d=!me(Rf.data.targets);ej=!1,ge(a,b),Af(c||{withTransitionForAxis:d})}var Qf=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,Rf={data:{},axis:{},legend:{}},Sf={},Tf=i(["bindto"],"#chart"),Uf=i(["size","width"]),Vf=i(["size","height"]),Wf=i(["padding","left"]),Xf=i(["padding","right"]),Yf=i(["padding","top"]),Zf=i(["padding","bottom"]),$f=i(["zoom","enabled"],!1),_f=i(["zoom","extent"]),ag=i(["zoom","privileged"],!1),bg=i(["interaction","enabled"],!0),cg=i(["onenter"],function(){}),dg=i(["onleave"],function(){}),eg=i(["onresize"],function(){}),fg=i(["onresized"],function(){}),gg=i(["transition","duration"],350);h("data","data is required in config");var hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng,Og,Pg,Qg,Rg=i(["data","x"]),Sg=i(["data","xs"],{}),Tg=i(["data","x_format"]),Ug=i(["data","id_converter"],function(a){return a}),Vg=i(["data","names"],{}),Wg=i(["data","classes"],{}),Xg=i(["data","groups"],[]),Yg=i(["data","axes"],{}),Zg=i(["data","type"]),$g=i(["data","types"],{}),_g=i(["data","labels"],{}),ah=i(["data","order"]),bh=i(["data","regions"],{}),ch=i(["data","color"]),dh=i(["data","colors"],{}),eh=i(["data","hide"],!1),fh=i(["data","filter"]),gh=i(["data","selection","enabled"],!1),hh=i(["data","selection","grouped"],!1),ih=i(["data","selection","isselectable"],function(){return!0}),jh=i(["data","selection","multiple"],!0),kh=i(["data","onclick"],function(){}),lh=i(["data","onenter"],function(){}),mh=i(["data","onleave"],function(){}),nh=i(["data","onselected"],function(){}),oh=i(["data","onunselected"],function(){}),ph=i(["data","ondragstart"],function(){}),qh=i(["data","ondragend"],function(){}),rh=i(["subchart","show"],!1),sh=i(["subchart","size","height"],60),th=i(["color","pattern"],[]),uh=i(["legend","show"],!0),vh=i(["legend","position"],"bottom"),wh=i(["legend","item","onclick"]),xh=i(["legend","item","onmouseover"]),yh=i(["legend","item","onmouseout"]),zh=i(["legend","equally"],!1),Ah=i(["axis","rotated"],!1),Bh=i(["axis","x","show"],!0),Ch=i(["axis","x","type"],"indexed"),Dh=i(["axis","x","localtime"],!0),Eh=i(["axis","x","categories"],[]),Fh=i(["axis","x","tick","centered"],!1),Gh=i(["axis","x","tick","format"]),Hh=i(["axis","x","tick","culling"],{}),Ih=i(["axis","x","tick","culling","max"],10),Jh=i(["axis","x","tick","count"]),Kh=i(["axis","x","tick","fit"],!0),Lh=i(["axis","x","tick","values"],null),Mh=i(["axis","x","tick","rotate"]),Nh=i(["axis","x","max"],null),Oh=i(["axis","x","min"],null),Ph=i(["axis","x","padding"],{}),Qh=i(["axis","x","height"]),Rh=i(["axis","x","default"]),Sh=i(["axis","x","label"],{}),Th=i(["axis","y","show"],!0),Uh=i(["axis","y","max"]),Vh=i(["axis","y","min"]),Wh=i(["axis","y","center"]),Xh=i(["axis","y","label"],{}),Yh=i(["axis","y","inner"],!1),Zh=i(["axis","y","tick","format"]),$h=i(["axis","y","padding"]),_h=i(["axis","y","ticks"],10),ai=i(["axis","y2","show"],!1),bi=i(["axis","y2","max"]),ci=i(["axis","y2","min"]),di=i(["axis","y2","center"]),ei=i(["axis","y2","label"],{}),fi=i(["axis","y2","inner"],!1),gi=i(["axis","y2","tick","format"]),hi=i(["axis","y2","padding"]),ii=i(["axis","y2","ticks"],10),ji=i(["grid","x","show"],!1),ki=i(["grid","x","type"],"tick"),li=i(["grid","x","lines"],[]),mi=i(["grid","y","show"],!1),ni=i(["grid","y","lines"],[]),oi=i(["grid","y","ticks"],10),pi=i(["point","show"],!0),qi=i(["point","r"],2.5),ri=i(["point","focus","line","enabled"],!0),si=i(["point","focus","expand","enabled"],!0),ti=i(["point","focus","expand","r"]),ui=i(["point","focus","select","r"]),vi=i(["line","connect_null"],!1),wi=i(["bar","width"]),xi=i(["bar","width","ratio"],.6),yi=i(["pie","label","show"],!0),zi=i(["pie","label","format"]),Ai=i(["pie","expand"],!0),Bi=i(["pie","onclick"],function(){}),Ci=i(["pie","onmouseover"],function(){}),Di=i(["pie","onmouseout"],function(){}),Ei=i(["donut","label","show"],!0),Fi=i(["donut","label","format"]),Gi=i(["donut","expand"],!0),Hi=i(["donut","title"],""),Ii=i(["donut","onclick"],function(){}),Ji=i(["donut","onmouseover"],function(){}),Ki=i(["donut","onmouseout"],function(){}),Li=i(["regions"],[]),Mi=i(["tooltip","show"],!0),Ni=i(["tooltip","format","title"]),Oi=i(["tooltip","format","value"]),Pi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Ni?Ni:b,l=Oi?Oi:c;for(f=0;f"+(h||0===h?""+h+" |
":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+" | ",e+=""+i+" | ",e+="
");
-return e+""}),Qi=i(["tooltip","init","show"],!1),Ri=i(["tooltip","init","x"],0),Si=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Ti="c3-"+ +new Date+"-clip",Ui=Ti+"-xaxis",Vi=Ti+"-yaxis",Wi=j(Ti),Xi=j(Ui),Yi=j(Vi),Zi="timeseries"===Ch,$i="categorized"===Ch,_i=!Zi&&(Rg||Ge(Sg)),aj=null,bj=!1,cj=!1,dj=!1,ej=!1,fj=Qf.scale.category10().range(),gj=Ae(dh,Ge(th)?th:fj,ch),hj=Dh?Qf.time.format:Qf.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=Ah?"left":"bottom",nj=Ah?Yh?"top":"bottom":Yh?"right":"left",oj=Ah?fi?"bottom":"top":fi?"left":"right",pj=Ah?"left":"bottom",qj={main:function(){return"translate("+k(hg.left)+","+k(hg.top)+")"},context:function(){return"translate("+k(ig.left)+","+k(ig.top)+")"},legend:function(){return"translate("+jg.left+","+jg.top+")"},x:function(){return"translate(0,"+(Ah?0:mg)+")"},y:function(){return"translate(0,"+(Ah?mg:0)+")"},y2:function(){return"translate("+(Ah?0:kg)+","+(Ah?1:0)+")"},subx:function(){return"translate(0,"+(Ah?0:ng)+")"},arc:function(){return"translate("+tg/2+","+ug/2+")"}},rj="right"===vh,sj=0,tj=0,uj=0,vj=.15,wj=30,xj=Ah&&!Bh?0:30,yj=5;yg=Qf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var zj,Aj=df(!1),Bj=df(!0),Cj=function(){var a;return a=Ah?Qf.svg.area().x0(function(a){return _(a.id)(0)}).x1(function(a){return _(a.id)(a.value)}).y(Jd):Qf.svg.area().x(Jd).y0(function(a){return _(a.id)(0)}).y1(function(a){return _(a.id)(a.value)}),function(b){var c,d,e=Ve(b.values);return he([b],"area")||he([b],"area-spline")?(a.interpolate(oe(b)?"cardinal":"linear"),a(e)):(c=e[0]?Hg(e[0].x):0,d=e[0]?_(b.id)(e[0].value):0,Ah?"M "+d+" "+c:"M "+c+" "+d)}}(),Dj=function(){};zj=Qf.svg.brush().on("brush",vf),zj.update=function(){return Hj&&Hj.select("."+g.brush).call(this),this},zj.scale=function(a){return Ah?this.y(a):this.x(a)},$f&&(Dj=Qf.behavior.zoom().on("zoomstart",function(){Dj.altDomain=Qf.event.sourceEvent.altKey?Hg.orgDomain():null}).on("zoom",$f?wf:null),Dj.scale=function(a){return Ah?this.y(a):this.x(a)},Dj.orgScaleExtent=function(){var a=_f?_f:[1,10];return[a[0],Math.max(Ec()/a[1],a[1])]},Dj.updateScaleExtent=function(){var a=fc(Hg.orgDomain())/fc(Lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Ej,Fj,Gj,Hj,Ij,Jj,Kj,Lj,Mj,Nj={};if(Rf.focus=function(a){function b(a){Mc(a).transition().duration(100).style("opacity",1)}var c=Ej.selectAll(td(a)),d=c.filter(Mf),e=c.filter(Nf);Rf.revert(),Rf.defocus(),b(d.classed(g.focused,!0)),b(e),me(Rf.data.targets)&&Sb(a,!0),Hf(a,!0)},Rf.defocus=function(a){function b(a){Mc(a).transition().duration(100).style("opacity",.3)}var c=Ej.selectAll(td(a)),d=c.filter(Mf),e=c.filter(Nf);Rf.revert(),b(d.classed(g.focused,!1)),b(e),me(Rf.data.targets)&&Tb(a),Hf(a,!1)},Rf.revert=function(a){function b(a){Mc(a).transition().duration(100).style("opacity",1)}var c=Ej.selectAll(td(a)),d=c.filter(Mf),e=c.filter(Nf);b(d.classed(g.focused,!1)),b(e),me(Rf.data.targets)&&Tb(a),If()},Rf.show=function(a,b){a=Ic(a),b=b||{},Qc(a),Ej.selectAll(ud(a)).transition().style("opacity",1),b.withLegend&&Jf(a),uf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Rf.hide=function(a,b){a=Ic(a),b=b||{},Pc(a),Ej.selectAll(ud(a)).transition().style("opacity",0),b.withLegend&&Kf(a),uf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Rf.toggle=function(a){Kc(a)?Rf.hide(a):Rf.show(a)},Rf.unzoom=function(){zj.clear().update(),uf({withUpdateXDomain:!0})},Rf.load=function(a){return a.xs&&sc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Wg[b]=a.classes[b]}),"categories"in a&&$i&&(Eh=a.categories,Ng.categories(Eh)),"cacheIds"in a&&gc(a.cacheIds)?void Cf(ic(a.cacheIds),a.done):void("unload"in a?Ef(Ic("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Df(a)}):Df(a))},Rf.unload=function(a,b){Ef(Ic(a),function(){uf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Rf.selected=function(a){return Qf.merge(Gj.selectAll("."+g.shapes+sd(a)).selectAll("."+g.shape).filter(function(){return Qf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Rf.select=function(a,b,c){gh&&Gj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Qf.select(this),i=e.data?e.data.id:e.id,j=Ue(this),k=hh||!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?ih(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Rf.unselect=function(a,b){gh&&Gj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Qf.select(this),f=c.data?c.data.id:c.id,h=Ue(this),i=hh||!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&&ih(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Rf.toLine=function(a){Pf(a,"line")},Rf.toSpline=function(a){Pf(a,"spline")},Rf.toBar=function(a){Pf(a,"bar")},Rf.toScatter=function(a){Pf(a,"scatter")},Rf.toArea=function(a){Pf(a,"area")},Rf.toAreaSpline=function(a){Pf(a,"area-spline")},Rf.toPie=function(a){Pf(a,"pie",{withTransform:!0})},Rf.toDonut=function(a){Pf(a,"donut",{withTransform:!0})},Rf.groups=function(a){return c(a)?Xg:(Xg=a,uf(),Xg)},Rf.xgrids=function(a){return a?(li=a,uf(),li):li},Rf.xgrids.add=function(a){return a?Rf.xgrids(li.concat(a)):void 0},Rf.xgrids.remove=function(a){var b=Of(a);return Rf.xgrids(li.filter(b))},Rf.ygrids=function(a){return a?(ni=a,uf(),ni):ni},Rf.ygrids.add=function(a){return a?Rf.ygrids(ni.concat(a)):void 0},Rf.ygrids.remove=function(a){var b=Of(a);return Rf.ygrids(ni.filter(b))},Rf.regions=function(a){return a?(Li=a,uf(),Li):Li},Rf.regions.add=function(a){return a?(Li=Li.concat(a),uf(),Li):Li},Rf.regions.remove=function(a){var b,c,d;return a=a||{},b=Ke(a,"duration",gg),c=Ke(a,"classes",[g.region]),d=Gj.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Li=Li.filter(function(a){var b=!1;return a.class?(a.class.split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0})},Rf.data.get=function(a){var b=Rf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Rf.data.getAsTarget=function(a){var b=Rf.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},Rf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Vg[b]=a[b]}),uf({withLegend:!0}),Vg):Vg},Rf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){dh[b]=a[b]}),uf({withLegend:!0}),dh):dh},Rf.x=function(a){return arguments.length&&(vc(Rf.data.targets,a),uf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Rf.data.xs},Rf.xs=function(a){return arguments.length&&(wc(Rf.data.targets,a),uf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Rf.data.xs},Rf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){hb(b,a[b])}),Jb())},Rf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Nh=+a.x),b(a.y)&&(Uh=+a.y),b(a.y2)&&(bi=+a.y2)):Uh=bi=+a,uf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Rf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Oh=+a.x),b(a.y)&&(Vh=+a.y),b(a.y2)&&(ci=+a.y2)):Vh=ci=+a,uf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Rf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Rf.axis.max(a.max),"undefined"!=typeof a.min&&Rf.axis.min(a.min))},Rf.legend.show=function(a){Jf(Ic(a)),uf({withLegend:!0})},Rf.legend.hide=function(a){Kf(Ic(a)),uf({withLegend:!0})},Rf.resize=function(a){Uf=a?a.width:null,Vf=a?a.height:null,Rf.flush(),Rf.flush()},Rf.flush=function(){Af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Rf.destroy=function(){Rf.data.targets=void 0,Rf.data.xs={},Kj.classed("c3",!1).html(""),a.onresize=null},"url"in f.data)Qf.xhr(f.data.url,function(a,b){var c,d=Qf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Qf.csv.parse(b.response),mf(c)});else if("rows"in f.data)mf(yc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");mf(zc(f.data.columns))}return Rf},"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(e){"use strict";function r(e){return e||e===0}function i(e){return typeof e==="undefined"}function s(e){return typeof e!=="undefined"}function o(e,t){function d(e,t){e.attr("transform",function(e){return"translate("+Math.ceil(t(e)+l)+", 0)"})}function v(e,t){e.attr("transform",function(e){return"translate(0,"+Math.ceil(t(e))+")"})}function m(e){var t=e[0],n=e[e.length-1];return t0&&r[0]>0){r.unshift(r[0]-(r[1]-r[0]))}return r}function y(){var e=n.copy(),r;if(t){r=n.domain();e.domain([r[0],r[1]-1])}return e}function b(e){var n=t&&e=0;return"url("+(n?"":document.URL.split("#")[0])+"#"+t+")"}function li(e){return Math.ceil(e)+.5}function ci(e,t){var r,i,s;if(t&&t.axisX){r=t.axisX}else{r=If.select("."+n.axisX);if(e){r=r.transition()}}if(t&&t.axisY){i=t.axisY}else{i=If.select("."+n.axisY);if(e){i=i.transition()}}if(t&&t.axisY2){s=t.axisY2}else{s=If.select("."+n.axisY2);if(e){s=s.transition()}}If.attr("transform",ri.main);r.attr("transform",ri.x);i.attr("transform",ri.y);s.attr("transform",ri.y2);If.select("."+n.chartArcs).attr("transform",ri.arc)}function hi(e,t){var r;if(t&&t.axisSubX){r=t.axisSubX}else{r=qf.select("."+n.axisX);if(e){r=r.transition()}}qf.attr("transform",ri.context);r.attr("transform",ri.subx)}function pi(e){(e?Rf.transition():Rf).attr("transform",ri.legend)}function di(e,t){ci(e,t);if(ot){hi(e,t)}pi(e)}function yi(){var e=Qi(),t=Ki(),n=ii?0:e,r=ka(a.data.targets),i=gt||r?0:Ai("x"),s=ot&&!r?ut+i:0;xr=Si();Tr=xi();if(gt){mr={top:Ai("y2")+Ti(),right:r?0:ki(),bottom:Ai("y")+n+Ni(),left:s+(r?0:Ci())};gr={top:mr.top,right:NaN,bottom:20+n,left:vi}}else{mr={top:4+Ti(),right:r?0:ki(),bottom:i+s+n+Ni(),left:r?0:Ci()};gr={top:Tr-s-n,right:NaN,bottom:i+n,left:mr.left}}yr={top:ii?0:Tr-e,right:NaN,bottom:0,left:ii?xr-t:0};br=xr-mr.left-mr.right;Er=Tr-mr.top-mr.bottom;if(br<0){br=0}if(Er<0){Er=0}wr=gt?mr.left-vi-mi:br;Sr=gt?Er:Tr-gr.top-gr.bottom;if(wr<0){wr=0}if(Sr<0){Sr=0}Lr=br-(ii?t+10:0);Ar=Er-(ii?0:10);wi();if(ii&&r){yr.left=Lr/2+Cr*1.1}}function bi(){If.select("line."+n.xgridFocus).attr("x1",gt?0:-10).attr("x2",gt?br:-10).attr("y1",gt?-10:mr.top).attr("y2",gt?-10:Er)}function wi(){Cr=Math.min(Lr,Ar)/2;Nr=Cr*.95;var e=Dn?(Nr-Dn)/Nr:.6;kr=Ca(a.data.targets)||Na(a.data.targets)?Nr*e:0}function Ei(){var e=gt?n.axisX:n.axisY,t=If.select("."+e).node(),r=t?t.getBoundingClientRect():{right:0},i=zf.node().getBoundingClientRect(),s=ka(a.data.targets),o=r.right-i.left-(s?0:Ci());return o>0?o:0}function Si(){return p?p:Mi()}function xi(){var e=d?d:_i();return e>0?e:320}function Ti(){return g?g:0}function Ni(){return y?y:0}function Ci(){if(v){return v}else if(gt){return!yt?1:Math.max(sf(Li("x")),40)}else{return!Bt||Rt?1:sf(Li("y"))}}function ki(){var e=10,t=ii?Ki()+20:0;if(m){return m}else if(gt){return e+t}else{return(!Xt||Qt?e:sf(Li("y2")))+t}}function Li(e){var t=ys(e);return t.isInner?20+js(e):40+js(e)}function Ai(e){if(e==="x"&&!yt){return 0}if(e==="x"&&Dt){return Dt}if(e==="y"&&!Bt){return ct&&!ii?10:1}if(e==="y2"&&!Xt){return gi}return(ys(e).isInner?30:40)+(e==="y2"?-10:0)}function Oi(e){var t=zf.node(),n;while(t&&t.tagName!=="BODY"){n=t.getBoundingClientRect()[e];if(n){break}t=t.parentNode}return n}function Mi(){return Oi("width")}function _i(){var e=zf.style("height");return e.indexOf("px")>0?+e.replace("px",""):0}function Di(e){return e?-(1+30):-(mr.left-1)}function Pi(e){return e?-20:-4}function Hi(){return Di(!gt)}function Bi(){return Pi(!gt)}function ji(){return Di(gt)}function Fi(){return Pi(gt)}function Ii(e){return e?br+2+30+30:mr.left+20}function qi(e){return e?(Dt?Dt:0)+80:Er+8}function Ri(){return Ii(!gt)}function Ui(){return qi(!gt)}function zi(){return Ii(gt)}function Wi(){return qi(gt)}function Xi(){var e=Ho(a.data.targets),t,n,r,i,s,o;if(!e){return 0}t=e.values[0],n=e.values[e.values.length-1];r=Ur(n.x)-Ur(t.x);if(r===0){return gt?Er:br}i=Po();s=Sa(a.data.targets)?(i-(nr?.25:1))/i:1;o=i>1?r*s/(i-1):r;return o<1?1:o}function Vi(e){si=e}function $i(e){oi=e}function Ji(e){ui=e}function Ki(){return ct?ii?oi*(si+1):xr:0}function Qi(){return ct?ii?Tr:ui*(si+1):0}function Gi(){var e,t,n=!Ur;Pr=gt?1:0;Hr=gt?Er:br;Br=gt?0:Er;jr=gt?br:1;Fr=Pr;Ir=Hr;qr=gt?0:Sr;Rr=gt?wr:1;Ur=es(Pr,Hr,n?undefined:Ur.domain(),function(){return Jr.tickOffset()});zr=ts(Br,jr,n?undefined:zr.domain());Wr=ts(Br,jr,n?undefined:Wr.domain());Xr=es(Pr,Hr,Wf,function(e){return e%1?0:Gr.tickOffset()});Vr=ts(qr,Rr,n?undefined:Vr.domain());$r=ts(qr,Rr,n?undefined:$r.domain());e=us();t=Lt?Lt:n?undefined:Jr.tickValues();Jr=is(Ur,Zr,e,t);Gr=is(Xr,ni,e,t);Kr=ss(zr,ei,Ut,Wt);Qr=ss(Wr,ti,Gt,Zt);if(!n){Hf.scale(Xr);if(b){Bf.scale(Ur)}}Yi()}function Yi(){Or=qs();Mr=Rs();_r=Rs(.98)}function Zi(e,t,n){return(n?u.time.scale():u.scale.linear()).range([e,t])}function es(e,t,n,r){var i=Zi(e,t,tr),s=n?i.domain(n):i,o;if(nr){r=r||function(){return 0};i=function(e,t){var n=s(e)+r(e);return t?n:Math.ceil(n)}}else{i=function(e,t){var n=s(e);return t?n:Math.ceil(n)}}for(o in s){i[o]=s[o]}i.orgDomain=function(){var e=s.domain();if(Wf&&Wf[0]===e[0]&&Wf[1]=0,isOuter:r.indexOf("outer")>=0,isLeft:r.indexOf("left")>=0,isCenter:r.indexOf("center")>=0,isRight:r.indexOf("right")>=0,isTop:r.indexOf("top")>=0,isMiddle:r.indexOf("middle")>=0,isBottom:r.indexOf("bottom")>=0}}function vs(){return ds("x",gt?"inner-top":"inner-right")}function ms(){return ds("y",gt?"inner-right":"inner-top")}function gs(){return ds("y2",gt?"inner-right":"inner-top")}function ys(e){return e==="y2"?gs():e==="y"?ms():vs()}function bs(){return fs("x")}function ws(){return fs("y")}function Es(){return fs("y2")}function Ss(e,t){if(e){return t.isLeft?0:t.isCenter?br/2:br}else{return t.isBottom?-Er:t.isMiddle?-Er/2:0}}function xs(e,t){if(e){return t.isLeft?"0.5em":t.isRight?"-0.5em":"0"}else{return t.isTop?"-0.5em":t.isBottom?"0.5em":"0"}}function Ts(e,t){if(e){return t.isLeft?"start":t.isCenter?"middle":"end"}else{return t.isBottom?"start":t.isMiddle?"middle":"end"}}function Ns(){return Ss(!gt,vs())}function Cs(){return Ss(gt,ms())}function ks(){return Ss(gt,gs())}function Ls(){return xs(!gt,vs())}function As(){return xs(gt,ms())}function Os(){return xs(gt,gs())}function Ms(){var e=vs();if(gt){return e.isInner?"1.2em":-25-js("x")}else{return e.isInner?"-0.5em":Dt?Dt-10:"3em"}}function _s(){var e=ms();if(gt){return e.isInner?"-0.5em":"3em"}else{return e.isInner?"1.2em":-20-js("y")}}function Ds(){var e=gs();if(gt){return e.isInner?"1.2em":"-2.2em"}else{return e.isInner?"-0.5em":30+js("y2")}}function Ps(){return Ts(!gt,vs())}function Hs(){return Ts(gt,ms())}function Bs(){return Ts(gt,gs())}function js(e){var t=0,r=e==="x"?n.axisX:e==="y"?n.axisY:n.axisY2;u.selectAll("."+r+" .tick text").each(function(){var e=this.getBoundingClientRect();if(ts?s:e.value)}return t?e:null}function qs(){var e=u.svg.arc().outerRadius(Nr).innerRadius(kr),t=function(t,n){var r;if(n){return e(t)}r=Is(t);return r?e(r):"M 0 0"};t.centroid=e.centroid;return t}function Rs(e){var t=u.svg.arc().outerRadius(Cr*(e?e:1)).innerRadius(kr);return function(e){var n=Is(e);return n?t(n):"M 0 0"}}function Us(e,t){return ja(e.data)?Or(e,t):"M 0 0"}function zs(e){var t=Is(e),n,r,i,s,o,u="";if(t){n=Or.centroid(t);r=n[0];i=n[1];s=Math.sqrt(r*r+i*i);o=(36/Nr>.375?1.175-36/Nr:.8)*Nr/s;u=Mn=="arc"?"translate(1,1)":"translate("+r*o+","+i*o+")"}return u}function Ws(e){var t=Mn=="arc"?Math.PI:Math.PI*2;return e?(e.endAngle-e.startAngle)/t:null}function Xs(e){return To({id:e.data.id,value:e.value,ratio:Ws(e)})}function Vs(e){var t,n,r,i;if(!Ks()){return""}t=Is(e);n=t?t.value:null;r=Ws(t);i=Qs();return i?i(n,r):Iu(n,r)}function $s(e,t){var r=jf.selectAll("."+n.chartArc+Nu(e)),i=jf.selectAll("."+n.arc).filter(function(t){return t.data.id!==e});if(Xa(e)){r.selectAll("path").transition().duration(50).attr("d",Mr).transition().duration(100).attr("d",_r).each(function(e){if(Ba(e.data)){}})}if(!t){i.style("opacity",.3)}}function Js(e){var t=jf.selectAll("."+n.chartArc+Nu(e));t.selectAll("path.c3-arc").transition().duration(50).attr("d",Or);jf.selectAll("."+n.arc).style("opacity",ft?ft:1)}function Ks(){if(Na(a.data.targets)){return true}return Ca(a.data.targets)?Pn:gn}function Qs(){if(Na(a.data.targets)){return Nn}return Ca(a.data.targets)?Hn:yn}function Gs(){return Ca(a.data.targets)?jn:""}function Ys(){if(Na(a.data.targets)){return typeof Ln==="function"?Ln:function(){}}var e=Ca(a.data.targets)?Fn:wn;return typeof e==="function"?e:function(){}}function Zs(){if(Na(a.data.targets)){return typeof An==="function"?An:function(){}}var e=Ca(a.data.targets)?In:En;return typeof e==="function"?e:function(){}}function eo(){if(Na(a.data.targets)){return typeof On==="function"?On:function(){}}var e=Ca(a.data.targets)?qn:Sn;return typeof e==="function"?e:function(){}}function to(e){var t=jo(e),n=Ko(e),r,i,s,o,a,f;if(P.length>0){f=Go(e);for(r=0;r=0});if(o.length===0){continue}s=o[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e<0?e:0})}for(i=1;i0)){n[s][t]+=+e}})}}}return u.min(Object.keys(n).map(function(e){return u.min(n[e])}))}function no(e){var t=jo(e),n=Ko(e),r,i,s,o,a,f;if(P.length>0){f=Yo(e);for(r=0;r=0});if(o.length===0){continue}s=o[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e>0?e:0})}for(i=1;i1?n/(i-1)/2:.5}else if(en){s=n*.001}else{s=n*.01}if(typeof _t==="object"&&Za(_t)){o=r(_t.left)?_t.left:s;u=r(_t.right)?_t.right:s}else if(typeof _t==="number"){o=u=_t}else{o=u=s}return{left:o,right:u}}function uo(e){var t=[io(e),so(e)],n=t[0],r=t[1],i=oo(e),s=0,o=0;if(n-r===0&&!nr){n=tr?new Date(n.getTime()*.5):-.5;r=tr?new Date(r.getTime()*1.5):.5}if(n||n===0){s=tr?new Date(n.getTime()-i.left):n-i.left}if(r||r===0){o=tr?new Date(r.getTime()+i.right):r+i.right}return[s,o]}function ao(e){return e[1]-e[0]}function fo(e){for(var t=0;t=0){a.data.xs[t]=e.map(function(e){return e[i]}).filter(r).map(function(e,n){return ko(e,t,n)})}else if(L){s=Object.keys(a.data.xs);a.data.xs[t]=s.length>0?a.data.xs[s[0]]:undefined}else if(Za(A)){a.data.xs[t]=wo(i,a.data.targets)}}else{a.data.xs[t]=e.map(function(e,t){return t})}});t.forEach(function(e){if(!a.data.xs[e]){throw new Error('x is not defined for id = "'+e+'".')}});i=t.map(function(t,n){var r=M(t);return{id:r,id_org:t,values:e.map(function(e,i){var s=bo(t),o=e[s],u=ko(o,t,i);if(rr&&nr&&n===0&&o){if(i===0){Et=[]}Et.push(o)}if(typeof e[t]==="undefined"||a.data.xs[t].length<=i){u=undefined}return{x:u,value:e[t]!==null&&!isNaN(e[t])?+e[t]:null,id:r}}).filter(function(e){return typeof e.x!=="undefined"})}});i.forEach(function(e){var t;e.values=e.values.sort(function(e,t){var n=e.x||e.x===0?e.x:Infinity,r=t.x||t.x===0?t.x:Infinity;return n-r});t=0;e.values.forEach(function(e){e.index=t++})});if(B){wa(jo(i).filter(function(e){return!(e in j)}),B)}i.forEach(function(e){lo(e.id_org,e)});return i}function Mo(e){return{id:e.id,id_org:e.id_org,values:e.values.map(function(e){return{x:e.x,value:e.value,id:e.id}})}}function _o(e){return e>0&&a.data.targets[0].values[e-1]?a.data.targets[0].values[e-1].x:undefined}function Do(e){return e1){e.forEach(function(e){if(e.values.length>n){r=e;n=e.values.length}})}else{r=t?e[0]:null}return r}function Bo(e){var t=Ho(e),n,r;if(!t){return[0,0]}n=t.values[0],r=t.values[t.values.length-1];return[n.x,r.x]}function jo(e){return e.map(function(e){return e.id})}function Fo(e){return e?typeof e==="string"?[e]:e:jo(a.data.targets)}function Io(e,t){var n=jo(e),r;for(r=0;r2){o=r-2;i=e[0];s=e[e.length-1];u=(s-i)/(o+1);n=[i];for(a=0;a0})}function Zo(e){return e=0;n--){if(r!==e[n].x){break}i.push(e[n])}for(n=t;n0?s=o:i=o;if(s-i===1||i===0&&s===0){f=[];if(e[i].x||e[i].x===0){f=f.concat(Xu(e,i))}if(e[s].x||e[s].x===0){f=f.concat(Xu(e,s))}return Ju(f,t)}return Vu(e,t,i,s)}function $u(e,t){var n;n=e.map(function(e){return Vu(e.values,t)});return Ju(n,t)}function Ju(e,t){var n,r;e.forEach(function(e){var i=tf(e,t);if(il){o-=u-l}if(f+i>xi()){f-=i+30}}Uf.style("top",f+"px").style("left",o+"px")}function ta(){Uf.style("display","none")}function na(e){var t=e.filter(function(e){return e&&r(e.value)});if(!Un){return}if(xa(a.data.targets)||ka(a.data.targets)){return}var i=If.selectAll("line."+n.xgridFocus);i.style("visibility","visible").data([t[0]]).attr(gt?"y1":"x1",Ru).attr(gt?"y2":"x2",Ru);tl(i,"grid")}function ra(){If.select("line."+n.xgridFocus).style("visibility","hidden")}function ia(e,t){var r=[],i,s,o,u,a=If.select("."+n.axisX).selectAll(".tick").size();if(e==="year"){i=uo();s=i[0].getFullYear();o=i[1].getFullYear();for(u=s;u<=o;u++){r.push(new Date(u+"-01-01 00:00:00"))}}else{r=t.ticks(10)}return r.slice(0,a)}function sa(e){return e.x||e.x===0?Ur(e.x):null}function oa(e,t){var n=ma(),r=Df(n);if(P.length>0){var i=r(e,t);return i[0][1]}return ns(e.id)(e.value)}function ua(){var e={},t=0,n,r;Uo(a.data.targets.filter(_a)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function ca(e,t){return typeof vn==="number"?vn:t?e.tickOffset()*2*mn/t:0}function ha(){var e={},t=0,n,r;Uo(a.data.targets.filter(Ma)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function ma(){var e={},t=0,n,r;Uo(a.data.targets.filter(La)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function wa(e,t){Fo(e).forEach(function(e){Vf[e]=t===j[e];j[e]=t});if(!e){B=t}}function Ea(e,t){var n=false;e.forEach(function(e){if(j[e.id]===t){n=true}if(!(e.id in j)&&t==="line"){n=true}});return n}function Sa(e){return Ea(e,"bar")}function xa(e){return Ea(e,"scatter")}function Ta(e){return B==="pie"||Ea(e,"pie")}function Na(e){return Ea(e,"gauge")}function Ca(e){return B==="donut"||Ea(e,"donut")}function ka(e){return Ta(e)||Ca(e)||Na(e)}function La(e){var t=typeof e==="string"?e:e.id;return!(t in j)||j[t]==="line"||j[t]==="spline"||j[t]==="area"||j[t]==="area-spline"}function Aa(e){var t=typeof e==="string"?e:e.id;return!(t in j)||j[t]==="step"||j[t]==="area-step"}function Oa(e){var t=typeof e==="string"?e:e.id;return j[t]==="spline"||j[t]==="area-spline"}function Ma(e){var t=typeof e==="string"?e:e.id;return j[t]==="area"}function _a(e){var t=typeof e==="string"?e:e.id;return j[t]==="bar"}function Da(e){var t=typeof e==="string"?e:e.id;return j[t]==="scatter"}function Pa(e){var t=typeof e==="string"?e:e.id;return j[t]==="pie"}function Ha(e){var t=typeof e==="string"?e:e.id;return j[t]==="gauge"}function Ba(e){var t=typeof e==="string"?e:e.id;return j[t]==="donut"}function ja(e){return Pa(e)||Ba(e)||Ha(e)}function Fa(e){return La(e)?[e]:[]}function Ia(e){return Aa(e)?[e]:[]}function qa(e){return ja(e.data)?[e]:[]}function Ra(e){return _a(e)?e.values:[]}function Ua(e){return La(e)||Da(e)?e.values:[]}function za(e){return La(e)||Aa(e)?[e]:[]}function Wa(e){return _a(e)||La(e)?e.values:[]}function Xa(e){return Ba(e)&&Bn||Pa(e)&&bn}function Va(e,t,n){var r=[];return function(i){var s=i.id||i,o;if(e[s]instanceof Function){o=e[s](i)}else if(e[s]){o=e[s]}else{if(r.indexOf(s)<0){r.push(s)}o=t[r.indexOf(s)%t.length]}return n instanceof Function?n(o,i):o}}function $a(e,t){var n=e,r=t;return function(e){for(var t=1;t0}function ef(e,t){var n=false;Object.keys(e).forEach(function(r){if(e[r]===t){n=true}});return n}function tf(e,t){var n=os(e.id)==="y"?zr:Wr,r=gt?1:0,i=gt?0:1;return Math.pow(Ur(e.x)-t[r],2)+Math.pow(n(e.value)-t[i],2)}function nf(e,t){var n=0;e.each(function(){++n}).each("end",function(){if(!--n){t.apply(this,arguments)}})}function rf(e,t,n){return s(e[t])?e[t]:n}function sf(e){return Math.ceil(e/10)*10}function of(e,t){var n;u.select("body").selectAll(".dummy").data([e]).enter().append("text").classed(t?t:"",true).text(e).each(function(){n=this.getBoundingClientRect()}).remove();return n}function uf(e,t,r){Y(t,e.node());If.select("."+n.selectedCircles+Tu(t.id)).selectAll("."+n.selectedCircle+"-"+r).data([t]).enter().append("circle").attr("class",function(){return eu(n.selectedCircle,r)}).attr("cx",gt?oa:sa).attr("cy",gt?sa:oa).attr("stroke",function(){return lr(t)}).attr("r",yf(t)*1.4).transition().duration(100).attr("r",yf)}function af(e,t,r){Z(t,e.node());If.select("."+n.selectedCircles+Tu(t.id)).selectAll("."+n.selectedCircle+"-"+r).transition().duration(100).attr("r",0).remove()}function ff(e,t,n,r){e?uf(t,n,r):af(t,n,r)}function lf(e,t){Y(t,e.node());e.transition().duration(100).style("fill",function(){return u.rgb(lr(t)).brighter(.75)})}function cf(e,t){Z(t,e.node());e.transition().duration(100).style("fill",function(){return lr(t)})}function hf(e,t,n,r){e?lf(t,n,r):cf(t,n,r)}function pf(e,t,n,r){hf(e,t,n.data,r)}function df(e){return e.nodeName==="circle"?ff:u.select(e).classed(n.bar)?hf:pf}function vf(e){return e.filter(function(e){return r(e.value)})}function mf(e){return an?typeof fn==="function"?fn(e):fn:0}function gf(e){return cn?hn?hn:mf(e)*1.75:mf(e)}function yf(e){return pn?pn:mf(e)*4}function bf(e,t){return(t?If.selectAll("."+n.circles+Tu(t)):If).selectAll("."+n.circle+(r(e)?"-"+e:""))}function wf(e,t){bf(e,t).classed(n.EXPANDED,true).attr("r",gf)}function Ef(e){bf(e).filter(function(){return u.select(this).classed(n.EXPANDED)}).classed(n.EXPANDED,false).attr("r",mf)}function Sf(e){return If.selectAll("."+n.bar+(r(e)?"-"+e:""))}function xf(e){Sf(e).classed(n.EXPANDED,true)}function Tf(e){Sf(e).classed(n.EXPANDED,false)}function Nf(e,t){var n,r=Mf(e,t),i=t?rs:ns;if(gt){n=u.svg.area().x0(function(e,t){return i(e.id)(0)}).x1(function(e,t){return i(e.id)(e.value)}).y(Ru)}else{n=u.svg.area().x(Ru).y0(function(e,t){if(P.length>0){var n=r(e,t);return n[0][1]}return i(e.id)(0)}).y1(function(e,t){if(P.length>0){var n=r(e,t);return n[1][1]}return i(e.id)(e.value)})}return function(e,t){var r=vf(e.values),i,s;if(Ea([e],"area")||Ea([e],"area-spline")){Oa(e)?n.interpolate("cardinal"):n.interpolate("linear");return n(r)}else if(Ea([e],"area-step")){Aa(e)?n.interpolate("step-after"):n.interpolate("linear");return n(r)}else{i=Ur(r[0].x);s=ns(e.id)(r[0].value);return gt?"M "+s+" "+i:"M "+i+" "+s}}}function Cf(e,t){var n=Df(e,t),r=t?rs:ns,i=t?Wu:Ru,s=function(e,t){if(P.length>0){var i=n(e,t);return i[0][1]}return r(e.id)(e.value)},o=u.svg.line().x(gt?s:i).y(gt?i:s);if(!dn){o=o.defined(function(e){return e.value!=null})}return function(e){var n=dn?vf(e.values):e.values,i=t?i:Xr,s=r(e.id),u=0,a=0;if(La(e)){if(q[e.id]){return Pf(n,i,s,q[e.id])}else{o.interpolate(Oa(e)?"cardinal":"linear");return o(n)}}else if(Aa(e)){o.interpolate("step-after");return o(n)}else{if(n[0]){u=i(n[0].x);a=s(n[0].value)}return gt?"M "+a+" "+u:"M "+u+" "+a}}}function kf(e,t){var n=_f(e,t);return function(e,t){var r=n(e,t);var i=gt?1:0;var s=gt?0:1;var o="M "+r[0][i]+","+r[0][s]+" "+"L"+r[1][i]+","+r[1][s]+" "+"L"+r[2][i]+","+r[2][s]+" "+"L"+r[3][i]+","+r[3][s]+" "+"z";return o}}function Lf(e,t){var n=_f(e,false),r=t?Af:Of;return function(e,t){return r(n(e,t),e,this)}}function Af(e,t){var n;if(gt){n=_a(t)?4:6;return e[2][1]+n*(t.value<0?-1:1)}else{return e[0][0]+(e[2][0]-e[0][0])/2}}function Of(e,t,n){var r=n.getBoundingClientRect();if(gt){return(e[0][0]+e[2][0]+r.height*.6)/2}else{return e[2][1]+(t.value<0?r.height:_a(t)?-3:-6)}}function Mf(e,t){var n=e.__max__+1,r=pa(n,e,!!t),i=da(!!t),s=va(e,!!t),o=t?rs:ns;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(gt){if(e.value>0&&fu){f=u}}return[[a,u],[a,f-(n-u)]]}}function _f(e,t){var n=e.__max__+1,r=ca(Jr,n),i=aa(r,n,e,!!t),s=fa(!!t),o=la(e,!!t),u=t?rs:ns;return function(e,t){var n=u(e.id)(0),a=o(e,t)||n,f=i(e),l=s(e);if(gt){if(00&&fu){f=u}}return[[a,f-(n-u)]]}}function Pf(e,t,n,r){var o=-1,u,a;var f="M",l;var c,h,p,d,v,m,g;var y,b;var w=[];if(s(r)){for(u=0;u=0){u.select(this).style("display",t%mt?"none":"block")}})}else{jf.selectAll("."+n.axisX+" .tick text").style("display","block")}}if(!gt&&At){ps(Yr.x,t.axisX,At)}G=Nf(_,false);Z=kf(D);tt=Cf(P,false);it=Lf(D,true);st=Lf(D,false);Vr.domain(zr.domain());$r.domain(Wr.domain());Uf.style("display","none");bi();If.select("line."+n.xgridFocus).style("visibility","hidden");if(tn){o=ia(nn,Ur);B=nr?Jr.tickOffset():0;s=gt?{x1:0,x2:br,y1:function(e){return Ur(e)-B},y2:function(e){return Ur(e)-B}}:{x1:function(e){return Ur(e)+B},x2:function(e){return Ur(e)+B},y1:mr.top,y2:Er};i=If.select("."+n.xgrids).selectAll("."+n.xgrid).data(o);i.enter().append("line").attr("class",n.xgrid);i.attr(s).style("opacity",function(){return+u.select(this).attr(gt?"y1":"x1")===(gt?Er:0)?0:1});i.exit().remove()}if(Za(rn)){f=If.select("."+n.xgridLines).selectAll("."+n.xgridLine).data(rn);l=f.enter().append("g").attr("class",function(e){return n.xgridLine+(e.class?e.class:"")});l.append("line").style("opacity",0);l.append("text").attr("text-anchor","end").attr("transform",gt?"":"rotate(-90)").attr("dx",gt?0:-mr.top).attr("dy",-5).style("opacity",0);f.select("line").transition().duration(ut).attr("x1",gt?0:Uu).attr("x2",gt?br:Uu).attr("y1",gt?Uu:mr.top).attr("y2",gt?Uu:Er).style("opacity",1);f.select("text").transition().duration(ut).attr("x",gt?br:0).attr("y",Uu).text(function(e){return e.text}).style("opacity",1);f.exit().transition().duration(ut).style("opacity",0).remove()}if(I&&sn){c=If.select("."+n.ygrids).selectAll("."+n.ygrid).data(zr.ticks(un));c.enter().append("line").attr("class",n.ygrid);c.attr("x1",gt?zr:0).attr("x2",gt?zr:br).attr("y1",gt?0:zr).attr("y2",gt?Er:zr);c.exit().remove();tl(c,"grid")}if(I&&Za(on)){h=If.select("."+n.ygridLines).selectAll("."+n.ygridLine).data(on);p=h.enter().append("g").attr("class",function(e){return n.ygridLine+(e.class?e.class:"")});p.append("line").style("opacity",0);p.append("text").attr("text-anchor","end").attr("transform",gt?"rotate(-90)":"").attr("dx",gt?0:-mr.top).attr("dy",-5).style("opacity",0);h.select("line").transition().duration(ut).attr("x1",gt?zu:0).attr("x2",gt?zu:br).attr("y1",gt?0:zu).attr("y2",gt?Er:zu).style("opacity",1);h.select("text").transition().duration(ut).attr("x",gt?0:br).attr("y",zu).text(function(e){return e.text}).style("opacity",1);h.exit().transition().duration(ut).style("opacity",0).remove()}E=If.select("."+n.regions).selectAll("."+n.region).data(Rn);E.enter().append("g").attr("class",vu).append("rect").style("fill-opacity",0);E.selectAll("rect").transition().duration(ut).attr("x",ho).attr("y",po).attr("width",vo).attr("height",mo).style("fill-opacity",function(e){return r(e.opacity)?e.opacity:.1});E.exit().transition().duration(ut).style("opacity",0).remove();y=If.selectAll("."+n.bars).selectAll("."+n.bar).data(Ra);y.enter().append("path").attr("class",fu).style("stroke",function(e){return lr(e.id)}).style("stroke-width",2).style("opacity",0).style("fill",function(e){return lr(e.id)}).style("fill-opacity",function(){if(ft){return ft}return Au});y.style("opacity",Au).transition().duration(ut).attr("d",Z).style("fill",lr).style("opacity",1);y.exit().transition().duration(at).style("opacity",0).remove();d=If.selectAll("."+n.lines).selectAll("."+n.line).data(Fa);d.enter().append("path").attr("class",su).style("stroke",lr);d.style("opacity",Au).transition().duration(ut).attr("d",tt).style("stroke",lr).style("opacity",1);d.exit().transition().duration(at).style("opacity",0).remove();v=If.selectAll("."+n.steps).selectAll("."+n.step).data(Ia);v.enter().append("path").attr("class",gu).style("stroke",lr);v.style("opacity",Au).transition().duration(ut).attr("d",tt).style("stroke",lr).style("opacity",1);v.exit().transition().duration(at).style("opacity",0).remove();m=If.selectAll("."+n.areas).selectAll("."+n.area).data(za);m.enter().append("path").attr("class",pu).style("fill",lr).style("opacity",function(){Xf=+u.select(this).style("opacity");return 0});m.style("opacity",0).transition().duration(ut).attr("d",G).style("fill",lr).style("opacity",Xf);m.exit().transition().duration(at).style("opacity",0).remove();if(an){g=If.selectAll("."+n.circles).selectAll("."+n.circle).data(Ua);g.enter().append("circle").attr("class",uu).attr("r",mf).style("fill",lr);g.style("opacity",Au).transition().duration(ut).style("opacity",Mu).style("fill",lr).attr("cx",gt?oa:sa).attr("cy",gt?sa:oa);g.exit().remove()}if(Du()){x=If.selectAll("."+n.texts).selectAll("."+n.text).data(Wa);x.enter().append("text").attr("class",tu).attr("text-anchor",function(e){return gt?e.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",lr).style("fill-opacity",0);x.text(function(e){return qu(e.id)(e.value,e.id)}).style("fill-opacity",Ou).transition().duration(ut).attr("x",it).attr("y",st).style("fill",lr).style("fill-opacity",_u);x.exit().transition().duration(at).style("fill-opacity",0).remove()}w=If.selectAll("."+n.arcs).selectAll("."+n.arc).data(qa);if(Mn==="arc"){w.enter().append("path").attr("class","").style("opacity",1).style("fill",xn).style("cursor","pointer").attr("transform","scale(1,1)").attr("d",function(e){e.value=Cn;e.startAngle=-1*(Math.PI/2);e.endAngle=Math.PI/2;return Us(e,true)});w.exit().transition().duration(at).style("opacity",0).remove()}w.enter().append("path").attr("class",cu).style("fill",function(e){return lr(e.data)}).style("cursor",function(e){return $(e)?"pointer":null}).style("opacity",0).each(function(e){this._current=e}).on("mouseover",function(e,t){var n,r,i;if(ar){return}n=Is(e);r=Xs(n);i=Zs();$s(n.data.id);vl(n.data.id,true);i(r,t)}).on("mousemove",function(e){var t=Is(e),n=Xs(t),r=[n];ea(r,u.mouse(this))}).on("mouseout",function(e,t){var n,r,i;if(ar){return}n=Is(e);r=Xs(n);i=eo();Js(n.data.id);ml();ta();i(r,t)}).on("click",function(e,t){var n=Is(e),r=Xs(n),i=Ys();Gf(this,e,t);i(r,t)});w.attr("transform",W?"scale(0)":"").style("opacity",function(e){return e===this._current?0:1}).each(function(){ar=true}).transition().duration(ut).attrTween("d",function(e){var t=Is(e),n;if(!t){return function(){return"M 0 0"}}if(isNaN(this._current.endAngle))this._current.endAngle=this._current.startAngle;n=u.interpolate(this._current,t);this._current=n(0);return function(e){return Us(n(e),true)}}).attr("transform",W?"scale(1)":"").style("fill",function(e){return Mn==="arc"&<?cr(e.data.values[0].value):lr(e.data.id)}).style("opacity",ft?ft:1).call(nf,function(){ar=false});w.exit().transition().duration(at).style("opacity",0).remove();If.selectAll("."+n.chartArc).select("text").style("opacity",0).text(Vs).attr("transform",zs).transition().duration(ut).style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0});if(Mn==="arc"){If.selectAll("."+n.chartArc).select("text.units").attr("transform",zs).style("opacity",0).transition().duration(ut).text(Tn?_n:"").style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0});If.selectAll("."+n.chartArc).select("text.min").attr("transform",zs).style("opacity",0).transition().duration(ut).text(Tn?kn:"").style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0});If.selectAll("."+n.chartArc).select("text.max").attr("transform",zs).style("opacity",0).transition().duration(ut).text(Tn?Cn:"").style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0})}If.select("."+n.chartArcsTitle).style("opacity",Ca(a.data.targets)||Na(a.data.targets)?1:0);if(ot){if(u.event&&u.event.type==="zoom"){Hf.extent(Ur.orgDomain()).update()}if(q){if(!gt&&At){ps(Yr.subx,t.axisSubX,At)}if(!Hf.empty()){Hf.extent(Ur.orgDomain()).update()}Y=Nf(_,true);et=kf(D,true);rt=Cf(P,true);L=qf.selectAll("."+n.bars).selectAll("."+n.bar).data(Ra);L.enter().append("path").attr("class",fu).style("stroke","none").style("fill",lr);L.style("opacity",Au).transition().duration(ut).attr("d",et).style("opacity",1);L.exit().transition().duration(ut).style("opacity",0).remove();T=qf.selectAll("."+n.lines).selectAll("."+n.line).data(Fa);T.enter().append("path").attr("class",su).style("stroke",lr);T.style("opacity",Au).transition().duration(ut).attr("d",rt).style("opacity",1);T.exit().transition().duration(ut).style("opacity",0).remove();N=qf.selectAll("."+n.steps).selectAll("."+n.step).data(Ia);N.enter().append("path").attr("class",su).style("stroke",lr);N.style("opacity",Au).transition().duration(ut).attr("d",rt).style("opacity",1);N.exit().transition().duration(ut).style("opacity",0).remove();C=qf.selectAll("."+n.areas).selectAll("."+n.area).data(Aa?Ia:Fa);C.enter().append("path").attr("class",pu).style("fill",lr).style("opacity",function(){Xf=+u.select(this).style("opacity");return 0});C.style("opacity",0).transition().duration(ut).attr("d",Y).style("fill",lr).style("opacity",Xf);C.exit().transition().duration(at).style("opacity",0).remove()}}If.selectAll("."+n.selectedCircles).filter(function(e){return _a(e)}).selectAll("circle").remove();If.selectAll("."+n.selectedCircle).transition().duration(ut).attr("cx",gt?oa:sa).attr("cy",gt?sa:oa);if(S){O=If.select("."+n.eventRects);if(Za(A)&&!xo(A)){if(!O.classed(n.eventRectsMultiple)){O.classed(n.eventRectsMultiple,true).classed(n.eventRectsSingle,false).selectAll("."+n.eventRect).remove()}M=If.select("."+n.eventRects).selectAll("."+n.eventRect).data([0]);Qf(M.enter());M.attr("x",0).attr("y",0).attr("width",br).attr("height",Er)}else{if(!O.classed(n.eventRectsSingle)){O.classed(n.eventRectsMultiple,false).classed(n.eventRectsSingle,true).selectAll("."+n.eventRect).remove()}if((rr||tr)&&!nr){F=function(e,t){var n=_o(t),r=Do(t),i=a.data.xs[e.id][t];var s=Ur(r?r:i);var o=Ur(n?n:i);return(s-o)/2};j=function(e,t){var n=_o(t),r=a.data.xs[e.id][t];return(Ur(r)+Ur(n?n:r))/2}}else{F=Xi();j=function(e){return Ur(e.x)-F/2}}H=Ho(a.data.targets);If.select("."+n.eventRects).datum(H?H.values:[]);M=If.select("."+n.eventRects).selectAll("."+n.eventRect).data(function(e){return e});Kf(M.enter());M.attr("class",mu).attr("x",gt?0:j).attr("y",gt?j:0).attr("width",gt?br:F).attr("height",gt?F:Er);M.exit().remove()}}jo(a.data.targets).forEach(function(e){Vf[e]=true})}function rl(){nl({withTransition:false,withY:false,withSubchart:false,withUpdateXDomain:true})}function il(){if(Uo(a.data.targets).length===0){return}if(u.event.sourceEvent.type==="mousemove"&&Bf.altDomain){Ur.domain(Bf.altDomain);Bf.scale(Ur).updateScaleExtent();return}if(nr&&Ur.orgDomain()[0]===Wf[0]){Ur.domain([Wf[0]-1e-10,Ur.orgDomain()[1]])}nl({withTransition:false,withY:false,withSubchart:false});if(u.event.sourceEvent.type==="mousemove"){or=true}}function sl(){function t(){e.forEach(function(e){e()})}var e=[];t.add=function(t){e.push(t)};return t}function ol(){jf.attr("width",xr).attr("height",Tr);jf.select("#"+Kn).select("rect").attr("width",br).attr("height",Er);jf.select("#"+Qn).select("rect").attr("x",Hi).attr("y",Bi).attr("width",Ri).attr("height",Ui);jf.select("#"+Gn).select("rect").attr("x",ji).attr("y",Fi).attr("width",zi).attr("height",Wi);jf.select("."+n.zoomRect).attr("width",br).attr("height",Er);zf.style("max-height",Tr+"px")}function ul(e){return{axisX:e?Yr.x.transition().duration(e):Yr.x,axisY:e?Yr.y.transition().duration(e):Yr.y,axisY2:e?Yr.y2.transition().duration(e):Yr.y2,axisSubX:e?Yr.subx.transition().duration(e):Yr.subx}}function al(e){var t;e=e||{};e.withTransition=rf(e,"withTransition",true);e.withTransform=rf(e,"withTransform",false);e.withLegend=rf(e,"withLegend",false);e.withUpdateXDomain=true;e.withUpdateOrgXDomain=true;e.withTransitionForExit=false;if(!(e.withLegend&&ct)){t=ul(e.withTransitionForAxis?k:0);yi();Gi();ol();di(e.withTransition,t)}nl(e,t)}function fl(e){var t,r,i,s,o,u,a,f;var l,c,h,p;a=If.select("."+n.chartTexts).selectAll("."+n.chartText).data(e).attr("class",wu);f=a.enter().append("g").attr("class",wu).style("opacity",0).style("pointer-events","none");f.append("g").attr("class",nu);s=If.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Su);i=s.enter().append("g").attr("class",Su).style("opacity",0).style("pointer-events","none");i.append("g").attr("class",lu).style("cursor",function(e){return $(e)?"pointer":null});r=If.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",Eu);t=r.enter().append("g").attr("class",Eu).style("opacity",0).style("pointer-events","none");t.append("g").attr("class",ou);t.append("g").attr("class",yu);t.append("g").attr("class",du);t.append("g").attr("class",function(e){return eu(n.selectedCircles,e.id)});t.append("g").attr("class",au).style("cursor",function(e){return $(e)?"pointer":null});e.forEach(function(e){If.selectAll("."+n.selectedCircles+Tu(e.id)).selectAll("."+n.selectedCircle).each(function(t){t.value=e.values[t.index].value})});u=If.select("."+n.chartArcs).selectAll("."+n.chartArc).data(Dr(e)).attr("class",xu);o=u.enter().append("g").attr("class",xu);o.append("g").attr("class",hu);o.append("text").attr("dy",Mn==="arc"?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("font-size",br/10+"px");if(Mn==="arc"){o.select("text").style("fill","#000");o.append("text").attr("dy",".75em").attr("class","units").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#000").style("font-size",br/15+"px");o.append("text").attr("dx",-1*(kr+(Nr-kr)/2)+"px").attr("dy","1em").attr("class","min").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",br/20+"px");o.append("text").attr("dx",kr+(Nr-kr)/2+"px").attr("dy","1em").attr("class","max").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",br/20+"px")}if(ot){p=qf.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Su);h=p.enter().append("g").style("opacity",0).attr("class",Su);h.append("g").attr("class",lu);c=qf.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",Eu);l=c.enter().append("g").style("opacity",0).attr("class",Eu);l.append("g").attr("class",ou);l.append("g").attr("class",yu);l.append("g").attr("class",du)}jf.selectAll("."+n.target).filter(function(e){return qo(e.id)}).transition().duration(k).style("opacity",1)}function ll(e,t){if(t.filter){e=e.filter(t.filter)}if(t.type||t.types){e.forEach(function(e){t.types?wa(e.id,t.types[e.id]):wa(e.id,t.type)})}a.data.targets.forEach(function(t){for(var n=0;n=v){v=o}if(!m||u>=m){m=u}c=ii?m:v;if(mt){Object.keys(E).forEach(function(e){E[e]=v});Object.keys(S).forEach(function(e){S[e]=m});l=(f-c*e.length)/2;if(l"+(f||f===0?""+f+" |
":"")}c=e[a].name;l=o(e[a].value,e[a].ratio,e[a].id,e[a].index);h=Mn==="arc"&<?cr(e[a].value):i(e[a].id);u+="";u+=""+c+" | ";u+=""+l+" | ";u+="
"}return u+""}),Vn=c(["tooltip","init","show"],false),$n=c(["tooltip","init","x"],0),Jn=c(["tooltip","init","position"],{top:"0px",left:"50px"});var Kn="c3-"+ +(new Date)+"-clip",Qn=Kn+"-xaxis",Gn=Kn+"-yaxis",Yn=fi(Kn),Zn=fi(Qn),er=fi(Gn);var tr=bt==="timeseries",nr=bt==="categorized",rr=!tr&&(L||Za(A));var ir=null,sr=false,or=false,ur=false,ar=false;var fr=u.scale.category10().range(),lr=Va(U,Za(at)?at:fr,R),cr=$a(at,lt);var hr=wt?u.time.format:u.time.format.utc,pr=hr.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%-m/%-d",function(e){return e.getDay()&&e.getDate()!==1}],["%-m/%-d",function(e){return e.getDate()!==1}],["%-m/%-d",function(e){return e.getMonth()}],["%Y/%-m/%-d",function(){return true}]]);var dr=[],vr=[];var mr,gr,yr,br,wr,Er,Sr,xr,Tr;var Nr,Cr,kr,Lr,Ar,Or,Mr,_r,Dr;var Pr,Hr,Br,jr,Fr,Ir,qr,Rr;var Ur,zr,Wr,Xr,Vr,$r,Jr,Kr,Qr,Gr;var Yr={};var Zr=gt?"left":"bottom",ei=gt?Rt?"top":"bottom":Rt?"right":"left",ti=gt?Qt?"bottom":"top":Qt?"left":"right",ni=gt?"left":"bottom";var ri={main:function(){return"translate("+li(mr.left)+","+li(mr.top)+")"},context:function(){return"translate("+li(gr.left)+","+li(gr.top)+")"},legend:function(){return"translate("+yr.left+","+yr.top+")"},x:function(){return"translate(0,"+(gt?0:Er)+")"},y:function(){return"translate(0,"+(gt?Er:0)+")"},y2:function(){return"translate("+(gt?0:br)+","+(gt?1:0)+")"},subx:function(){return"translate(0,"+(gt?0:Sr)+")"},arc:function(){return"translate("+Lr/2+","+Ar/2+")"}};var ii=ht==="right";var si=0,oi=0,ui=0,ai=.15;var vi=30,mi=gt&&!yt?0:30,gi=5;Dr=u.layout.pie().value(function(e){return e.values.reduce(function(e,t){return e+t.value},0)});var Hf,Bf=function(){};Hf=u.svg.brush().on("brush",rl);Hf.update=function(){if(qf){qf.select("."+n.brush).call(this)}return this};Hf.scale=function(e){return gt?this.y(e):this.x(e)};if(b){Bf=u.behavior.zoom().on("zoomstart",function(){Bf.altDomain=u.event.sourceEvent.altKey?Ur.orgDomain():null}).on("zoom",b?il:null);Bf.scale=function(e){return gt?this.y(e):this.x(e)};Bf.orgScaleExtent=function(){var e=w?w:[1,10];return[e[0],Math.max(Po()/e[1],e[1])]};Bf.updateScaleExtent=function(){var e=ao(Ur.orgDomain())/ao(Wf),t=this.orgScaleExtent();this.scaleExtent([t[0]*e,t[1]*e]);return this}}var jf,Ff,If,qf,Rf,Uf,zf;var Wf;var Xf,Vf={};a.focus=function(e){function s(e){Uo(e).transition().duration(100).style("opacity",1)}var t=jf.selectAll(Nu(e)),r=t.filter(wl),i=t.filter(El);a.revert();a.defocus();s(r.classed(n.focused,true));s(i);if(ka(a.data.targets)){$s(e,true)}vl(e,true)};a.defocus=function(e){function s(e){Uo(e).transition().duration(100).style("opacity",.3)}var t=jf.selectAll(Nu(e)),r=t.filter(wl),i=t.filter(El);a.revert();s(r.classed(n.focused,false));s(i);if(ka(a.data.targets)){Js(e)}vl(e,false)};a.revert=function(e){function s(e){Uo(e).transition().duration(100).style("opacity",1)}var t=jf.selectAll(Nu(e)),r=t.filter(wl),i=t.filter(El);s(r.classed(n.focused,false));s(i);if(ka(a.data.targets)){Js(e)}ml()};a.show=function(e,t){e=Fo(e);t=t||{};Vo(e);jf.selectAll(Cu(e)).transition().style("opacity",1);if(t.withLegend){gl(e)}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.hide=function(e,t){e=Fo(e);t=t||{};Xo(e);jf.selectAll(Cu(e)).transition().style("opacity",0);if(t.withLegend){yl(e)}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.toggle=function(e){qo(e)?a.hide(e):a.show(e)};a.unzoom=function(){Hf.clear().update();nl({withUpdateXDomain:true})};a.load=function(e){if(e.xs){So(e.xs)}if("classes"in e){Object.keys(e.classes).forEach(function(t){D[t]=e.classes[t]})}if("categories"in e&&nr){Et=e.categories;Jr.categories(Et)}if("cacheIds"in e&&fo(e.cacheIds)){ll(co(e.cacheIds),e.done);return}if("unload"in e){hl(Fo(typeof e.unload==="boolean"&&e.unload?null:e.unload),function(){cl(e)})}else{cl(e)}};a.unload=function(e,t){hl(Fo(e),function(){nl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true});if(typeof t==="function"){t()}})};a.selected=function(e){return u.merge(If.selectAll("."+n.shapes+Tu(e)).selectAll("."+n.shape).filter(function(){return u.select(this).classed(n.SELECTED)}).map(function(e){return e.map(function(e){var t=e.__data__;return t.data?t.data:t})}))};a.select=function(e,t,r){if(!X){return}If.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(i,o){var a=u.select(this),f=i.data?i.data.id:i.id,l=df(this),c=V||!e||e.indexOf(f)>=0,h=!t||t.indexOf(o)>=0,p=a.classed(n.SELECTED);if(a.classed(n.line)||a.classed(n.area)){return}if(c&&h){if($(i)&&!p){l(true,a.classed(n.SELECTED,true),i,o)}}else if(s(r)&&r){if(p){l(false,a.classed(n.SELECTED,false),i,o)}}})};a.unselect=function(e,t){if(!X){return}If.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(r,i){var s=u.select(this),o=r.data?r.data.id:r.id,a=df(this),f=V||!e||e.indexOf(o)>=0,l=!t||t.indexOf(i)>=0,c=s.classed(n.SELECTED);if(s.classed(n.line)||s.classed(n.area)){return}if(f&&l){if($(r)){if(c){a(false,s.classed(n.SELECTED,false),r,i)}}}})};a.toLine=function(e){xl(e,"line")};a.toSpline=function(e){xl(e,"spline")};a.toBar=function(e){xl(e,"bar")};a.toScatter=function(e){xl(e,"scatter")};a.toArea=function(e){xl(e,"area")};a.toAreaSpline=function(e){xl(e,"area-spline")};a.toPie=function(e){xl(e,"pie",{withTransform:true})};a.toDonut=function(e){xl(e,"donut",{withTransform:true})};a.groups=function(e){if(i(e)){return P}P=e;nl();return P};a.xgrids=function(e){if(!e){return rn}rn=e;nl();return rn};a.xgrids.add=function(e){if(!e){return}return a.xgrids(rn.concat(e))};a.xgrids.remove=function(e){var t=Sl(e);return a.xgrids(rn.filter(t))};a.ygrids=function(e){if(!e){return on}on=e;nl();return on};a.ygrids.add=function(e){if(!e){return}return a.ygrids(on.concat(e))};a.ygrids.remove=function(e){var t=Sl(e);return a.ygrids(on.filter(t))};a.regions=function(e){if(!e){return Rn}Rn=e;nl();return Rn};a.regions.add=function(e){if(!e){return Rn}Rn=Rn.concat(e);nl();return Rn};a.regions.remove=function(e){var t,r,i;e=e||{};t=rf(e,"duration",k);r=rf(e,"classes",[n.region]);i=If.select("."+n.regions).selectAll(r.map(function(e){return"."+e}));(t?i.transition().duration(t):i).style("opacity",0).remove();Rn=Rn.filter(function(e){var t=false;if(!e.class){return true}e.class.split(" ").forEach(function(e){if(r.indexOf(e)>=0){t=true}});return!t});return Rn};a.data.get=function(e){var t=a.data.getAsTarget(e);return s(t)?t.values.map(function(e){return e.value}):undefined};a.data.getAsTarget=function(e){var t=a.data.targets.filter(function(t){return t.id===e});return t.length>0?t[0]:undefined};a.data.names=function(e){if(!arguments.length){return _}Object.keys(e).forEach(function(t){_[t]=e[t]});nl({withLegend:true});return _};a.data.colors=function(e){if(!arguments.length){return U}Object.keys(e).forEach(function(t){U[t]=e[t]});nl({withLegend:true});return U};a.x=function(e){if(arguments.length){No(a.data.targets,e);nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.xs=function(e){if(arguments.length){Co(a.data.targets,e);nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.axis.labels=function(e){if(arguments.length){Object.keys(e).forEach(function(t){ls(t,e[t])});Fs()}};a.axis.max=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.x)){Ot=+e.x}if(r(e.y)){jt=+e.y}if(r(e.y2)){Vt=+e.y2}}else{jt=Vt=+e}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}};a.axis.min=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.x)){Mt=+e.x}if(r(e.y)){Ft=+e.y}if(r(e.y2)){$t=+e.y2}}else{Ft=$t=+e}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}};a.axis.range=function(e){if(arguments.length){if(typeof e.max!=="undefined"){a.axis.max(e.max)}if(typeof e.min!=="undefined"){a.axis.min(e.min)}}};a.legend.show=function(e){gl(Fo(e));nl({withLegend:true})};a.legend.hide=function(e){yl(Fo(e));nl({withLegend:true})};a.resize=function(e){p=e?e.width:null;d=e?e.height:null;a.flush();a.flush()};a.flush=function(){al({withLegend:true,withTransition:false,withTransitionForTransform:false})};a.destroy=function(){a.data.targets=undefined;a.data.xs={};zf.classed("c3",false).html("");e.onresize=null};if("url"in t.data){u.xhr(t.data.url,function(e,t){var n=u.csv.parseRows(t.response),r;if(n.length===1){r=[{}];n[0].forEach(function(e){r[0][e]=null})}else{r=u.csv.parse(t.response)}Jf(r)})}else if("rows"in t.data){Jf(Lo(t.data.rows))}else if("columns"in t.data){Jf(Ao(t.data.columns))}else{throw Error("url or rows or columns is required.")}return a};if(typeof define==="function"&&define.amd){define("c3",["d3"],t)}else if("undefined"!==typeof exports&&"undefined"!==typeof module){module.exports=t}else{e.c3=t}})(window)