diff --git a/c3.js b/c3.js index e6bb3e0..b924849 100644 --- a/c3.js +++ b/c3.js @@ -61,6 +61,7 @@ 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_', @@ -91,7 +92,7 @@ // Check next key's value isLast = (i === keys.length - 1); nextTarget = target[keys[i]]; - if ((!isLast && typeof nextTarget !== 'object') || (isLast && typeof defaultValue !== 'object' && typeof nextTarget === 'object' && nextTarget !== null)) { + if (!isLast && typeof nextTarget !== 'object') { return defaultValue; } target = nextTarget; @@ -105,7 +106,7 @@ var __size_width = getConfig(['size', 'width']), __size_height = getConfig(['size', 'height']); - var __padding_left = getConfig(['padding', 'left']), + var __padding_left = getConfig(['padding', 'left'], 50), __padding_right = getConfig(['padding', 'right']); var __zoom_enabled = getConfig(['zoom', 'enabled'], false), @@ -137,6 +138,7 @@ __data_regions = getConfig(['data', 'regions'], {}), __data_color = getConfig(['data', 'color']), __data_colors = getConfig(['data', 'colors'], {}), + __data_hide = getConfig(['data', 'hide'], false), __data_selection_enabled = getConfig(['data', 'selection', 'enabled'], false), __data_selection_grouped = getConfig(['data', 'selection', 'grouped'], false), __data_selection_isselectable = getConfig(['data', 'selection', 'isselectable'], function () { return true; }), @@ -215,11 +217,11 @@ // point - point of each data var __point_show = getConfig(['point', 'show'], true), - __point_r = __point_show ? getConfig(['point', 'r'], 2.5) : 0, + __point_r = getConfig(['point', 'r'], 2.5), __point_focus_line_enabled = getConfig(['point', 'focus', 'line', 'enabled'], true), __point_focus_expand_enabled = getConfig(['point', 'focus', 'expand', 'enabled'], true), - __point_focus_expand_r = getConfig(['point', 'focus', 'expand', 'r'], __point_focus_expand_enabled ? 4 : __point_r), - __point_select_r = getConfig(['point', 'focus', 'select', 'r'], 8); + __point_focus_expand_r = getConfig(['point', 'focus', 'expand', 'r']), + __point_select_r = getConfig(['point', 'focus', 'select', 'r']); var __line_connect_null = getConfig(['line', 'connect_null'], false); @@ -350,7 +352,6 @@ function transformMain(withTransition, transitions) { var xAxis, yAxis, y2Axis; - if (transitions && transitions.axisX) { xAxis = transitions.axisX; } else { @@ -369,7 +370,6 @@ y2Axis = main.select('.' + CLASS.axisY2); if (withTransition) { y2Axis = y2Axis.transition(); } } - main.attr("transform", translate.main); xAxis.attr("transform", translate.x); yAxis.attr("transform", translate.y); @@ -377,14 +377,18 @@ main.select('.' + CLASS.chartArcs).attr("transform", translate.arc); } function transformContext(withTransition, transitions) { - var duration = withTransition !== false ? 250 : 0, - subXAxis = (transitions && transitions.axisSubX) ? transitions.axisSubX : context.select('.' + CLASS.axisX).transition().duration(duration); + var subXAxis; + if (transitions && transitions.axisSubX) { + subXAxis = transitions.axisSubX; + } else { + subXAxis = context.select('.' + CLASS.axisX); + if (withTransition) { subXAxis = subXAxis.transition(); } + } context.attr("transform", translate.context); subXAxis.attr("transform", translate.subx); } function transformLegend(withTransition) { - var duration = withTransition !== false ? 250 : 0; - legend.transition().duration(duration).attr("transform", translate.legend); + (withTransition ? legend.transition() : legend).attr("transform", translate.legend); } function transformAll(withTransition, transitions) { transformMain(withTransition, transitions); @@ -876,17 +880,20 @@ } function updateAxisLabels() { main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel) + .transition() .attr("x", xForXAxisLabel) .attr("dx", dxForXAxisLabel) .attr("dy", dyForXAxisLabel) .text(textForXAxisLabel); main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel) + .transition() .attr("x", xForYAxisLabel) .attr("dx", dxForYAxisLabel) .attr("dy", dyForYAxisLabel) .attr("dy", dyForYAxisLabel) .text(textForYAxisLabel); main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label) + .transition() .attr("x", xForY2AxisLabel) .attr("dx", dxForY2AxisLabel) .attr("dy", dyForY2AxisLabel) @@ -1747,9 +1754,9 @@ return targetId || targetId === 0 ? '-' + (targetId.replace ? targetId.replace(/([^a-zA-Z0-9-_])/g, '-') : targetId) : ''; } function selectorTarget(id) { return '.' + CLASS.target + getTargetSelectorSuffix(id); } - function selectorTargets(ids) { return ids.map(function (id) { return selectorTarget(id); }); } + function selectorTargets(ids) { return ids.length ? ids.map(function (id) { return selectorTarget(id); }) : null; } function selectorLegend(id) { return '.' + CLASS.legendItem + getTargetSelectorSuffix(id); } - function selectorLegends(ids) { return ids.map(function (id) { return selectorLegend(id); }); } + function selectorLegends(ids) { return ids.length ? ids.map(function (id) { return selectorLegend(id); }) : null; } function initialOpacity(d) { return d.value !== null && withoutFadeIn[d.id] ? 1 : 0; @@ -1896,7 +1903,7 @@ return closest; } function filterSameX(targets, x) { - return d3.merge(targets.map(function (t) { return t.values; })).filter(function (v) { return v.x === x; }); + return d3.merge(targets.map(function (t) { return t.values; })).filter(function (v) { return v.x - x === 0; }); } function getPathBox(path) { @@ -2047,7 +2054,7 @@ }; } function getBarW(axis, barTargetsNum) { - return __bar_width ? __bar_width : barTargetsNum ? (axis.tickOffset() * 2 * __bar_width_ratio) / barTargetsNum : 0; + return typeof __bar_width === 'number' ? __bar_width : barTargetsNum ? (axis.tickOffset() * 2 * __bar_width_ratio) / barTargetsNum : 0; } //-- Type --// @@ -2237,9 +2244,9 @@ .attr("cx", __axis_rotated ? circleY : circleX) .attr("cy", __axis_rotated ? circleX : circleY) .attr("stroke", function () { return color(d); }) - .attr("r", __point_select_r * 1.4) + .attr("r", pointSelectR(d) * 1.4) .transition().duration(100) - .attr("r", __point_select_r); + .attr("r", pointSelectR); } function unselectPoint(target, d, i) { __data_onunselected(d, target.node()); @@ -2268,6 +2275,18 @@ return data.filter(function (d) { return isValue(d.value); }); } + //-- Point --// + + function pointR(d) { + return __point_show ? (typeof __point_r === 'function' ? __point_r(d) : __point_r) : 0; + } + function pointExpandedR(d) { + return __point_focus_expand_enabled ? (__point_focus_expand_r ? __point_focus_expand_r : pointR(d) * 1.75) : pointR(d); + } + function pointSelectR(d) { + return __point_select_r ? __point_select_r : pointR(d) * 4; + } + //-- Shape --// function getCircles(i, id) { @@ -2276,13 +2295,13 @@ function expandCircles(i, id) { getCircles(i, id) .classed(CLASS.EXPANDED, true) - .attr('r', __point_focus_expand_r); + .attr('r', pointExpandedR); } function unexpandCircles(i) { getCircles(i) .filter(function () { return d3.select(this).classed(CLASS.EXPANDED); }) .classed(CLASS.EXPANDED, false) - .attr('r', __point_r); + .attr('r', pointR); } function getBars(i) { return main.selectAll('.' + CLASS.bar + (isValue(i) ? '-' + i : '')); @@ -2546,6 +2565,11 @@ c3.data.xs = {}; c3.data.targets = convertDataToTargets(data); + // Set targets to hide if needed + if (__data_hide) { + addHiddenTargetIds(__data_hide === true ? mapToIds(c3.data.targets) : __data_hide); + } + // Init sizes and scales updateSizes(); updateScales(); @@ -2887,12 +2911,12 @@ .filter(function (d) { return __data_selection_isselectable(d); }) .each(function () { var _this = d3.select(this).classed(CLASS.EXPANDED, true); - if (this.nodeName === 'circle') { _this.attr('r', __point_focus_expand_r); } + if (this.nodeName === 'circle') { _this.attr('r', pointExpandedR); } svg.select('.' + CLASS.eventRect + '-' + i).style('cursor', null); }) - .filter(function () { + .filter(function (d) { if (this.nodeName === 'circle') { - return isWithinCircle(this, __point_select_r); + return isWithinCircle(this, pointSelectR(d)); } else if (this.nodeName === 'path') { return isWithinBar(this); @@ -2902,7 +2926,7 @@ var _this = d3.select(this); if (! _this.classed(CLASS.EXPANDED)) { _this.classed(CLASS.EXPANDED, true); - if (this.nodeName === 'circle') { _this.attr('r', __point_select_r); } + if (this.nodeName === 'circle') { _this.attr('r', pointSelectR); } } svg.select('.' + CLASS.eventRect + '-' + i).style('cursor', 'pointer'); }); @@ -3015,7 +3039,7 @@ isSelected = shape.classed(CLASS.SELECTED); var isWithin = false, toggle; if (target.nodeName === 'circle') { - isWithin = isWithinCircle(target, __point_select_r * 1.5); + isWithin = isWithinCircle(target, pointSelectR(d) * 1.5); toggle = togglePoint; } else if (target.nodeName === 'path') { @@ -3413,7 +3437,7 @@ mainCircle.enter().append("circle") .attr("class", classCircle) .style('opacity', 0) - .attr("r", __point_r); + .attr("r", pointR); mainCircle .style("opacity", initialOpacity) .transition().duration(duration) @@ -3674,6 +3698,7 @@ .attr('class', classChartText); mainTextEnter = mainTextUpdate.enter().append('g') .attr('class', classChartText) + .style('opacity', 0) .style("pointer-events", "none"); mainTextEnter.append('g') .attr('class', classTexts) @@ -3685,6 +3710,7 @@ .attr('class', classChartBar); mainBarEnter = mainBarUpdate.enter().append('g') .attr('class', classChartBar) + .style('opacity', 0) .style("pointer-events", "none"); // Bars for each data mainBarEnter.append('g') @@ -3699,6 +3725,7 @@ .attr('class', classChartLine); mainLineEnter = mainLineUpdate.enter().append('g') .attr('class', classChartLine) + .style('opacity', 0) .style("pointer-events", "none"); // Lines for each data mainLineEnter.append("path") @@ -3748,7 +3775,7 @@ callback = getArcOnMouseOver(); // transitions expandArc(updated.data.id); - focusLegend(updated.data.id); + toggleFocusLegend(updated.data.id, true); callback(arcData, i); }) .on('mousemove', function (d) { @@ -3789,6 +3816,7 @@ .data(targets) .attr('class', classChartBar); contextBarEnter = contextBarUpdate.enter().append('g') + .style('opacity', 0) .attr('class', classChartBar); // Bars for each data contextBarEnter.append('g') @@ -3800,6 +3828,7 @@ .data(targets) .attr('class', classChartLine); contextLineEnter = contextLineUpdate.enter().append('g') + .style('opacity', 0) .attr('class', classChartLine); // Lines for each data contextLineEnter.append("path") @@ -3812,7 +3841,7 @@ // Fade-in each chart svg.selectAll('.' + CLASS.target).filter(function (d) { return isTargetToShow(d.id); }) - .transition() + .transition().duration(__transition_duration) .style("opacity", 1); } @@ -3896,38 +3925,45 @@ /*-- Draw Legend --*/ - function opacityForLegend(id) { - return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 1; + function opacityForLegend(legendItem) { + return legendItem.classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 1; } - function opacityForUnfocusedLegend(id) { - return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 0.3; + function opacityForUnfocusedLegend(legendItem) { + return legendItem.classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 0.3; } function toggleFocusLegend(id, focus) { - var legendItem = legend.selectAll('.' + CLASS.legendItem), - isTarget = function (d) { return (!id || d === id); }, - notTarget = function (d) { return !isTarget(d); }; - legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? opacityForUnfocusedLegend : opacityForLegend); - legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : opacityForUnfocusedLegend); - } - function focusLegend(id) { - toggleFocusLegend(id, true); - } - function defocusLegend(id) { - toggleFocusLegend(id, false); + legend.selectAll('.' + CLASS.legendItem) + .transition().duration(100) + .style('opacity', function (_id) { + var This = d3.select(this); + if (id && _id !== id) { + return focus ? opacityForUnfocusedLegend(This) : opacityForLegend(This); + } else { + return focus ? opacityForLegend(This) : opacityForUnfocusedLegend(This); + } + }); } function revertLegend() { legend.selectAll('.' + CLASS.legendItem) .transition().duration(100) - .style('opacity', opacityForLegend); + .style('opacity', function () { return opacityForLegend(d3.select(this)); }); } function showLegend(targetIds) { + if (!__legend_show) { + __legend_show = true; + legend.style('visibility', 'visible'); + } removeHiddenLegendIds(targetIds); legend.selectAll(selectorLegends(targetIds)) .style('visibility', 'visible') .transition() - .style('opacity', opacityForLegend); + .style('opacity', function () { return opacityForLegend(d3.select(this)); }); } function hideLegend(targetIds) { + if (__legend_show && isEmpty(targetIds)) { + __legend_show = false; + legend.style('visibility', 'hidden'); + } addHiddenLegendIds(targetIds); legend.selectAll(selectorLegends(targetIds)) .style('opacity', 0) @@ -3938,12 +3974,12 @@ var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect; var paddingTop = 4, paddingRight = 26, maxWidth = 0, maxHeight = 0, posMin = 10; var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; - var withTransition, withTransitionForTransform, withTransformAll; + var withTransition, withTransitionForTransform; + var hasFocused = legend.selectAll('.' + CLASS.legendItemFocused).size(); options = options || {}; withTransition = isDefined(options.withTransition) ? options.withTransition : true; withTransitionForTransform = isDefined(options.withTransitionForTransform) ? options.withTransitionForTransform : true; - withTransformAll = isDefined(options.withTransformAll) ? options.withTransformAll : true; function updatePositions(textElement, id, reset) { var box = textElement.getBoundingClientRect(), @@ -4028,6 +4064,7 @@ typeof __legend_item_onclick === 'function' ? __legend_item_onclick(id) : c3.toggle(id); }) .on('mouseover', function (id) { + d3.select(this).classed(CLASS.legendItemFocused, true); if (!transiting) { c3.focus(id); } @@ -4036,6 +4073,7 @@ } }) .on('mouseout', function (id) { + d3.select(this).classed(CLASS.legendItemFocused, false); if (!transiting) { c3.revert(); } @@ -4085,6 +4123,19 @@ .attr('x', xForLegend) .attr('y', yForLegend); + // toggle legend state + legend.selectAll('.' + CLASS.legendItem) + .classed(CLASS.legendItemHidden, function (id) { return !isTargetToShow(id); }) + .transition() + .style('opacity', function (id) { + var This = d3.select(this); + if (isTargetToShow(id)) { + return !hasFocused || This.classed(CLASS.legendItemFocused) ? opacityForLegend(This) : opacityForUnfocusedLegend(This); + } else { + return legendOpacityForHidden; + } + }); + // Update all to reflect change of legend updateLegendItemWidth(maxWidth); updateLegendItemHeight(maxHeight); @@ -4094,9 +4145,7 @@ updateScales(); updateSvgSize(); // Update g positions - if (withTransformAll) { - transformAll(withTransitionForTransform, transitions); - } + transformAll(withTransitionForTransform, transitions); } /*-- Event Handling --*/ @@ -4133,7 +4182,7 @@ if (hasArcType(c3.data.targets)) { expandArc(targetId, true); } - focusLegend(targetId); + toggleFocusLegend(targetId, true); }; c3.defocus = function (targetId) { @@ -4149,7 +4198,7 @@ if (hasArcType(c3.data.targets)) { unexpandArc(targetId); } - defocusLegend(targetId); + toggleFocusLegend(targetId, false); }; c3.revert = function (targetId) { @@ -4178,11 +4227,6 @@ if (options.withLegend) { showLegend(targetIds); - } else { - legend.selectAll(selectorLegends(targetIds)) - .classed(CLASS.legendItemHidden, false) - .transition() - .style('opacity', 1); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); @@ -4199,11 +4243,6 @@ if (options.withLegend) { hideLegend(targetIds); - } else { - legend.selectAll(selectorLegends(targetIds)) - .classed(CLASS.legendItemHidden, true) - .transition() - .style('opacity', legendOpacityForHidden); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); @@ -4472,20 +4511,12 @@ }; c3.legend.show = function (targetIds) { - if (!__legend_show) { - __legend_show = true; - legend.style('visibility', 'visible'); - } showLegend(mapToTargetIds(targetIds)); redraw({withLegend: true}); }; c3.legend.hide = function (targetIds) { hideLegend(mapToTargetIds(targetIds)); redraw({withLegend: true}); - if (__legend_show && isEmpty(targetIds)) { - __legend_show = false; - legend.style('visibility', 'hidden'); - } }; c3.resize = function (size) { diff --git a/c3.min.js b/c3.min.js index 7f00d5b..eb29e4c 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g&&"end"in a?ig(yi?re(a.end):a.end):Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni: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+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); -return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"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}var e={version:"0.1.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?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||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){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=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),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?yh=b:"y2"===a?Hh=b:"x"===a&&(th=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",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"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?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/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(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.select("."+f.axisY2+" ."+f.axisY2Label).transition().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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.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 xf.max(Object.keys(i).map(function(a){return xf.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?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.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=vd(o,p),j=ac(kg.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&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.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 Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh: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||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?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?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[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)}),yf.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=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(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 Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.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++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),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&&yf.data.targets[0].values[a-1]?yf.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(yf.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(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(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)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 bh&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(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=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else xf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),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",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),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",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(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(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.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=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!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=Ti?u:t,void(ah?(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=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(g=function(a){return t*(.2+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*(.2+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=ij.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 Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,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=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"],{}),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"],{}),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi: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+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") +},yf.toPie=function(a){wf(a,"pie",{withTransform:!0})},yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/htdocs/samples/data_hide.html b/htdocs/samples/data_hide.html new file mode 100644 index 0000000..fb3469b --- /dev/null +++ b/htdocs/samples/data_hide.html @@ -0,0 +1,24 @@ + + + + + +
+ + + + + + diff --git a/htdocs/samples/point_r.html b/htdocs/samples/point_r.html new file mode 100644 index 0000000..46ee3ec --- /dev/null +++ b/htdocs/samples/point_r.html @@ -0,0 +1,28 @@ + + + + + +
+ + + + + +