diff --git a/c3.css b/c3.css index 737e783..29c7e60 100644 --- a/c3.css +++ b/c3.css @@ -13,6 +13,14 @@ user-select: none; } +.c3-legend-item-tile, +.c3-xgrid-focus, +.c3-ygrid, +.c3-event-rect, +.c3-bars path { + shape-rendering: crispEdges; +} + .c3-chart-arc path { stroke: #fff; diff --git a/c3.js b/c3.js index 13d4949..8f921a2 100644 --- a/c3.js +++ b/c3.js @@ -406,6 +406,7 @@ // TODO: configurabale var rotated_padding_left = 30, rotated_padding_right = __axis_rotated && !__axis_x_show ? 0 : 30, rotated_padding_top = 5; + // MEMO: each value should be int to avoid disabling antialiasing function updateSizes() { var legendHeight = getLegendHeight(), legendWidth = getLegendWidth(), legendHeightForBottom = isLegendRight ? 0 : legendHeight, @@ -645,21 +646,24 @@ svgArcExpandedSub = getSvgArcExpanded(0.98); } function getX(min, max, domain, offset) { - var scale = ((isTimeSeries) ? d3.time.scale() : d3.scale.linear()).range([min, max]); - // Set function and values for c3 - scale.orgDomain = function () { return scale.domain(); }; - if (domain) { scale.domain(domain); } - if (isUndefined(offset)) { offset = function () { return 0; }; } + var scale = (isTimeSeries ? d3.time.scale() : d3.scale.linear()).range([min, max]), + _scale = domain ? scale.domain(domain) : scale, key; // Define customized scale if categorized axis if (isCategorized) { - var _scale = scale, key; - scale = function (d) { return _scale(d) + offset(d); }; - for (key in _scale) { - scale[key] = _scale[key]; - } - scale.orgDomain = function () { - return _scale.domain(); - }; + offset = offset || function () { return 0; }; + scale = function (d) { return Math.ceil(_scale(d) + offset(d)); }; + } else { + scale = function (d) { return Math.ceil(_scale(d)); }; + } + // define functions + for (key in _scale) { + scale[key] = _scale[key]; + } + scale.orgDomain = function () { + return _scale.domain(); + }; + // define custom domain() for categorized axis + if (isCategorized) { scale.domain = function (domain) { if (!arguments.length) { domain = _scale.domain(); @@ -686,7 +690,7 @@ //-- Axes --// function getXAxis(scale, orient, tickFormat, tickValues) { - var axis = (isCategorized ? categoryAxis() : d3.svg.axis()).scale(scale).orient(orient); + var axis = c3_axis(d3, isCategorized).scale(scale).orient(orient); // Set tick axis.tickFormat(tickFormat).tickValues(tickValues); @@ -695,7 +699,9 @@ if (isEmpty(__axis_x_tick_culling)) { __axis_x_tick_culling = false; } + axis.categories(__axis_x_categories); } else { + // TODO: move this to c3_axis axis.tickOffset = function () { var edgeX = getEdgeX(c3.data.targets), diff = x(edgeX[1]) - x(edgeX[0]), base = diff ? diff : (__axis_rotated ? height : width); @@ -703,15 +709,10 @@ }; } - // Set categories - if (isCategorized) { - axis.categories(__axis_x_categories); - } - return axis; } function getYAxis(scale, orient, tickFormat, ticks) { - return d3.svg.axis().scale(scale).orient(orient).tickFormat(tickFormat).ticks(ticks).outerTickSize(0); + return c3_axis(d3).scale(scale).orient(orient).tickFormat(tickFormat).ticks(ticks); } function getAxisId(id) { return id in __data_axes ? __data_axes[id] : 'y'; @@ -909,186 +910,6 @@ .text(textForY2AxisLabel); } - function categoryAxis() { - var scale = d3.scale.linear(), orient = "bottom"; - var tickMajorSize = 6, /*tickMinorSize = 6,*/ tickEndSize = 6, tickPadding = 3, tickCentered = false, tickTextNum = 10, tickOffset = 0, tickFormat = null, tickCulling = true; - var categories = []; - function axisX(selection, x) { - selection.attr("transform", function (d) { - return "translate(" + (x(d) + tickOffset) + ", 0)"; - }); - } - function axisY(selection, y) { - selection.attr("transform", function (d) { - return "translate(0," + y(d) + ")"; - }); - } - function scaleExtent(domain) { - var start = domain[0], stop = domain[domain.length - 1]; - return start < stop ? [ start, stop ] : [ stop, start ]; - } - function generateTicks(domain) { - var ticks = []; - for (var i = Math.ceil(domain[0]); i < domain[1]; i++) { - ticks.push(i); - } - if (ticks.length > 0 && ticks[0] > 0) { - ticks.unshift(ticks[0] - (ticks[1] - ticks[0])); - } - return ticks; - } - function category(i) { - return i < categories.length ? categories[i] : i; - } - function formattedCategory(i) { - var c = category(i); - return tickFormat ? tickFormat(c) : c; - } - function copyScale() { - var newScale = scale.copy(), domain = scale.domain(); - newScale.domain([domain[0], domain[1] - 1]); - return newScale; - } - function axis(g) { - g.each(function () { - var g = d3.select(this); - var scale1 = copyScale(), scale0 = this.__chart__ || scale1; - var tick = g.selectAll(".tick.major").data(generateTicks(scale1.domain()), String), - tickEnter = tick.enter().insert("g", "path").attr("class", "tick major").style("opacity", 1e-6), - tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), - tickUpdate = d3.transition(tick).style("opacity", 1), - tickTransform, - tickX; - var range = scale.rangeExtent ? scale.rangeExtent() : scaleExtent(scale.range()); - var path = g.selectAll(".domain").data([ 0 ]), pathUpdate; - var lineEnter, lineUpdate, text, textEnter, textUpdate; - - path.enter().append("path").attr("class", "domain"); - pathUpdate = d3.transition(path); - - tickEnter.append("line"); - tickEnter.append("text"); - - lineEnter = tickEnter.select("line"); - lineUpdate = tickUpdate.select("line"); - text = tick.select("text"); - textEnter = tickEnter.select("text"); - textUpdate = tickUpdate.select("text"); - - tickOffset = (scale1(1) - scale1(0)) / 2; - tickX = tickCentered ? 0 : tickOffset; - - this.__chart__ = scale1; - - switch (orient) { - case "bottom": - { - tickTransform = axisX; - lineEnter.attr("y2", tickMajorSize); - textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding); - lineUpdate.attr("x1", tickX).attr("x2", tickX).attr("y2", tickMajorSize); - textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding); - text.attr("dy", ".71em").style("text-anchor", "middle"); - text.text(formattedCategory); - pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); - break; - } -/* TODO: implement - case "top": - { - tickTransform = axisX - lineEnter.attr("y2", -tickMajorSize) - textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)) - lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize) - textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)) - text.attr("dy", "0em").style("text-anchor", "middle") - pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize) - break - } -*/ - case "left": - { - tickTransform = axisY; - lineEnter.attr("x2", -tickMajorSize); - textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)); - lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0); - textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", tickOffset); - text.attr("dy", ".32em").style("text-anchor", "end"); - text.text(formattedCategory); - pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); - break; - } -/* - case "right": - { - tickTransform = axisY - lineEnter.attr("x2", tickMajorSize) - textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding) - lineUpdate.attr("x2", tickMajorSize).attr("y2", 0) - textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0) - text.attr("dy", ".32em").style("text-anchor", "start") - pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize) - break - } -*/ - } - if (scale.ticks) { - tickEnter.call(tickTransform, scale0); - tickUpdate.call(tickTransform, scale1); - tickExit.call(tickTransform, scale1); - } else { - var dx = scale1.rangeBand() / 2, x = function (d) { - return scale1(d) + dx; - }; - tickEnter.call(tickTransform, x); - tickUpdate.call(tickTransform, x); - } - }); - } - axis.scale = function (x) { - if (!arguments.length) { return scale; } - scale = x; - return axis; - }; - axis.orient = function (x) { - if (!arguments.length) { return orient; } - orient = x in {top: 1, right: 1, bottom: 1, left: 1} ? x + "" : "bottom"; - return axis; - }; - axis.categories = function (x) { - if (!arguments.length) { return categories; } - categories = x; - return axis; - }; - axis.tickCentered = function (x) { - if (!arguments.length) { return tickCentered; } - tickCentered = x; - return axis; - }; - axis.tickFormat = function (format) { - if (!arguments.length) { return tickFormat; } - tickFormat = format; - return axis; - }; - axis.tickOffset = function () { - return tickOffset; - }; - axis.ticks = function (n) { - if (!arguments.length) { return tickTextNum; } - tickTextNum = n; - return axis; - }; - axis.tickCulling = function (culling) { - if (!arguments.length) { return tickCulling; } - tickCulling = culling; - return axis; - }; - axis.tickValues = function () { - // TODO: do something - }; - return axis; - } - //-- Arc --// pie = d3.layout.pie().value(function (d) { @@ -1845,11 +1666,11 @@ return d ? x(d.x) : null; } function xv(d) { - return x(isTimeSeries ? parseDate(d.value) : d.value); + return Math.ceil(x(isTimeSeries ? parseDate(d.value) : d.value)); } function yv(d) { var yScale = d.axis && d.axis === 'y2' ? y2 : y; - return yScale(d.value); + return Math.ceil(yScale(d.value)); } function subxx(d) { return subX(d.x); @@ -2004,15 +1825,31 @@ if (! __tooltip_show) { return; } // Hide when scatter plot exists if (hasScatterType(c3.data.targets) || hasArcType(c3.data.targets)) { return; } - main.selectAll('line.' + CLASS.xgridFocus) + var focusEl = main.selectAll('line.' + CLASS.xgridFocus); + focusEl .style("visibility", "visible") .data([dataToShow[0]]) .attr(__axis_rotated ? 'y1' : 'x1', xx) .attr(__axis_rotated ? 'y2' : 'x2', xx); + smoothLines(focusEl, 'grid'); } function hideXGridFocus() { main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden"); } + function generateGridData(type, scale) { + var gridData = [], xDomain, firstYear, lastYear, i; + if (type === 'year') { + xDomain = getXDomain(); + firstYear = xDomain[0].getFullYear(); + lastYear = xDomain[1].getFullYear(); + for (i = firstYear; i <= lastYear; i++) { + gridData.push(new Date(i + '-01-01 00:00:00')); + } + } else { + gridData = scale.ticks(10); + } + return gridData; + } //-- Circle --// @@ -3151,10 +2988,28 @@ __data_ondragend(); } + function smoothLines(el, type) { + if (type === 'grid') { + el.each(function () { + var g = d3.select(this), + x1 = g.attr('x1'), + x2 = g.attr('x2'), + y1 = g.attr('y1'), + y2 = g.attr('y2'); + g.attr({ + 'x1': Math.ceil(x1), + 'x2': Math.ceil(x2), + 'y1': Math.ceil(y1), + 'y2': Math.ceil(y2), + }); + }); + } + } + function redraw(options) { - var xaxis, subxaxis, yaxis, y2axis, xgrid, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; + var xaxis, subxaxis, yaxis, y2axis, xgrid, xgridAttr, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; var mainLine, mainArea, mainCircle, mainBar, mainArc, mainRegion, mainText, contextLine, contextBar, eventRect, eventRectUpdate; - var barIndices = getBarIndices(), maxDataCountTarget; + var barIndices = getBarIndices(), maxDataCountTarget, tickOffset; var rectX, rectW; var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; var hideAxis = hasArcType(c3.data.targets); @@ -3255,6 +3110,8 @@ } } + tickOffset = xAxis.tickOffset(); + // rotate tick text if needed if (!__axis_rotated && __axis_x_tick_rotate) { rotateTickText(xaxis, transitions.axisX, __axis_x_tick_rotate); @@ -3278,25 +3135,22 @@ // grid main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden"); if (__grid_x_show) { - if (__grid_x_type === 'year') { - xgridData = []; - var xDomain = getXDomain(); - var firstYear = xDomain[0].getFullYear(); - var lastYear = xDomain[1].getFullYear(); - for (var year = firstYear; year <= lastYear; year++) { - xgridData.push(new Date(year + '-01-01 00:00:00')); - } - } else { - xgridData = x.ticks(10); - } - + xgridData = generateGridData(__grid_x_type, x); + xgridAttr = __axis_rotated ? { + 'x1': 0, + 'x2': width, + 'y1': function (d) { return x(d) - tickOffset; }, + 'y2': function (d) { return x(d) - tickOffset; } + } : { + 'x1': function (d) { return x(d) + tickOffset; }, + 'x2': function (d) { return x(d) + tickOffset; }, + 'y1': margin.top, + 'y2': height + }; xgrid = main.select('.' + CLASS.xgrids).selectAll('.' + CLASS.xgrid) .data(xgridData); xgrid.enter().append('line').attr("class", CLASS.xgrid); - xgrid.attr("x1", __axis_rotated ? 0 : function (d) { return x(d) - xAxis.tickOffset(); }) - .attr("x2", __axis_rotated ? width : function (d) { return x(d) - xAxis.tickOffset(); }) - .attr("y1", __axis_rotated ? function (d) { return x(d) - xAxis.tickOffset(); } : margin.top) - .attr("y2", __axis_rotated ? function (d) { return x(d) - xAxis.tickOffset(); } : height) + xgrid.attr(xgridAttr) .style("opacity", function () { return +d3.select(this).attr(__axis_rotated ? 'y1' : 'x1') === (__axis_rotated ? height : 0) ? 0 : 1; }); xgrid.exit().remove(); } @@ -3344,6 +3198,7 @@ .attr("y1", __axis_rotated ? 0 : y) .attr("y2", __axis_rotated ? height : y); ygrid.exit().remove(); + smoothLines(ygrid, 'grid'); } if (withY && notEmpty(__grid_y_lines)) { ygridLines = main.select('.' + CLASS.ygridLines).selectAll('.' + CLASS.ygridLine) @@ -4629,4 +4484,190 @@ } // TODO: module.exports + // Features: + // 1. category axis + // 2. ceil values of translate/x/y to int for half pixel antialiasing + function c3_axis(d3, isCategory) { + var scale = d3.scale.linear(), orient = "bottom", innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickValues = null, tickFormat, tickArguments; + + var tickOffset = 0, tickCulling = true; + var categories = [], tickCentered; + + function axisX(selection, x) { + selection.attr("transform", function (d) { + return "translate(" + Math.ceil(x(d) + tickOffset) + ", 0)"; + }); + } + function axisY(selection, y) { + selection.attr("transform", function (d) { + return "translate(0," + Math.ceil(y(d)) + ")"; + }); + } + function scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [ start, stop ] : [ stop, start ]; + } + function generateTicks(scale) { + var i, domain, ticks = []; + if (scale.ticks) { + return scale.ticks.apply(scale, tickArguments); + } + domain = scale.domain(); + for (i = Math.ceil(domain[0]); i < domain[1]; i++) { + ticks.push(i); + } + if (ticks.length > 0 && ticks[0] > 0) { + ticks.unshift(ticks[0] - (ticks[1] - ticks[0])); + } + return ticks; + } + function copyScale() { + var newScale = scale.copy(), domain; + if (isCategory) { + domain = scale.domain(); + newScale.domain([domain[0], domain[1] - 1]); + } + return newScale; + } + function textFormatted(i) { + var v = isCategory && i < categories.length ? categories[i] : i; + return tickFormat ? tickFormat(v) : v; + } + function axis(g) { + g.each(function () { + var g = d3.select(this); + var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = copyScale(); + + var ticks = tickValues ? tickValues : generateTicks(scale1), + tick = g.selectAll(".tick").data(ticks, scale1), + tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", 1e-6), + tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), + tickUpdate = d3.transition(tick).style("opacity", 1), + tickTransform, tickX; + + var range = scale.rangeExtent ? scale.rangeExtent() : scaleExtent(scale.range()), + path = g.selectAll(".domain").data([ 0 ]), + pathUpdate = (path.enter().append("path").attr("class", "domain"), d3.transition(path)); + tickEnter.append("line"); + tickEnter.append("text"); + + var lineEnter = tickEnter.select("line"), + lineUpdate = tickUpdate.select("line"), + text = tick.select("text").text(textFormatted), + textEnter = tickEnter.select("text"), + textUpdate = tickUpdate.select("text"); + + if (isCategory) { + tickOffset = Math.ceil((scale1(1) - scale1(0)) / 2); + tickX = tickCentered ? 0 : tickOffset; + } else { + tickOffset = tickX = 0; + } + + switch (orient) { + case "bottom": + { + tickTransform = axisX; + lineEnter.attr("y2", innerTickSize); + textEnter.attr("y", Math.max(innerTickSize, 0) + tickPadding); + lineUpdate.attr("x1", tickX).attr("x2", tickX).attr("y2", innerTickSize); + textUpdate.attr("x", 0).attr("y", Math.max(innerTickSize, 0) + tickPadding); + text.attr("dy", ".71em").style("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + outerTickSize + "V0H" + range[1] + "V" + outerTickSize); + break; + } + case "top": + { + tickTransform = axisX; + lineEnter.attr("y2", -innerTickSize); + textEnter.attr("y", -(Math.max(innerTickSize, 0) + tickPadding)); + lineUpdate.attr("x2", 0).attr("y2", -innerTickSize); + textUpdate.attr("x", 0).attr("y", -(Math.max(innerTickSize, 0) + tickPadding)); + text.attr("dy", "0em").style("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + -outerTickSize + "V0H" + range[1] + "V" + -outerTickSize); + break; + } + case "left": + { + tickTransform = axisY; + lineEnter.attr("x2", -innerTickSize); + textEnter.attr("x", -(Math.max(innerTickSize, 0) + tickPadding)); + lineUpdate.attr("x2", -innerTickSize).attr("y2", 0); + textUpdate.attr("x", -(Math.max(innerTickSize, 0) + tickPadding)).attr("y", tickOffset); + text.attr("dy", ".32em").style("text-anchor", "end"); + pathUpdate.attr("d", "M" + -outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + -outerTickSize); + break; + } + case "right": + { + tickTransform = axisY; + lineEnter.attr("x2", innerTickSize); + textEnter.attr("x", Math.max(innerTickSize, 0) + tickPadding); + lineUpdate.attr("x2", innerTickSize).attr("y2", 0); + textUpdate.attr("x", Math.max(innerTickSize, 0) + tickPadding).attr("y", 0); + text.attr("dy", ".32em").style("text-anchor", "start"); + pathUpdate.attr("d", "M" + outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + outerTickSize); + break; + } + } + if (scale1.rangeBand) { + var x = scale1, dx = x.rangeBand() / 2; + scale0 = scale1 = function (d) { + return x(d) + dx; + }; + } else if (scale0.rangeBand) { + scale0 = scale1; + } else { + tickExit.call(tickTransform, scale1); + } + tickEnter.call(tickTransform, scale0); + tickUpdate.call(tickTransform, scale1); + }); + } + axis.scale = function (x) { + if (!arguments.length) { return scale; } + scale = x; + return axis; + }; + axis.orient = function (x) { + if (!arguments.length) { return orient; } + orient = x in {top: 1, right: 1, bottom: 1, left: 1} ? x + "" : "bottom"; + return axis; + }; + axis.tickFormat = function (format) { + if (!arguments.length) { return tickFormat; } + tickFormat = format; + return axis; + }; + axis.tickCentered = function (isCentered) { + if (!arguments.length) { return tickCentered; } + tickCentered = isCentered; + return axis; + }; + axis.tickOffset = function () { // This will be overwritten when normal x axis + return tickOffset; + }; + axis.ticks = function () { + if (!arguments.length) { return tickArguments; } + tickArguments = arguments; + return axis; + }; + axis.tickCulling = function (culling) { + if (!arguments.length) { return tickCulling; } + tickCulling = culling; + return axis; + }; + axis.tickValues = function (x) { + if (!arguments.length) { return tickValues; } + tickValues = x; + return axis; + }; + axis.categories = function (x) { + if (!arguments.length) { return categories; } + categories = x; + return axis; + }; + return axis; + } + })(window); diff --git a/c3.min.js b/c3.min.js index 9d9ae25..571f761 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cZf&&(Zf=0),0>_f&&(_f=0),$f=kh?Wf.left-fj-gj:Zf,ag=kh?_f:cg-Xf.top-Xf.bottom,0>$f&&($f=0),0>ag&&(ag=0),p(),aj&&he(Ff.data.targets)&&(Yf.left=Zf/2+eg)}function o(){pj.select("line."+f.xgridFocus).attr("x1",kh?0:-10).attr("x2",kh?Zf:-10).attr("y1",kh?-10:Wf.top).attr("y2",kh?-10:_f)}function p(){eg=_f/2,dg=.95*eg,fg=ge(Ff.data.targets)?.6*dg:0}function q(){var a=kh?f.axisX:f.axisY,b=pj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:kh?lh?v("x"):1:!Dh||Ih?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:aj?P()+20+(Mh&&!kh?v("y2"):a):Mh?Rh||kh?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||lh?"x"===a&&Ah?Ah:"y"!==a||Dh?"y2"!==a||Mh?(jb(a).isInner?30:40)+("y2"===a?-10:0):hj:eh&&!aj?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Wf.left-1)}function A(a){return a?-20:-4}function B(){return z(!kh)}function C(){return A(!kh)}function D(){return z(kh)}function E(){return A(kh)}function F(a){return a?Zf+2+4:Wf.left+20}function G(a){return a?(Ah?Ah:0)+80:_f+8}function H(){return F(!kh)}function I(){return G(!kh)}function J(){return F(kh)}function K(){return G(kh)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=sg(b.x)-sg(a.x),0===c?kh?_f:Zf:(d=zc(),e=de(Ff.data.targets)?(d-(Ki?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){bj=a}function N(a){cj=a}function O(a){dj=a}function P(){return eh?aj?cj*(bj+1):bg:0}function Q(){return eh?aj?cg:dj*(bj+1):0}function R(){var a,b,c=!sg;kg=kh?1:0,lg=kh?_f:Zf,mg=kh?0:_f,ng=kh?Zf:1,og=kg,pg=lg,qg=kh?0:ag,rg=kh?$f:1,sg=T(kg,lg,c?void 0:sg.domain(),function(){return yg.tickOffset()}),tg=U(mg,ng,c?void 0:tg.domain()),ug=U(mg,ng,c?void 0:ug.domain()),vg=T(kg,lg,uj,function(a){return a%1?0:Bg.tickOffset()}),wg=U(qg,rg,c?void 0:wg.domain()),xg=U(qg,rg,c?void 0:xg.domain()),a=$(),b=vh?vh:c?void 0:yg.tickValues(),yg=X(sg,Xi,a,b),Bg=X(vg,$i,a,b),zg=Y(tg,Yi,Jh,Lh),Ag=Y(ug,Zi,Sh,Uh),c||(ij.scale(vg),Of&&mj.scale(sg)),S()}function S(){gg=Gb(),hg=Hb(),ig=Hb(.98)}function T(a,b,d,e){var f=(Ji?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ki){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?ug:tg}function W(a){return"y2"===Z(a)?xg:wg}function X(a,b,c,d){var e=(Ki?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ki?(e.tickCentered(ph),Ae(rh)&&(rh=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=sg(a[1])-sg(a[0]),c=b?b:kh?_f:Zf;return c/zc()/2},Ki&&e.categories(oh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Jg?Jg[a]:"y"}function $(){var a=Ji?Ui:Ki?Tc:function(a){return 0>a?a.toFixed(0):a};return qh&&("function"==typeof qh?a=qh:Ji&&(a=function(a){return a?Ti(qh)(a):""})),a}function _(a){var b;return"y"===a?b=Hh:"y2"===a?b=Qh:"x"===a&&(b=Ch),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Hh=b:"y2"===a?Qh=b:"x"===a&&(Ch=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function gb(){return fb("x",kh?"inner-top":"inner-right")}function hb(){return fb("y",kh?"inner-right":"inner-top")}function ib(){return fb("y2",kh?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Zf/2:Zf:b.isBottom?-_f:b.isMiddle?-_f/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!kh,gb())}function rb(){return nb(kh,hb())}function sb(){return nb(kh,ib())}function tb(){return ob(!kh,gb())}function ub(){return ob(kh,hb())}function vb(){return ob(kh,ib())}function wb(){var a=gb();return kh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":Ah?Ah-10:"3em"}function xb(){var a=hb();return kh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return kh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!kh,gb())}function Ab(){return pb(kh,hb())}function Bb(){return pb(kh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(a){var b=pj.select("."+f.axisX+" ."+f.axisXLabel),c=pj.select("."+f.axisY+" ."+f.axisYLabel),d=pj.select("."+f.axisY2+" ."+f.axisY2Label);(a?b.transition():b).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),(a?c.transition():c).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),(a?d.transition():d).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Ig.length>0)for(g=Sc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Oh:Fh,n="y2"===c?Nh:Eh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Ph:Gh,r=xd()&&kh;return 0===l.length?"y2"===c?ug.domain():tg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(tg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),"y2"===c&&Th&&(f=b(Th.top)?Th.top:e,g=b(Th.bottom)?Th.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return yh?Ji?we(yh):yh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return xh?Ji?we(xh):xh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ki?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof zh&&Be(zh)?(e=b(zh.left)?zh.left:d,f=b(zh.right)?zh.right:d):e=f="number"==typeof zh?zh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d!==0||Ki||(c=Ji?new Date(.5*c.getTime()):-.5,d=Ji?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ji?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ji?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?tg:ug;return b="y"===a.axis||"y2"===a.axis?kh?_f:"start"in a?d(a.start):_f:kh?"end"in a?sg(Ji?we(a.end):a.end):_f:_f,c>b?0:b-c}function ic(a){return Cg&&a===Cg||Be(Dg)&&Ce(Dg,a)}function jc(a){return!ic(a)}function kc(a){return Cg?Cg:Be(Dg)?Dg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Dg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Gg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Ji?a?a instanceof Date?a:we(a):we(mc(c,d)):Li&&!Ki?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Cg?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Dg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Fg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Li&&Ki&&0===c&&g&&(0===e&&(oh=[]),oh.push(g)),("undefined"==typeof a[b]||Ff.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Kg&&be(Cc(c).filter(function(a){return!(a in Lg)}),Kg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ji?new Date(i):i);j.push(e)}return Ji||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Vi=Vi.concat(a)}function Mc(a){Vi=Vi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Wi=Wi.concat(a)}function Oc(a){Wi=Wi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Jd(a,g))),Md(e,b)):Kd(a,b,f,g)}function Ld(a,b){var c;return c=a.map(function(a){return Kd(a.values,b)}),Md(c,b)}function Md(a,b){var c,d;return a.forEach(function(a){var e=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Pd(){return Ng&&"desc"===Ng.toLowerCase()}function Qd(){return Ng&&"asc"===Ng.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Ng&&a.sort(Ng),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&wi&&(sj.html(zi(a,$(),zd(k),Si)).style("display","block"),d=sj.property("offsetWidth"),e=sj.property("offsetHeight"),k?(g=Zf/2+c[0],i=_f/2+c[1]+20):(kh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=sg(l[0].x)+20):(f=q(),g=f+t()+sg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),sj.style("top",i+"px").style("left",g+"px"))}function Td(){sj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});wi&&(ee(Ff.data.targets)||he(Ff.data.targets)||pj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(kh?"y1":"x1",Fd).attr(kh?"y2":"x2",Fd))}function Vd(){pj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?sg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof gi?gi:b?2*a.tickOffset()*hi/b:0}function be(a,b){Dc(a).forEach(function(a){wj[a]=b===Lg[a],Lg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Lg[a.id]===b&&(c=!0),a.id in Lg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Lg)||"line"===Lg[b]||"spline"===Lg[b]||"area"===Lg[b]||"area-spline"===Lg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Lg[b]||"area-spline"===Lg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Lg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Lg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Lg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Lg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&qi||me(a)&&ki}function ve(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function we(b){var c;try{c=Eg?Ef.time.format(Eg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Eg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?tg:ug,d=kh?1:0,e=kh?0:1;return Math.pow(sg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Zg(b,a.node()),pj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd).attr("stroke",function(){return Si(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){$g(b,a.node()),pj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Zg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Si(b)).brighter(.75)})}function Je(a,b){$g(b,a.node()),a.transition().duration(100).style("fill",function(){return Si(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return _h?"function"==typeof ai?ai(a):ai:0}function Pe(a){return ci?di?di:1.75*Oe(a):Oe(a)}function Qe(a){return ei?ei:4*Oe(a)}function Re(a,c){return(c?pj.selectAll("."+f.circles+od(c)):pj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return pj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=kh?1:0,f=kh?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return kh?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return kh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(yg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return kh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function bf(b){var c,d,e;if(tj=Ef.select(Hf),tj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(tj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Rg&&Lc(Rg===!0?Cc(Ff.data.targets):Rg),n(),R(),sg.domain(Ef.extent(_b(Ff.data.targets))),tg.domain(Xb(Ff.data.targets,"y")),ug.domain(Xb(Ff.data.targets,"y2")),vg.domain(sg.domain()),wg.domain(tg.domain()),xg.domain(ug.domain()),uj=sg.domain(),ij.scale(vg),Of&&mj.scale(sg),nj=tj.append("svg").on("mouseenter",Rf).on("mouseleave",Sf),oj=nj.append("defs"),oj.append("clipPath").attr("id",Di).append("rect"),oj.append("clipPath").attr("id",Ei).append("rect"),oj.append("clipPath").attr("id",Fi).append("rect"),nf(),pj=nj.append("g").attr("transform",_i.main),qj=nj.append("g").attr("transform",_i.context),rj=nj.append("g").attr("transform",_i.legend),bh||qj.style("visibility","hidden"),eh||(rj.style("visibility","hidden"),Wi=Cc(Ff.data.targets)),sj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=pj.append("g").attr("clip-path",Gi).attr("class",f.grid),Vh&&d.append("g").attr("class",f.xgrids),Be(Xh)&&d.append("g").attr("class",f.xgridLines),bi&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Yh&&d.append("g").attr("class",f.ygrids),Be(Zh)&&d.append("g").attr("class",f.ygridLines),lh&&pj.append("g").attr("class",f.axisX).attr("clip-path",Hi).attr("transform",_i.x).append("text").attr("class",f.axisXLabel).attr("transform",kh?"rotate(-90)":"").style("text-anchor",zb),Dh&&pj.append("g").attr("class",f.axisY).attr("clip-path",Ii).attr("transform",_i.y).append("text").attr("class",f.axisYLabel).attr("transform",kh?"":"rotate(-90)").style("text-anchor",Ab),Mh&&pj.append("g").attr("class",f.axisY2).attr("transform",_i.y2).append("text").attr("class",f.axisY2Label).attr("transform",kh?"":"rotate(-90)").style("text-anchor",Bb),pj.append("g").attr("clip-path",Gi).attr("class",f.regions),pj.append("g").attr("clip-path",Gi).attr("class",f.chart),c=pj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Of?kh?"ns-resize":"ew-resize":null),pj.select("."+f.chart).append("g").attr("class",f.chartBars),pj.select("."+f.chart).append("g").attr("class",f.chartLines),pj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",_i.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),pj.select("."+f.chart).append("g").attr("class",f.chartTexts),Of&&pj.insert("rect",Qf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Zf).attr("height",_f).style("opacity",0).style("cursor",kh?"ns-resize":"ew-resize").call(mj).on("dblclick.zoom",null),Bh&&ij.extent("function"!=typeof Bh?Bh:Bh(_b())),qj.append("g").attr("clip-path",Gi).attr("class",f.chart),qj.select("."+f.chart).append("g").attr("class",f.chartBars),qj.select("."+f.chart).append("g").attr("class",f.chartLines),qj.append("g").attr("clip-path",Gi).attr("class",f.brush).call(ij).selectAll("rect").attr(kh?"width":"height",kh?$f:ag),qj.append("g").attr("class",f.axisX).attr("transform",_i.subx).attr("clip-path",kh?"":Hi),pf(Ff.data.targets),kh?pj.select("."+f.axisX).style("opacity",0).call(yg):(pj.select("."+f.axisY).style("opacity",0).call(zg),pj.select("."+f.axisY2).style("opacity",0).call(Ag)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ai){if(Ji&&"string"==typeof Bi){for(Bi=we(Bi),e=0;e0){d=[];for(var g in Gg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function gf(a){he(Ff.data.targets)||Sg&&(Mi=a,pj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ni=!0,_g())}function hf(){he(Ff.data.targets)||Sg&&(pj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),pj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ni=!1,ah())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Vf:0,U=H?T:0,V=I?T:0,c=pj.select("."+f.axisX).style("opacity",$?0:1),g=pj.select("."+f.axisY).style("opacity",$?0:1),h=pj.select("."+f.axisY2).style("opacity",$?0:1),e=qj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&eh&&zf(Cc(Ff.data.targets),a,S),Ki&&(0!==_.length&&M&&K||sg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(sg.domain(Ef.extent(_b(_))),uj=sg.domain(),Of&&mj.scale(sg).updateScaleExtent(),vg.domain(sg.domain()),ij.scale(vg)),K&&(sg.domain(ij.empty()?uj:ij.extent()),Of&&mj.scale(sg).updateScaleExtent()),vh||!uh&&!th||(W=Kc(Jc(_),th),yg.tickValues(W),Bg.tickValues(W))),tg.domain(Xb(_,"y")),ug.domain(Xb(_,"y2")),S.axisX.call(yg),S.axisY.call(zg),S.axisY2.call(Ag),S.axisSubX.call(Bg),Db(G),K&&_.length)if(rh&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else nj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!kh&&wh&&eb(c,S.axisX,wh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),wg.domain(tg.domain()),xg.domain(ug.domain()),sj.style("display","none"),o(),pj.select("line."+f.xgridFocus).style("visibility","hidden"),Vh){if("year"===Wh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=sg.ticks(10);i=pj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",kh?0:function(a){return sg(a)-yg.tickOffset()}).attr("x2",kh?Zf:function(a){return sg(a)-yg.tickOffset()}).attr("y1",kh?function(a){return sg(a)-yg.tickOffset()}:Wf.top).attr("y2",kh?function(a){return sg(a)-yg.tickOffset()}:_f).style("opacity",function(){return+Ef.select(this).attr(kh?"y1":"x1")===(kh?_f:0)?0:1}),i.exit().remove()}Be(Xh)&&(k=pj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Xh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",kh?"":"rotate(-90)").attr("dx",kh?0:-Wf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",kh?0:Gd).attr("x2",kh?Zf:Gd).attr("y1",kh?Gd:Wf.top).attr("y2",kh?Gd:_f).style("opacity",1),k.select("text").transition().duration(T).attr("x",kh?Zf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Yh&&(m=pj.select("."+f.ygrids).selectAll("."+f.ygrid).data(tg.ticks($h)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",kh?tg:0).attr("x2",kh?tg:Zf).attr("y1",kh?0:tg).attr("y2",kh?_f:tg),m.exit().remove()),E&&Be(Zh)&&(n=pj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Zh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",kh?"rotate(-90)":"").attr("dx",kh?0:-Wf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",kh?Hd:0).attr("x2",kh?Hd:Zf).attr("y1",kh?0:Hd).attr("y2",kh?_f:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",kh?0:Zf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=pj.select("."+f.regions).selectAll("."+f.region).data(vi),v.enter().append("g").attr("class",hd).append("rect").style("fill-opacity",0),v.selectAll("rect").attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=pj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Si),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Si).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=pj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Si),q.style("opacity",td).transition().duration(T).attr("d",jj).style("stroke",Si).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=pj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Si).style("opacity",function(){return vj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",kj).style("fill",Si).style("opacity",vj),r.exit().transition().duration(U).style("opacity",0).remove(),s=pj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Si),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Si).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd),s.exit().remove(),w=pj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return kh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Si).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Si).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=pj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Si(a.data)}).style("cursor",function(a){return Ug(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Qi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Qi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Qi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Si(a.data)}).style("opacity",1).call(Ee,function(){Qi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),pj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),pj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),bh&&(null!==Ef.event&&"zoom"===Ef.event.type&&ij.extent(sg.orgDomain()).update(),F&&(!kh&&wh&&eb(e,S.axisSubX,wh),ij.empty()||ij.extent(sg.orgDomain()).update(),P=Xe(Z,!0),y=qj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Si),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=qj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Si),x.style("opacity",td).transition().duration(T).attr("d",lj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),pj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),pj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",kh?Xd:Wd).attr("cy",kh?Wd:Xd),z=pj.select("."+f.eventRects),Be(Dg)&&!oc(Dg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=pj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Zf).attr("height",_f)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Li&&!Ki?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(sg(d?d:e+50)-sg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(sg(d)+sg(c?c:d-50))/2}):(D=L(),C=function(a){return sg(a.x)-D/2}),B=Ac(Ff.data.targets),pj.select("."+f.eventRects).datum(B?B.values:[]),A=pj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",kh?0:C).attr("y",kh?C:0).attr("width",kh?Zf:D).attr("height",kh?D:_f),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){wj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&mj.altDomain?(sg.domain(mj.altDomain),void mj.scale(sg).updateScaleExtent()):(Ki&&sg.orgDomain()[0]===uj[0]&&sg.domain([uj[0]-1e-10,sg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Oi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){nj.attr("width",bg).attr("height",cg),nj.select("#"+Di).select("rect").attr("width",Zf).attr("height",_f),nj.select("#"+Ei).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),nj.select("#"+Fi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),nj.select("."+f.zoomRect).attr("width",Zf).attr("height",_f),tj.style("max-height",cg+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=pj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=pj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Ug(a)?"pointer":null}),c=pj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Ug(a)?"pointer":null}),a.forEach(function(a){pj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=pj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(jg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),bh&&(n=qj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=qj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),nj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Vf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=aj?j:i,l=aj?Q():P();return d&&(w=0,C=0,t=0,u=0),eh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=aj?u:t,void(jh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=rj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,aj?(g=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=rj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof gh?gh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Qi||Ff.focus(a),"function"==typeof hh&&hh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Qi||Ff.revert(),"function"==typeof ih&&ih(a)}),o.append("text").text(function(a){return d(Gg[a])?Gg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",aj?h:-200).attr("y",aj?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",aj?i:-200).attr("y",aj?-200:l),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Si).attr("x",aj?h:-200).attr("y",aj?-200:j).attr("width",10).attr("height",10),rj.selectAll("text").data(a).text(function(a){return d(Gg[a])?Gg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),rj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),rj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Si).attr("x",g).attr("y",j),rj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):ej}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Df(a,b,c){var d=!he(Ff.data.targets);Qi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"],0),Mf=h(["padding","top"],0),Nf=h(["padding","bottom"],0),Of=h(["zoom","enabled"],!1),Pf=h(["zoom","extent"]),Qf=h(["zoom","privileged"],!1),Rf=h(["onenter"],function(){}),Sf=h(["onleave"],function(){}),Tf=h(["onresize"],function(){}),Uf=h(["onresized"],function(){}),Vf=h(["transition","duration"],350);g("data","data is required in config");var Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg=h(["data","x"]),Dg=h(["data","xs"],{}),Eg=h(["data","x_format"]),Fg=h(["data","id_converter"],function(a){return a}),Gg=h(["data","names"],{}),Hg=h(["data","classes"],{}),Ig=h(["data","groups"],[]),Jg=h(["data","axes"],{}),Kg=h(["data","type"]),Lg=h(["data","types"],{}),Mg=h(["data","labels"],{}),Ng=h(["data","order"]),Og=h(["data","regions"],{}),Pg=h(["data","color"]),Qg=h(["data","colors"],{}),Rg=h(["data","hide"],!1),Sg=h(["data","selection","enabled"],!1),Tg=h(["data","selection","grouped"],!1),Ug=h(["data","selection","isselectable"],function(){return!0}),Vg=h(["data","selection","multiple"],!0),Wg=h(["data","onclick"],function(){}),Xg=h(["data","onenter"],function(){}),Yg=h(["data","onleave"],function(){}),Zg=h(["data","onselected"],function(){}),$g=h(["data","onunselected"],function(){}),_g=h(["data","ondragstart"],function(){}),ah=h(["data","ondragend"],function(){}),bh=h(["subchart","show"],!1),ch=h(["subchart","size","height"],60),dh=h(["color","pattern"],[]),eh=h(["legend","show"],!0),fh=h(["legend","position"],"bottom"),gh=h(["legend","item","onclick"]),hh=h(["legend","item","onmouseover"]),ih=h(["legend","item","onmouseout"]),jh=h(["legend","equally"],!1),kh=h(["axis","rotated"],!1),lh=h(["axis","x","show"],!0),mh=h(["axis","x","type"],"indexed"),nh=h(["axis","x","localtime"],!0),oh=h(["axis","x","categories"],[]),ph=h(["axis","x","tick","centered"],!1),qh=h(["axis","x","tick","format"]),rh=h(["axis","x","tick","culling"],{}),sh=h(["axis","x","tick","culling","max"],10),th=h(["axis","x","tick","count"]),uh=h(["axis","x","tick","fit"],!0),vh=h(["axis","x","tick","values"],null),wh=h(["axis","x","tick","rotate"]),xh=h(["axis","x","max"],null),yh=h(["axis","x","min"],null),zh=h(["axis","x","padding"],{}),Ah=h(["axis","x","height"]),Bh=h(["axis","x","default"]),Ch=h(["axis","x","label"],{}),Dh=h(["axis","y","show"],!0),Eh=h(["axis","y","max"]),Fh=h(["axis","y","min"]),Gh=h(["axis","y","center"]),Hh=h(["axis","y","label"],{}),Ih=h(["axis","y","inner"],!1),Jh=h(["axis","y","tick","format"]),Kh=h(["axis","y","padding"]),Lh=h(["axis","y","ticks"],10),Mh=h(["axis","y2","show"],!1),Nh=h(["axis","y2","max"]),Oh=h(["axis","y2","min"]),Ph=h(["axis","y2","center"]),Qh=h(["axis","y2","label"],{}),Rh=h(["axis","y2","inner"],!1),Sh=h(["axis","y2","tick","format"]),Th=h(["axis","y2","padding"]),Uh=h(["axis","y2","ticks"],10),Vh=h(["grid","x","show"],!1),Wh=h(["grid","x","type"],"tick"),Xh=h(["grid","x","lines"],[]),Yh=h(["grid","y","show"],!1),Zh=h(["grid","y","lines"],[]),$h=h(["grid","y","ticks"],10),_h=h(["point","show"],!0),ai=h(["point","r"],2.5),bi=h(["point","focus","line","enabled"],!0),ci=h(["point","focus","expand","enabled"],!0),di=h(["point","focus","expand","r"]),ei=h(["point","focus","select","r"]),fi=h(["line","connect_null"],!1),gi=h(["bar","width"]),hi=h(["bar","width","ratio"],.6),ii=h(["pie","label","show"],!0),ji=h(["pie","label","format"]),ki=h(["pie","expand"],!0),li=h(["pie","onclick"],function(){}),mi=h(["pie","onmouseover"],function(){}),ni=h(["pie","onmouseout"],function(){}),oi=h(["donut","label","show"],!0),pi=h(["donut","label","format"]),qi=h(["donut","expand"],!0),ri=h(["donut","title"],""),si=h(["donut","onclick"],function(){}),ti=h(["donut","onmouseover"],function(){}),ui=h(["donut","onmouseout"],function(){}),vi=h(["regions"],[]),wi=h(["tooltip","show"],!0),xi=h(["tooltip","format","title"]),yi=h(["tooltip","format","value"]),zi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=xi?xi:b,l=yi?yi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ai=h(["tooltip","init","show"],!1),Bi=h(["tooltip","init","x"],0),Ci=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Di=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ei=Di+"-xaxis",Fi=Di+"-yaxis",Gi=i(Di),Hi=i(Ei),Ii=i(Fi),Ji="timeseries"===mh,Ki="categorized"===mh,Li=!Ji&&(Cg||Be(Dg)),Mi=null,Ni=!1,Oi=!1,Pi=!1,Qi=!1,Ri=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Si=ve(Qg,Be(dh)?dh:Ri,Pg),Ti=nh?Ef.time.format:Ef.time.format.utc,Ui=function(){var a=[[Ti("%Y/%-m/%-d"),function(){return!0}],[Ti("%-m/%-d"),function(a){return a.getMonth()}],[Ti("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ti("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ti("%I %p"),function(a){return a.getHours()}],[Ti("%I:%M"),function(a){return a.getMinutes()}],[Ti(":%S"),function(a){return a.getSeconds()}],[Ti(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Vi=[],Wi=[],Xi=kh?"left":"bottom",Yi=kh?Ih?"top":"bottom":Ih?"right":"left",Zi=kh?Rh?"bottom":"top":Rh?"left":"right",$i=kh?"left":"bottom",_i={main:function(){return"translate("+Wf.left+","+Wf.top+")"},context:function(){return"translate("+Xf.left+","+Xf.top+")"},legend:function(){return"translate("+Yf.left+","+Yf.top+")"},x:function(){return"translate(0,"+(kh?0:_f)+")"},y:function(){return"translate(0,"+(kh?_f:0)+")"},y2:function(){return"translate("+(kh?0:Zf)+","+(kh?1:0)+")"},subx:function(){return"translate(0,"+(kh?0:ag)+")"},arc:function(){return"translate("+Zf/2+","+_f/2+")"}},aj="right"===fh,bj=0,cj=0,dj=0,ej=.15,fj=30,gj=kh&&!lh?0:30,hj=5;jg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ij,jj=function(){var a=Ef.svg.line().x(kh?function(a){return V(a.id)(a.value)}:Fd).y(kh?Fd:function(a){return V(a.id)(a.value)});return fi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=fi?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Og[b.id]?af(e,sg,V(b.id),Og[b.id]):a(e)):(c=e[0]?sg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,kh?"M "+d+" "+c:"M "+c+" "+d)}}(),kj=function(){var a;return a=kh?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?sg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,kh?"M "+d+" "+c:"M "+c+" "+d)}}(),lj=function(){var a=Ef.svg.line().x(kh?function(a){return W(a.id)(a.value)}:Id).y(kh?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+vg(c[0].x)+" "+W(b.id)(c[0].value)}}(),mj=function(){};ij=Ef.svg.brush().on("brush",kf),ij.update=function(){return qj&&qj.select("."+f.brush).call(this),this},ij.scale=function(a){return kh?this.y(a):this.x(a)},Of&&(mj=Ef.behavior.zoom().on("zoomstart",function(){mj.altDomain=Ef.event.sourceEvent.altKey?sg.orgDomain():null}).on("zoom",Of?lf:null),mj.scale=function(a){return kh?this.y(a):this.x(a)},mj.orgScaleExtent=function(){var a=Pf?Pf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},mj.updateScaleExtent=function(){var a=ac(sg.orgDomain())/ac(uj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var nj,oj,pj,qj,rj,sj,tj,uj,vj,wj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=nj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),nj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),nj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){ij.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Hg[b]=a.classes[b]}),"categories"in a&&Ki&&(oh=a.categories,yg.categories(oh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(pj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Sg&&pj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Tg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ug(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Sg&&pj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Tg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); -i&&j&&Ug(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d)})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Ig:(Ig=a,jf(),Ig)},Ff.xgrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Xh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Xh.filter(b))},Ff.ygrids=function(a){return a?(Zh=a,jf(),Zh):Zh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Zh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Zh.filter(b))},Ff.regions=function(a){return c(a)?vi:(vi=a,jf(),vi)},Ff.regions.add=function(a){return c(a)?vi:(vi=vi.concat(a),jf(),vi)},Ff.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;nj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),vi=vi.filter(function(b){return b.classes.indexOf(a)<0})}),vi},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Gg[b]=a[b]}),jf({withLegend:!0}),Gg):Gg},Ff.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Qg[b]=a[b]}),jf({withLegend:!0}),Qg):Qg},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(xh=+a.x),b(a.y)&&(Eh=+a.y),b(a.y2)&&(Nh=+a.y2)):Eh=Nh=+a,jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(yh=+a.x),b(a.y)&&(Fh=+a.y),b(a.y2)&&(Oh=+a.y2)):Fh=Oh=+a,jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},tj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a_f&&(_f=0),0>bg&&(bg=0),ag=mh?Yf.left-hj-ij:_f,cg=mh?bg:eg-Zf.top-Zf.bottom,0>ag&&(ag=0),0>cg&&(cg=0),q(),cj&&ie(Hf.data.targets)&&($f.left=_f/2+gg)}function p(){rj.select("line."+g.xgridFocus).attr("x1",mh?0:-10).attr("x2",mh?_f:-10).attr("y1",mh?-10:Yf.top).attr("y2",mh?-10:bg)}function q(){gg=bg/2,fg=.95*gg,hg=he(Hf.data.targets)?.6*fg:0}function r(){var a=mh?g.axisX:g.axisY,b=rj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Gf.select(Jf).node().getBoundingClientRect(),e=c.right-d.left-u();return e>0?e:0}function s(){return Kf?Kf:y()}function t(){var a=Lf?Lf:z();return a>0?a:320}function u(){return ie(Hf.data.targets)?0:Mf?Mf:mh?nh?w("x"):1:!Fh||Kh?1:w("y")}function v(){var a=1;return ie(Hf.data.targets)?0:Nf?Nf:cj?Q()+20+(Oh&&!mh?w("y2"):a):Oh?Th||mh?a:w("y2"):a}function w(a){var b=kb(a);return b.isInner?20+Db(a):40+Db(a)}function x(a){return"x"!==a||nh?"x"===a&&Ch?Ch:"y"!==a||Fh?"y2"!==a||Oh?(kb(a).isInner?30:40)+("y2"===a?-10:0):jj:gh&&!cj?10:1:0}function y(){return+Gf.select(Jf).style("width").replace("px","")}function z(){return+Gf.select(Jf).style("height").replace("px","")}function A(a){return a?-5:-(Yf.left-1)}function B(a){return a?-20:-4}function C(){return A(!mh)}function D(){return B(!mh)}function E(){return A(mh)}function F(){return B(mh)}function G(a){return a?_f+2+4:Yf.left+20}function H(a){return a?(Ch?Ch:0)+80:bg+8}function I(){return G(!mh)}function J(){return H(!mh)}function K(){return G(mh)}function L(){return H(mh)}function M(){var a,b,c,d,e,f=Ac(Hf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ug(b.x)-ug(a.x),0===c?mh?bg:_f:(d=zc(),e=ee(Hf.data.targets)?(d-(Mi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function N(a){dj=a}function O(a){ej=a}function P(a){fj=a}function Q(){return gh?cj?ej*(dj+1):dg:0}function R(){return gh?cj?eg:fj*(dj+1):0}function S(){var a,b,c=!ug;mg=mh?1:0,ng=mh?bg:_f,og=mh?0:bg,pg=mh?_f:1,qg=mg,rg=ng,sg=mh?0:cg,tg=mh?ag:1,ug=U(mg,ng,c?void 0:ug.domain(),function(){return Ag.tickOffset()}),vg=V(og,pg,c?void 0:vg.domain()),wg=V(og,pg,c?void 0:wg.domain()),xg=U(mg,ng,wj,function(a){return a%1?0:Dg.tickOffset()}),yg=V(sg,tg,c?void 0:yg.domain()),zg=V(sg,tg,c?void 0:zg.domain()),a=_(),b=xh?xh:c?void 0:Ag.tickValues(),Ag=Y(ug,Zi,a,b),Dg=Y(xg,aj,a,b),Bg=Z(vg,$i,Lh,Nh),Cg=Z(wg,_i,Uh,Wh),c||(kj.scale(xg),Qf&&oj.scale(ug)),T()}function T(){ig=Gb(),jg=Hb(),kg=Hb(.98)}function U(a,b,c,d){var e,f=(Li?Gf.time.scale():Gf.scale.linear()).range([a,b]),g=c?f.domain(c):f;Mi?(d=d||function(){return 0},f=function(a){return Math.ceil(g(a)+d(a))}):f=function(a){return Math.ceil(g(a))};for(e in g)f[e]=g[e];return f.orgDomain=function(){return g.domain()},Mi&&(f.domain=function(a){return arguments.length?(g.domain(a),f):(a=g.domain(),[a[0],a[1]+1])}),f}function V(a,b,c){var d=Gf.scale.linear().range([a,b]);return c&&d.domain(c),d}function W(a){return"y2"===$(a)?wg:vg}function X(a){return"y2"===$(a)?zg:yg}function Y(a,b,c,d){var f=e(Gf,Mi).scale(a).orient(b);return f.tickFormat(c).tickValues(d),Mi?(f.tickCentered(rh),Be(th)&&(th=!1),f.categories(qh)):f.tickOffset=function(){var a=Bc(Hf.data.targets),b=ug(a[1])-ug(a[0]),c=b?b:mh?bg:_f;return c/zc()/2},f}function Z(a,b,c,d){return e(Gf).scale(a).orient(b).tickFormat(c).ticks(d)}function $(a){return a in Lg?Lg[a]:"y"}function _(){var a=Li?Wi:Mi?Tc:function(a){return 0>a?a.toFixed(0):a};return sh&&("function"==typeof sh?a=sh:Li&&(a=function(a){return a?Vi(sh)(a):""})),a}function ab(a){var b;return"y"===a?b=Jh:"y2"===a?b=Sh:"x"===a&&(b=Eh),b}function bb(a){var b=ab(a);return"string"==typeof b?b:b?b.text:null}function cb(a,b){var c=ab(a);"string"==typeof c?"y"===a?Jh=b:"y2"===a?Sh=b:"x"===a&&(Eh=b):c&&(c.text=b)}function db(a){return 10*Math.sin(Math.PI*(a/180))}function eb(a){return 11.5-2.5*(a/15)}function fb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",eb(c)).attr("x",db(c)).attr("transform","rotate("+c+")")}function gb(a,b){var c=ab(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function hb(){return gb("x",mh?"inner-top":"inner-right")}function ib(){return gb("y",mh?"inner-right":"inner-top")}function jb(){return gb("y2",mh?"inner-right":"inner-top")}function kb(a){return"y2"===a?jb():"y"===a?ib():hb()}function lb(){return bb("x")}function mb(){return bb("y")}function nb(){return bb("y2")}function ob(a,b){return a?b.isLeft?0:b.isCenter?_f/2:_f:b.isBottom?-bg:b.isMiddle?-bg/2:0}function pb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function qb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function rb(){return ob(!mh,hb())}function sb(){return ob(mh,ib())}function tb(){return ob(mh,jb())}function ub(){return pb(!mh,hb())}function vb(){return pb(mh,ib())}function wb(){return pb(mh,jb())}function xb(){var a=hb();return mh?a.isInner?"1.2em":-25-Db("x"):a.isInner?"-0.5em":Ch?Ch-10:"3em"}function yb(){var a=ib();return mh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Db("y")}function zb(){var a=jb();return mh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Db("y2")}function Ab(){return qb(!mh,hb())}function Bb(){return qb(mh,ib())}function Cb(){return qb(mh,jb())}function Db(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Gf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Eb(a){var b=rj.select("."+g.axisX+" ."+g.axisXLabel),c=rj.select("."+g.axisY+" ."+g.axisYLabel),d=rj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",rb).attr("dx",ub).attr("dy",xb).text(lb),(a?c.transition():c).attr("x",sb).attr("dx",vb).attr("dy",yb).attr("dy",yb).text(mb),(a?d.transition():d).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb)}function Fb(a){var b=!1;return lg(Ic(Hf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Gb(){var a=Gf.svg.arc().outerRadius(fg).innerRadius(hg),b=function(b,c){var d;return c?a(b):(d=Fb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Hb(a){var b=Gf.svg.arc().outerRadius(gg*(a?a:1)).innerRadius(hg);return function(a){var c=Fb(a);return c?b(c):"M 0 0"}}function Ib(a,b){return pe(a.data)?ig(a,b):"M 0 0"}function Jb(a){var b,c,d,e,f=Fb(a),g="";return f&&(b=ig.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*fg*.8+","+d/e*fg*.8+")"),g}function Kb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Lb(a){return pc({id:a.data.id,value:a.value,ratio:Kb(a)})}function Mb(a){var b,c,d,e;return Pb()?(b=Fb(a),c=b?b.value:null,d=Kb(b),e=Qb(),e?e(c,d):Dd(c,d)):""}function Nb(a,b){var c=pj.selectAll("."+g.chartArc+pd(a)),d=pj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});ve(a)&&c.selectAll("path").transition().duration(50).attr("d",jg).transition().duration(100).attr("d",kg).each(function(a){oe(a.data)}),b||d.style("opacity",.3)}function Ob(a){var b=pj.selectAll("."+g.chartArc+pd(a));b.selectAll("path").transition().duration(50).attr("d",ig),pj.selectAll("."+g.arc).style("opacity",1)}function Pb(){return he(Hf.data.targets)?qi:ki}function Qb(){return he(Hf.data.targets)?ri:li}function Rb(){return he(Hf.data.targets)?ti:""}function Sb(){var a=he(Hf.data.targets)?ui:ni;return"function"==typeof a?a:function(){}}function Tb(){var a=he(Hf.data.targets)?vi:oi;return"function"==typeof a?a:function(){}}function Ub(){var a=he(Hf.data.targets)?wi:pi;return"function"==typeof a?a:function(){}}function Vb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Rc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Gf.min(Object.keys(i).map(function(a){return Gf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Kg.length>0)for(g=Sc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Gf.max(Object.keys(i).map(function(a){return Gf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return $(a.id)===c}),m="y2"===c?Qh:Hh,n="y2"===c?Ph:Gh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Rh:Ih,r=xd()&&mh;return 0===l.length?"y2"===c?wg.domain():vg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=yd(o,p),j=ac(vg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Mh&&(f=b(Mh.top)?Mh.top:e,g=b(Mh.bottom)?Mh.bottom:e),"y2"===c&&Vh&&(f=b(Vh.top)?Vh.top:e,g=b(Vh.bottom)?Vh.bottom:e),ee(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return Ah?Li?xe(Ah):Ah:Gf.min(a,function(a){return Gf.min(a.values,function(a){return a.x})})}function Zb(a){return zh?Li?xe(zh):zh:Gf.max(a,function(a){return Gf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Mi?d=0:ee(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Bh&&Ce(Bh)?(e=b(Bh.left)?Bh.left:d,f=b(Bh.right)?Bh.right:d):e=f="number"==typeof Bh?Bh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d!==0||Mi||(c=Li?new Date(.5*c.getTime()):-.5,d=Li?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Li?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Li?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?vg:wg;return b="y"===a.axis||"y2"===a.axis?mh?bg:"start"in a?d(a.start):bg:mh?"end"in a?ug(Li?xe(a.end):a.end):bg:bg,c>b?0:b-c}function ic(a){return Eg&&a===Eg||Ce(Fg)&&De(Fg,a)}function jc(a){return!ic(a)}function kc(a){return Eg?Eg:Ce(Fg)?Fg[a]:null}function lc(a,b){var c,d=b&&Ce(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Hf.data.xs[b])}),c}function mc(a,b){return a in Hf.data.xs&&Hf.data.xs[a]&&Hf.data.xs[a][b]?Hf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Fg[b]=a[b]})}function oc(a){return 1===Gf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Ig[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Hf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Li?a?a instanceof Date?a:xe(a):xe(mc(c,d)):Ni&&!Mi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Hf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Eg?(d=Object.keys(Hf.data.xs),Hf.data.xs[c]=d.length>0?Hf.data.xs[d[0]]:void 0):Ce(Fg)&&(Hf.data.xs[c]=lc(f,Hf.data.targets)):Hf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Hf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Hg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ni&&Mi&&0===c&&g&&(0===e&&(qh=[]),qh.push(g)),("undefined"==typeof a[b]||Hf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Mg&&ce(Cc(c).filter(function(a){return!(a in Ng)}),Mg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function xc(a){return a>0&&Hf.data.targets[0].values[a-1]?Hf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Hf.data.targets)}function Ec(a,b){var c,d=Cc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Li?new Date(i):i);j.push(e)}return Li||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Xi=Xi.concat(a)}function Mc(a){Xi=Xi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Yi=Yi.concat(a)}function Oc(a){Yi=Yi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Jd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Jd(a,g))),Md(e,b)):Kd(a,b,f,g)}function Ld(a,b){var c;return c=a.map(function(a){return Kd(a.values,b)}),Md(c,b)}function Md(a,b){var c,d;return a.forEach(function(a){var e=Ee(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Gf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Pd(){return Pg&&"desc"===Pg.toLowerCase()}function Qd(){return Pg&&"asc"===Pg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Pg&&a.sort(Pg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=ie(Hf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&yi&&(uj.html(Bi(a,_(),zd(k),Ui)).style("display","block"),d=uj.property("offsetWidth"),e=uj.property("offsetHeight"),k?(g=_f/2+c[0],i=bg/2+c[1]+20):(mh?(f=r(),g=f+c[0]+100,h=g+d,j=s()-v(),i=ug(l[0].x)+20):(f=r(),g=f+u()+ug(l[0].x)+20,h=g+d,j=f+s()-v(),i=c[1]+15),h>j&&(g-=d+60),i+e>t()&&(i-=e+30)),uj.style("top",i+"px").style("left",g+"px"))}function Td(){uj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});if(yi&&!fe(Hf.data.targets)&&!ie(Hf.data.targets)){var d=rj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(mh?"y1":"x1",Fd).attr(mh?"y2":"x2",Fd),kf(d,"grid")}}function Vd(){rj.select("line."+g.xgridFocus).style("visibility","hidden")}function Wd(a,b){var c,d,e,f,g=[];if("year"===a)for(c=_b(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)g.push(new Date(f+"-01-01 00:00:00"));else g=b.ticks(10);return g}function Xd(a){return a.x||0===a.x?ug(a.x):null}function Yd(a){return W(a.id)(a.value)}function Zd(){var a,b,d={},e=0;return Ic(Fc(le)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function be(a,b){return"number"==typeof ii?ii:b?2*a.tickOffset()*ji/b:0}function ce(a,b){Dc(a).forEach(function(a){yj[a]=b===Ng[a],Ng[a]=b})}function de(a,b){var c=!1;return a.forEach(function(a){Ng[a.id]===b&&(c=!0),a.id in Ng||"line"!==b||(c=!0)}),c}function ee(a){return de(a,"bar")}function fe(a){return de(a,"scatter")}function ge(a){return de(a,"pie")}function he(a){return de(a,"donut")}function ie(a){return ge(a)||he(a)}function je(a){var b="string"==typeof a?a:a.id;return!(b in Ng)||"line"===Ng[b]||"spline"===Ng[b]||"area"===Ng[b]||"area-spline"===Ng[b]}function ke(a){var b="string"==typeof a?a:a.id;return"spline"===Ng[b]||"area-spline"===Ng[b]}function le(a){var b="string"==typeof a?a:a.id;return"bar"===Ng[b]}function me(a){var b="string"==typeof a?a:a.id;return"scatter"===Ng[b]}function ne(a){var b="string"==typeof a?a:a.id;return"pie"===Ng[b]}function oe(a){var b="string"==typeof a?a:a.id;return"donut"===Ng[b]}function pe(a){return ne(a)||oe(a)}function qe(a){return je(a)?[a]:[]}function re(a){return pe(a.data)?[a]:[]}function se(a){return le(a)?a.values:[]}function te(a){return je(a)||me(a)?a.values:[]}function ue(a){return le(a)||je(a)?a.values:[]}function ve(a){return oe(a)&&si||ne(a)&&mi}function we(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function xe(b){var c;try{c=Gg?Gf.time.format(Gg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Gg)}return c}function ye(a,b){var c=Gf.mouse(a),d=Gf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function De(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ee(a,b){var c="y"===$(a.id)?vg:wg,d=mh?1:0,e=mh?0:1;return Math.pow(ug(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Fe(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ge(a,b,c){_g(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(g.selectedCircle,c)}).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd).attr("stroke",function(){return Ui(b)}).attr("r",1.4*Re(b)).transition().duration(100).attr("r",Re)}function He(a,b,c){ah(b,a.node()),rj.select("."+g.selectedCircles+od(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ie(a,b,c,d){a?Ge(b,c,d):He(b,c,d)}function Je(a,b){_g(b,a.node()),a.transition().duration(100).style("fill",function(){return Gf.rgb(Ui(b)).brighter(.75)})}function Ke(a,b){ah(b,a.node()),a.transition().duration(100).style("fill",function(){return Ui(b)})}function Le(a,b,c,d){a?Je(b,c,d):Ke(b,c,d)}function Me(a,b,c,d){Le(a,b,c.data,d)}function Ne(a){return"circle"===a.nodeName?Ie:Gf.select(a).classed(g.bar)?Le:Me}function Oe(a){return a.filter(function(a){return b(a.value)})}function Pe(a){return bi?"function"==typeof ci?ci(a):ci:0}function Qe(a){return ei?fi?fi:1.75*Pe(a):Pe(a)}function Re(a){return gi?gi:4*Pe(a)}function Se(a,c){return(c?rj.selectAll("."+g.circles+od(c)):rj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function Te(a,b){Se(a,b).classed(g.EXPANDED,!0).attr("r",Qe)}function Ue(a){Se(a).filter(function(){return Gf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Pe)}function Ve(a){return rj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function We(a){Ve(a).classed(g.EXPANDED,!0)}function Xe(a){Ve(a).classed(g.EXPANDED,!1)}function Ye(a,b){var c=af(a,b);return function(a,b){var d=c(a,b),e=mh?1:0,f=mh?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function Ze(a,b){var c=af(a,!1),d=b?$e:_e;return function(a,b){return d(c(a,b),a,this)}}function $e(a,b){var c;return mh?(c=le(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function _e(a,b,c){var d=c.getBoundingClientRect();return mh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:le(b)?-3:-6)}function af(a,b){var c=a.__max__+1,d=be(Ag,c),e=$d(d,c,a,!!b),f=_d(!!b),g=ae(a,!!b),h=b?X:W;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return mh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function bf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function cf(b){var c,d,e;if(vj=Gf.select(Jf),vj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(vj.html("").classed("c3",!0),Hf.data.xs={},Hf.data.targets=vc(b),Tg&&Lc(Tg===!0?Cc(Hf.data.targets):Tg),o(),S(),ug.domain(Gf.extent(_b(Hf.data.targets))),vg.domain(Xb(Hf.data.targets,"y")),wg.domain(Xb(Hf.data.targets,"y2")),xg.domain(ug.domain()),yg.domain(vg.domain()),zg.domain(wg.domain()),wj=ug.domain(),kj.scale(xg),Qf&&oj.scale(ug),pj=vj.append("svg").on("mouseenter",Tf).on("mouseleave",Uf),qj=pj.append("defs"),qj.append("clipPath").attr("id",Fi).append("rect"),qj.append("clipPath").attr("id",Gi).append("rect"),qj.append("clipPath").attr("id",Hi).append("rect"),pf(),rj=pj.append("g").attr("transform",bj.main),sj=pj.append("g").attr("transform",bj.context),tj=pj.append("g").attr("transform",bj.legend),dh||sj.style("visibility","hidden"),gh||(tj.style("visibility","hidden"),Yi=Cc(Hf.data.targets)),uj=Gf.select(Jf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Bf(Cc(Hf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=rj.append("g").attr("clip-path",Ii).attr("class",g.grid),Xh&&d.append("g").attr("class",g.xgrids),Ce(Zh)&&d.append("g").attr("class",g.xgridLines),di&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),$h&&d.append("g").attr("class",g.ygrids),Ce(_h)&&d.append("g").attr("class",g.ygridLines),nh&&rj.append("g").attr("class",g.axisX).attr("clip-path",Ji).attr("transform",bj.x).append("text").attr("class",g.axisXLabel).attr("transform",mh?"rotate(-90)":"").style("text-anchor",Ab),Fh&&rj.append("g").attr("class",g.axisY).attr("clip-path",Ki).attr("transform",bj.y).append("text").attr("class",g.axisYLabel).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Bb),Oh&&rj.append("g").attr("class",g.axisY2).attr("transform",bj.y2).append("text").attr("class",g.axisY2Label).attr("transform",mh?"":"rotate(-90)").style("text-anchor",Cb),rj.append("g").attr("clip-path",Ii).attr("class",g.regions),rj.append("g").attr("clip-path",Ii).attr("class",g.chart),c=rj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Qf?mh?"ns-resize":"ew-resize":null),rj.select("."+g.chart).append("g").attr("class",g.chartBars),rj.select("."+g.chart).append("g").attr("class",g.chartLines),rj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",bj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Rb()),rj.select("."+g.chart).append("g").attr("class",g.chartTexts),Qf&&rj.insert("rect",Sf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",_f).attr("height",bg).style("opacity",0).style("cursor",mh?"ns-resize":"ew-resize").call(oj).on("dblclick.zoom",null),Dh&&kj.extent("function"!=typeof Dh?Dh:Dh(_b())),sj.append("g").attr("clip-path",Ii).attr("class",g.chart),sj.select("."+g.chart).append("g").attr("class",g.chartBars),sj.select("."+g.chart).append("g").attr("class",g.chartLines),sj.append("g").attr("clip-path",Ii).attr("class",g.brush).call(kj).selectAll("rect").attr(mh?"width":"height",mh?ag:cg),sj.append("g").attr("class",g.axisX).attr("transform",bj.subx).attr("clip-path",mh?"":Ji),rf(Hf.data.targets),mh?rj.select("."+g.axisX).style("opacity",0).call(Ag):(rj.select("."+g.axisY).style("opacity",0).call(Bg),rj.select("."+g.axisY2).style("opacity",0).call(Cg)),o(),S(),pf(),n(!1),lf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ci){if(Li&&"string"==typeof Di){for(Di=xe(Di),e=0;e0){d=[];for(var f in Ig)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Le,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function hf(a){ie(Hf.data.targets)||Ug&&(Oi=a,rj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Pi=!0,bh())}function jf(){ie(Hf.data.targets)||Ug&&(rj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),rj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Pi=!1,ch())}function kf(a,b){"grid"===b&&a.each(function(){var a=Gf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function lf(a){var c,e,f,h,i,j,k,l,m,n,o,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_=Zd(),ab=ie(Hf.data.targets),bb=Ic(Hf.data.targets);if(a=d(a)?a:{},G=d(a.withY)?a.withY:!0,H=d(a.withSubchart)?a.withSubchart:!0,I=d(a.withTransition)?a.withTransition:!0,L=d(a.withTransform)?a.withTransform:!1,N=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,O=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,P=d(a.withLegend)?a.withLegend:!1,J=d(a.withTransitionForExit)?a.withTransitionForExit:I,K=d(a.withTransitionForAxis)?a.withTransitionForAxis:I,V=I?Xf:0,W=J?V:0,X=K?V:0,c=rj.select("."+g.axisX).style("opacity",ab?0:1),f=rj.select("."+g.axisY).style("opacity",ab?0:1),h=rj.select("."+g.axisY2).style("opacity",ab?0:1),e=sj.select("."+g.axisX).style("opacity",ab?0:1),U={axisX:c.transition().duration(X),axisY:f.transition().duration(X),axisY2:h.transition().duration(X),axisSubX:e.transition().duration(X)},P&&gh&&Bf(Cc(Hf.data.targets),a,U),Mi&&(0!==bb.length&&O&&N||ug.domain([0,c.selectAll(".tick").size()])),bb.length&&(O&&(ug.domain(Gf.extent(_b(bb))),wj=ug.domain(),Qf&&oj.scale(ug).updateScaleExtent(),xg.domain(ug.domain()),kj.scale(xg)),N&&(ug.domain(kj.empty()?wj:kj.extent()),Qf&&oj.scale(ug).updateScaleExtent()),xh||!wh&&!vh||(Y=Kc(Jc(bb),vh),Ag.tickValues(Y),Dg.tickValues(Y))),vg.domain(Xb(bb,"y")),wg.domain(Xb(bb,"y2")),U.axisX.call(Ag),U.axisY.call(Bg),U.axisY2.call(Cg),U.axisSubX.call(Dg),Eb(I),N&&bb.length)if(th&&Y){for(Z=1;Z=0&&Gf.select(this).style("display",b%$?"none":"block")})}else pj.selectAll("."+g.axisX+" .tick text").style("display","block");D=Ag.tickOffset(),!mh&&yh&&fb(c,U.axisX,yh),Q=Ye(_),S=Ze(_,!0),T=Ze(_,!1),yg.domain(vg.domain()),zg.domain(wg.domain()),uj.style("display","none"),p(),rj.select("line."+g.xgridFocus).style("visibility","hidden"),Xh&&(k=Wd(Yh,ug),j=mh?{x1:0,x2:_f,y1:function(a){return ug(a)-D},y2:function(a){return ug(a)-D}}:{x1:function(a){return ug(a)+D},x2:function(a){return ug(a)+D},y1:Yf.top,y2:bg},i=rj.select("."+g.xgrids).selectAll("."+g.xgrid).data(k),i.enter().append("line").attr("class",g.xgrid),i.attr(j).style("opacity",function(){return+Gf.select(this).attr(mh?"y1":"x1")===(mh?bg:0)?0:1}),i.exit().remove()),Ce(Zh)&&(l=rj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(Zh),m=l.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",mh?"":"rotate(-90)").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(V).attr("x1",mh?0:Gd).attr("x2",mh?_f:Gd).attr("y1",mh?Gd:Yf.top).attr("y2",mh?Gd:bg).style("opacity",1),l.select("text").transition().duration(V).attr("x",mh?_f:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(V).style("opacity",0).remove()),G&&$h&&(n=rj.select("."+g.ygrids).selectAll("."+g.ygrid).data(vg.ticks(ai)),n.enter().append("line").attr("class",g.ygrid),n.attr("x1",mh?vg:0).attr("x2",mh?vg:_f).attr("y1",mh?0:vg).attr("y2",mh?bg:vg),n.exit().remove(),kf(n,"grid")),G&&Ce(_h)&&(o=rj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(_h),q=o.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),q.append("line").style("opacity",0),q.append("text").attr("text-anchor","end").attr("transform",mh?"rotate(-90)":"").attr("dx",mh?0:-Yf.top).attr("dy",-5).style("opacity",0),o.select("line").transition().duration(V).attr("x1",mh?Hd:0).attr("x2",mh?Hd:_f).attr("y1",mh?0:Hd).attr("y2",mh?bg:Hd).style("opacity",1),o.select("text").transition().duration(V).attr("x",mh?0:_f).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),o.exit().transition().duration(V).style("opacity",0).remove()),w=rj.select("."+g.regions).selectAll("."+g.region).data(xi),w.enter().append("g").attr("class",hd).append("rect").style("fill-opacity",0),w.selectAll("rect").attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(V).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),w.exit().transition().duration(V).style("fill-opacity",0).remove(),u=rj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),u.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),u.style("opacity",td).transition().duration(V).attr("d",Q).style("fill",Ui).style("opacity",1),u.exit().transition().duration(W).style("opacity",0).remove(),r=rj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),r.enter().append("path").attr("class",Zc).style("stroke",Ui),r.style("opacity",td).transition().duration(V).attr("d",lj).style("stroke",Ui).style("opacity",1),r.exit().transition().duration(W).style("opacity",0).remove(),s=rj.selectAll("."+g.areas).selectAll("."+g.area).data(qe),s.enter().append("path").attr("class",fd).style("fill",Ui).style("opacity",function(){return xj=+Gf.select(this).style("opacity"),0}),s.style("opacity",0).transition().duration(V).attr("d",mj).style("fill",Ui).style("opacity",xj),s.exit().transition().duration(W).style("opacity",0).remove(),t=rj.selectAll("."+g.circles).selectAll("."+g.circle).data(te),t.enter().append("circle").attr("class",_c).attr("r",Pe).style("fill",Ui),t.style("opacity",td).transition().duration(V).style("opacity",vd).style("fill",Ui).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),t.exit().remove(),x=rj.selectAll("."+g.texts).selectAll("."+g.text).data(ue),x.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return mh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Ui).style("fill-opacity",0),x.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(V).attr("x",S).attr("y",T).style("fill",Ui).style("fill-opacity",wd),x.exit().transition().duration(W).style("fill-opacity",0).remove(),v=rj.selectAll("."+g.arcs).selectAll("."+g.arc).data(re),v.enter().append("path").attr("class",dd).style("fill",function(a){return Ui(a.data)}).style("cursor",function(a){return Wg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),xf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Gf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Si||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),yf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ff(this,a,b),e(d,b)}),v.attr("transform",L?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Si=!0}).transition().duration(V).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Gf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",L?"scale(1)":"").style("fill",function(a){return Ui(a.data)}).style("opacity",1).call(Fe,function(){Si=!1}),v.exit().transition().duration(W).style("opacity",0).remove(),rj.selectAll("."+g.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(V).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&pe(a.data)?1:0}),rj.select("."+g.chartArcsTitle).style("opacity",he(Hf.data.targets)?1:0),dh&&(null!==Gf.event&&"zoom"===Gf.event.type&&kj.extent(ug.orgDomain()).update(),H&&(!mh&&yh&&fb(e,U.axisSubX,yh),kj.empty()||kj.extent(ug.orgDomain()).update(),R=Ye(_,!0),z=sj.selectAll("."+g.bars).selectAll("."+g.bar).data(se),z.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Ui),z.style("opacity",td).transition().duration(V).attr("d",R).style("opacity",1),z.exit().transition().duration(V).style("opacity",0).remove(),y=sj.selectAll("."+g.lines).selectAll("."+g.line).data(qe),y.enter().append("path").attr("class",Zc).style("stroke",Ui),y.style("opacity",td).transition().duration(V).attr("d",nj).style("opacity",1),y.exit().transition().duration(V).style("opacity",0).remove())),rj.selectAll("."+g.selectedCircles).filter(function(a){return le(a)}).selectAll("circle").remove(),rj.selectAll("."+g.selectedCircle).transition().duration(V).attr("cx",mh?Yd:Xd).attr("cy",mh?Xd:Yd),A=rj.select("."+g.eventRects),Ce(Fg)&&!oc(Fg)?(A.classed(g.eventRectsMultiple)||A.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),ef(B.enter()),B.attr("x",0).attr("y",0).attr("width",_f).attr("height",bg)):(A.classed(g.eventRectsSingle)||A.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ni&&!Mi?(F=function(a,b){var c=xc(b),d=yc(b),e=Hf.data.xs[a.id][b];return(ug(d?d:e+50)-ug(c?c:e-50))/2},E=function(a,b){var c=xc(b),d=Hf.data.xs[a.id][b];return(ug(d)+ug(c?c:d-50))/2}):(F=M(),E=function(a){return ug(a.x)-F/2}),C=Ac(Hf.data.targets),rj.select("."+g.eventRects).datum(C?C.values:[]),B=rj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),df(B.enter()),B.attr("class",id).attr("x",mh?0:E).attr("y",mh?E:0).attr("width",mh?_f:F).attr("height",mh?F:bg),B.exit().remove()),Cc(Hf.data.targets).forEach(function(a){yj[a]=!0})}function mf(){lf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function nf(){return"mousemove"===Gf.event.sourceEvent.type&&oj.altDomain?(ug.domain(oj.altDomain),void oj.scale(ug).updateScaleExtent()):(Mi&&ug.orgDomain()[0]===wj[0]&&ug.domain([wj[0]-1e-10,ug.orgDomain()[1]]),lf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Gf.event.sourceEvent.type&&(Qi=!0)))}function of(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function pf(){pj.attr("width",dg).attr("height",eg),pj.select("#"+Fi).select("rect").attr("width",_f).attr("height",bg),pj.select("#"+Gi).select("rect").attr("x",C).attr("y",D).attr("width",I).attr("height",J),pj.select("#"+Hi).select("rect").attr("x",E).attr("y",F).attr("width",K).attr("height",L),pj.select("."+g.zoomRect).attr("width",_f).attr("height",bg),vj.style("max-height",eg+"px")}function qf(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,o(),S(),pf(),n(a.withTransition),lf(a)}function rf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=rj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=rj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Wg(a)?"pointer":null}),c=rj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(g.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Wg(a)?"pointer":null}),a.forEach(function(a){rj.selectAll("."+g.selectedCircles+od(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=rj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(lg(a)).attr("class",nd),f=h.enter().append("g").attr("class",nd),f.append("g").attr("class",ed),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),dh&&(n=sj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=sj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),pj.selectAll("."+g.target).filter(function(a){return Gc(a.id)}).transition().duration(Xf).style("opacity",1)}function sf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ce(a.id,b.types[a.id]):ce(a.id,b.type)}),Hf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=cj?j:i,l=cj?R():Q();return d&&(w=0,C=0,t=0,u=0),gh&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=cj?u:t,void(lh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=tj.selectAll("."+g.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,cj?(f=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(f=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=tj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(g.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof ih?ih(a):Hf.toggle(a)}).on("mouseover",function(a){Gf.select(this).classed(g.legendItemFocused,!0),Si||Hf.focus(a),"function"==typeof jh&&jh(a)}).on("mouseout",function(a){Gf.select(this).classed(g.legendItemFocused,!1),Si||Hf.revert(),"function"==typeof kh&&kh(a)}),m.append("text").text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",cj?h:-200).attr("y",cj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",cj?i:-200).attr("y",cj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Ui).attr("x",cj?h:-200).attr("y",cj?-200:j).attr("width",10).attr("height",10),tj.selectAll("text").data(a).text(function(a){return d(Ig[a])?Ig[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),tj.selectAll("rect."+g.legendItemEvent).data(a).transition().duration(p?250:0).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}).attr("x",i).attr("y",l),tj.selectAll("rect."+g.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Ui).attr("x",f).attr("y",j),tj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Gf.select(this);return Gc(a)?!D||b.classed(g.legendItemFocused)?vf(b):wf(b):gj}),O(t),P(u),N(C),o(),S(),pf(),n(q,c)}function Cf(a){return Ec(Hf.data.targets,a.id)}function Df(a){return"data"in a&&Ec(Hf.data.targets,a.data.id)}function Ef(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Ff(a,b,c){var d=!ie(Hf.data.targets);Si=!1,ce(a,b),qf(c||{withTransitionForAxis:d})}var Gf=a.d3?a.d3:a.require?a.require("d3"):void 0,Hf={data:{},axis:{},legend:{}},If={},Jf=i(["bindto"],"#chart"),Kf=i(["size","width"]),Lf=i(["size","height"]),Mf=i(["padding","left"],50),Nf=i(["padding","right"],0),Of=i(["padding","top"],0),Pf=i(["padding","bottom"],0),Qf=i(["zoom","enabled"],!1),Rf=i(["zoom","extent"]),Sf=i(["zoom","privileged"],!1),Tf=i(["onenter"],function(){}),Uf=i(["onleave"],function(){}),Vf=i(["onresize"],function(){}),Wf=i(["onresized"],function(){}),Xf=i(["transition","duration"],350);h("data","data is required in config");var Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg=i(["data","x"]),Fg=i(["data","xs"],{}),Gg=i(["data","x_format"]),Hg=i(["data","id_converter"],function(a){return a}),Ig=i(["data","names"],{}),Jg=i(["data","classes"],{}),Kg=i(["data","groups"],[]),Lg=i(["data","axes"],{}),Mg=i(["data","type"]),Ng=i(["data","types"],{}),Og=i(["data","labels"],{}),Pg=i(["data","order"]),Qg=i(["data","regions"],{}),Rg=i(["data","color"]),Sg=i(["data","colors"],{}),Tg=i(["data","hide"],!1),Ug=i(["data","selection","enabled"],!1),Vg=i(["data","selection","grouped"],!1),Wg=i(["data","selection","isselectable"],function(){return!0}),Xg=i(["data","selection","multiple"],!0),Yg=i(["data","onclick"],function(){}),Zg=i(["data","onenter"],function(){}),$g=i(["data","onleave"],function(){}),_g=i(["data","onselected"],function(){}),ah=i(["data","onunselected"],function(){}),bh=i(["data","ondragstart"],function(){}),ch=i(["data","ondragend"],function(){}),dh=i(["subchart","show"],!1),eh=i(["subchart","size","height"],60),fh=i(["color","pattern"],[]),gh=i(["legend","show"],!0),hh=i(["legend","position"],"bottom"),ih=i(["legend","item","onclick"]),jh=i(["legend","item","onmouseover"]),kh=i(["legend","item","onmouseout"]),lh=i(["legend","equally"],!1),mh=i(["axis","rotated"],!1),nh=i(["axis","x","show"],!0),oh=i(["axis","x","type"],"indexed"),ph=i(["axis","x","localtime"],!0),qh=i(["axis","x","categories"],[]),rh=i(["axis","x","tick","centered"],!1),sh=i(["axis","x","tick","format"]),th=i(["axis","x","tick","culling"],{}),uh=i(["axis","x","tick","culling","max"],10),vh=i(["axis","x","tick","count"]),wh=i(["axis","x","tick","fit"],!0),xh=i(["axis","x","tick","values"],null),yh=i(["axis","x","tick","rotate"]),zh=i(["axis","x","max"],null),Ah=i(["axis","x","min"],null),Bh=i(["axis","x","padding"],{}),Ch=i(["axis","x","height"]),Dh=i(["axis","x","default"]),Eh=i(["axis","x","label"],{}),Fh=i(["axis","y","show"],!0),Gh=i(["axis","y","max"]),Hh=i(["axis","y","min"]),Ih=i(["axis","y","center"]),Jh=i(["axis","y","label"],{}),Kh=i(["axis","y","inner"],!1),Lh=i(["axis","y","tick","format"]),Mh=i(["axis","y","padding"]),Nh=i(["axis","y","ticks"],10),Oh=i(["axis","y2","show"],!1),Ph=i(["axis","y2","max"]),Qh=i(["axis","y2","min"]),Rh=i(["axis","y2","center"]),Sh=i(["axis","y2","label"],{}),Th=i(["axis","y2","inner"],!1),Uh=i(["axis","y2","tick","format"]),Vh=i(["axis","y2","padding"]),Wh=i(["axis","y2","ticks"],10),Xh=i(["grid","x","show"],!1),Yh=i(["grid","x","type"],"tick"),Zh=i(["grid","x","lines"],[]),$h=i(["grid","y","show"],!1),_h=i(["grid","y","lines"],[]),ai=i(["grid","y","ticks"],10),bi=i(["point","show"],!0),ci=i(["point","r"],2.5),di=i(["point","focus","line","enabled"],!0),ei=i(["point","focus","expand","enabled"],!0),fi=i(["point","focus","expand","r"]),gi=i(["point","focus","select","r"]),hi=i(["line","connect_null"],!1),ii=i(["bar","width"]),ji=i(["bar","width","ratio"],.6),ki=i(["pie","label","show"],!0),li=i(["pie","label","format"]),mi=i(["pie","expand"],!0),ni=i(["pie","onclick"],function(){}),oi=i(["pie","onmouseover"],function(){}),pi=i(["pie","onmouseout"],function(){}),qi=i(["donut","label","show"],!0),ri=i(["donut","label","format"]),si=i(["donut","expand"],!0),ti=i(["donut","title"],""),ui=i(["donut","onclick"],function(){}),vi=i(["donut","onmouseover"],function(){}),wi=i(["donut","onmouseout"],function(){}),xi=i(["regions"],[]),yi=i(["tooltip","show"],!0),zi=i(["tooltip","format","title"]),Ai=i(["tooltip","format","value"]),Bi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=zi?zi:b,l=Ai?Ai:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ci=i(["tooltip","init","show"],!1),Di=i(["tooltip","init","x"],0),Ei=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Fi=("string"==typeof Jf?Jf.replace("#",""):Jf.id)+"-clip",Gi=Fi+"-xaxis",Hi=Fi+"-yaxis",Ii=j(Fi),Ji=j(Gi),Ki=j(Hi),Li="timeseries"===oh,Mi="categorized"===oh,Ni=!Li&&(Eg||Ce(Fg)),Oi=null,Pi=!1,Qi=!1,Ri=!1,Si=!1,Ti=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ui=we(Sg,Ce(fh)?fh:Ti,Rg),Vi=ph?Gf.time.format:Gf.time.format.utc,Wi=function(){var a=[[Vi("%Y/%-m/%-d"),function(){return!0}],[Vi("%-m/%-d"),function(a){return a.getMonth()}],[Vi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Vi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Vi("%I %p"),function(a){return a.getHours()}],[Vi("%I:%M"),function(a){return a.getMinutes()}],[Vi(":%S"),function(a){return a.getSeconds()}],[Vi(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Xi=[],Yi=[],Zi=mh?"left":"bottom",$i=mh?Kh?"top":"bottom":Kh?"right":"left",_i=mh?Th?"bottom":"top":Th?"left":"right",aj=mh?"left":"bottom",bj={main:function(){return"translate("+Yf.left+","+Yf.top+")"},context:function(){return"translate("+Zf.left+","+Zf.top+")"},legend:function(){return"translate("+$f.left+","+$f.top+")"},x:function(){return"translate(0,"+(mh?0:bg)+")"},y:function(){return"translate(0,"+(mh?bg:0)+")"},y2:function(){return"translate("+(mh?0:_f)+","+(mh?1:0)+")"},subx:function(){return"translate(0,"+(mh?0:cg)+")"},arc:function(){return"translate("+_f/2+","+bg/2+")"}},cj="right"===hh,dj=0,ej=0,fj=0,gj=.15,hj=30,ij=mh&&!nh?0:30,jj=5;lg=Gf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var kj,lj=function(){var a=Gf.svg.line().x(mh?function(a){return W(a.id)(a.value) +}:Fd).y(mh?Fd:function(a){return W(a.id)(a.value)});return hi||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=hi?Oe(b.values):b.values;return je(b)?(a.interpolate(ke(b)?"cardinal":"linear"),Qg[b.id]?bf(e,ug,W(b.id),Qg[b.id]):a(e)):(c=e[0]?ug(e[0].x):0,d=e[0]?W(b.id)(e[0].value):0,mh?"M "+d+" "+c:"M "+c+" "+d)}}(),mj=function(){var a;return a=mh?Gf.svg.area().x0(function(a){return W(a.id)(0)}).x1(function(a){return W(a.id)(a.value)}).y(Fd):Gf.svg.area().x(Fd).y0(function(a){return W(a.id)(0)}).y1(function(a){return W(a.id)(a.value)}),function(b){var c,d,e=Oe(b.values);return de([b],"area")||de([b],"area-spline")?(a.interpolate(ke(b)?"cardinal":"linear"),a(e)):(c=e[0]?ug(e[0].x):0,d=e[0]?W(b.id)(e[0].value):0,mh?"M "+d+" "+c:"M "+c+" "+d)}}(),nj=function(){var a=Gf.svg.line().x(mh?function(a){return X(a.id)(a.value)}:Id).y(mh?Id:function(a){return X(a.id)(a.value)});return function(b){var c=Oe(b.values);return je(b)?a(c):"M "+xg(c[0].x)+" "+X(b.id)(c[0].value)}}(),oj=function(){};kj=Gf.svg.brush().on("brush",mf),kj.update=function(){return sj&&sj.select("."+g.brush).call(this),this},kj.scale=function(a){return mh?this.y(a):this.x(a)},Qf&&(oj=Gf.behavior.zoom().on("zoomstart",function(){oj.altDomain=Gf.event.sourceEvent.altKey?ug.orgDomain():null}).on("zoom",Qf?nf:null),oj.scale=function(a){return mh?this.y(a):this.x(a)},oj.orgScaleExtent=function(){var a=Rf?Rf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},oj.updateScaleExtent=function(){var a=ac(ug.orgDomain())/ac(wj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var pj,qj,rj,sj,tj,uj,vj,wj,xj,yj={};if(Hf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);Hf.revert(),Hf.defocus(),b(d.classed(g.focused,!0)),b(e),ie(Hf.data.targets)&&Nb(a,!0),xf(a,!0)},Hf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);Hf.revert(),b(d.classed(g.focused,!1)),b(e),ie(Hf.data.targets)&&Ob(a),xf(a,!1)},Hf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=pj.selectAll(pd(a)),d=c.filter(Cf),e=c.filter(Df);b(d.classed(g.focused,!1)),b(e),ie(Hf.data.targets)&&Ob(a),yf()},Hf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),pj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&zf(a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Hf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),pj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&Af(a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Hf.toggle=function(a){Gc(a)?Hf.hide(a):Hf.show(a)},Hf.unzoom=function(){kj.clear().update(),lf({withUpdateXDomain:!0})},Hf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Jg[b]=a.classes[b]}),"categories"in a&&Mi&&(qh=a.categories,Ag.categories(qh)),"cacheIds"in a&&bc(a.cacheIds)?void sf(dc(a.cacheIds),a.done):void("unload"in a?uf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){tf(a)}):tf(a))},Hf.unload=function(a,b){uf(Dc(a),function(){lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Hf.selected=function(a){return Gf.merge(rj.selectAll("."+g.shapes+od(a)).selectAll("."+g.shape).filter(function(){return Gf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Hf.select=function(a,b,c){Ug&&rj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Gf.select(this),i=e.data?e.data.id:e.id,j=Ne(this),k=Vg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);k&&l?Wg(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f)})},Hf.unselect=function(a,b){Ug&&rj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Gf.select(this),f=c.data?c.data.id:c.id,h=Ne(this),i=Vg||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);i&&j&&Wg(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Hf.toLine=function(a){Ff(a,"line")},Hf.toSpline=function(a){Ff(a,"spline")},Hf.toBar=function(a){Ff(a,"bar")},Hf.toScatter=function(a){Ff(a,"scatter")},Hf.toArea=function(a){Ff(a,"area")},Hf.toAreaSpline=function(a){Ff(a,"area-spline")},Hf.toPie=function(a){Ff(a,"pie",{withTransform:!0})},Hf.toDonut=function(a){Ff(a,"donut",{withTransform:!0})},Hf.groups=function(a){return c(a)?Kg:(Kg=a,lf(),Kg)},Hf.xgrids=function(a){return a?(Zh=a,lf(),Zh):Zh},Hf.xgrids.add=function(a){return a?Hf.xgrids(Zh.concat(a)):void 0},Hf.xgrids.remove=function(a){var b=Ef(a);return Hf.xgrids(Zh.filter(b))},Hf.ygrids=function(a){return a?(_h=a,lf(),_h):_h},Hf.ygrids.add=function(a){return a?Hf.ygrids(_h.concat(a)):void 0},Hf.ygrids.remove=function(a){var b=Ef(a);return Hf.ygrids(_h.filter(b))},Hf.regions=function(a){return c(a)?xi:(xi=a,lf(),xi)},Hf.regions.add=function(a){return c(a)?xi:(xi=xi.concat(a),lf(),xi)},Hf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;pj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),xi=xi.filter(function(b){return b.classes.indexOf(a)<0})}),xi},Hf.data.get=function(a){var b=Hf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Hf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Hf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ig[b]=a[b]}),lf({withLegend:!0}),Ig):Ig},Hf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Sg[b]=a[b]}),lf({withLegend:!0}),Sg):Sg},Hf.x=function(a){return arguments.length&&(qc(Hf.data.targets,a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Hf.data.xs},Hf.xs=function(a){return arguments.length&&(rc(Hf.data.targets,a),lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Hf.data.xs},Hf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){cb(b,a[b])}),Eb())},Hf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(zh=+a.x),b(a.y)&&(Gh=+a.y),b(a.y2)&&(Ph=+a.y2)):Gh=Ph=+a,lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Hf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Ah=+a.x),b(a.y)&&(Hh=+a.y),b(a.y2)&&(Qh=+a.y2)):Hh=Qh=+a,lf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Hf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Hf.axis.max(a.max),"undefined"!=typeof a.min&&Hf.axis.min(a.min))},Hf.legend.show=function(a){zf(Dc(a)),lf({withLegend:!0})},Hf.legend.hide=function(a){Af(Dc(a)),lf({withLegend:!0})},Hf.resize=function(a){Kf=a?a.width:null,Lf=a?a.height:null,qf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Hf.destroy=function(){Hf.data.targets=void 0,Hf.data.xs={},vj.html(""),a.onresize=null},"url"in f.data)Gf.xhr(f.data.url,function(a,b){var c,d=Gf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Gf.csv.parse(b.response),cf(c)});else if("rows"in f.data)cf(tc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");cf(uc(f.data.columns))}return Hf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window); \ No newline at end of file