From 95c960e8c290038eb9410b38d6cd53b0b87449a1 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 1 Apr 2014 20:10:38 +0900 Subject: [PATCH] Refactor class --- c3.js | 162 +++++++++++++++++++++++++++--------------------------- c3.min.js | 4 +- 2 files changed, 84 insertions(+), 82 deletions(-) diff --git a/c3.js b/c3.js index dc830c9..9ab0e78 100644 --- a/c3.js +++ b/c3.js @@ -3,6 +3,66 @@ var c3 = {}; + var CLASS = { + 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', + 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', + dragarea: 'c3-dragarea', + EXPANDED: '_expanded_', + SELECTED: '_selected_', + INCLUDED: '_included_', + }; + + c3.version = "0.1.24"; /* @@ -15,64 +75,6 @@ var c3 = { data : {} }, cache = {}; - var EXPANDED = '_expanded_', SELECTED = '_selected_', INCLUDED = '_included_'; - - var CLASS = { - 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', - 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', - dragarea: 'c3-dragarea', - }; - /*-- Handle Config --*/ function checkConfig(key, message) { @@ -1957,23 +1959,23 @@ } function expandCircles(i, id) { getCircles(i, id) - .classed(EXPANDED, true) + .classed(CLASS.EXPANDED, true) .attr('r', __point_focus_expand_r); } function unexpandCircles(i) { getCircles(i) - .filter(function () { return d3.select(this).classed(EXPANDED); }) - .classed(EXPANDED, false) + .filter(function () { return d3.select(this).classed(CLASS.EXPANDED); }) + .classed(CLASS.EXPANDED, false) .attr('r', __point_r); } function getBars(i) { return main.selectAll('.' + CLASS.bar + (isValue(i) ? '-' + i : '')); } function expandBars(i) { - getBars(i).classed(EXPANDED, true); + getBars(i).classed(CLASS.EXPANDED, true); } function unexpandBars(i) { - getBars(i).classed(EXPANDED, false); + getBars(i).classed(CLASS.EXPANDED, false); } // For main region @@ -2564,7 +2566,7 @@ main.selectAll('.' + CLASS.shape + '-' + i) .filter(function (d) { return __data_selection_isselectable(d); }) .each(function () { - var _this = d3.select(this).classed(EXPANDED, true); + var _this = d3.select(this).classed(CLASS.EXPANDED, true); if (this.nodeName === 'circle') { _this.attr('r', __point_focus_expand_r); } svg.select('.' + CLASS.eventRect + '-' + i).style('cursor', null); }) @@ -2578,8 +2580,8 @@ }) .each(function () { var _this = d3.select(this); - if (! _this.classed(EXPANDED)) { - _this.classed(EXPANDED, true); + if (! _this.classed(CLASS.EXPANDED)) { + _this.classed(CLASS.EXPANDED, true); if (this.nodeName === 'circle') { _this.attr('r', __point_select_r); } } svg.select('.' + CLASS.eventRect + '-' + i).style('cursor', 'pointer'); @@ -2676,7 +2678,7 @@ function toggleShape(target, d, i) { var shape = d3.select(target), - isSelected = shape.classed(SELECTED); + isSelected = shape.classed(CLASS.SELECTED); var isWithin = false, toggle; if (target.nodeName === 'circle') { isWithin = isWithinCircle(target, __point_select_r * 1.5); @@ -2691,10 +2693,10 @@ if (!__data_selection_multiple) { main.selectAll('.' + CLASS.shapes + (__data_selection_grouped ? getTargetSelectorSuffix(d.id) : "")).selectAll('.' + CLASS.shape).each(function (d, i) { var shape = d3.select(this); - if (shape.classed(SELECTED)) { toggle(false, shape.classed(SELECTED, false), d, i); } + if (shape.classed(CLASS.SELECTED)) { toggle(false, shape.classed(CLASS.SELECTED, false), d, i); } }); } - shape.classed(SELECTED, !isSelected); + shape.classed(CLASS.SELECTED, !isSelected); toggle(!isSelected, shape, d, i); } __data_onclick(d, target); @@ -2728,8 +2730,8 @@ .filter(function (d) { return __data_selection_isselectable(d); }) .each(function (d, i) { var _this = d3.select(this), - isSelected = _this.classed(SELECTED), - isIncluded = _this.classed(INCLUDED), + isSelected = _this.classed(CLASS.SELECTED), + isIncluded = _this.classed(CLASS.INCLUDED), _x, _y, _w, _h, toggle, isWithin = false, box; if (this.nodeName === 'circle') { _x = _this.attr("cx") * 1; @@ -2747,9 +2749,9 @@ isWithin = !(maxX < _x || _x + _w < minX) && !(maxY < _y || _y + _h < minY); } if (isWithin ^ isIncluded) { - _this.classed(INCLUDED, !isIncluded); + _this.classed(CLASS.INCLUDED, !isIncluded); // TODO: included/unincluded callback here - _this.classed(SELECTED, !isSelected); + _this.classed(CLASS.SELECTED, !isSelected); toggle(!isSelected, _this, d, i); } }); @@ -2774,7 +2776,7 @@ .style('opacity', 0) .remove(); main.selectAll('.' + CLASS.shape) - .classed(INCLUDED, false); + .classed(CLASS.INCLUDED, false); dragging = false; __data_ondragend(); } @@ -3739,7 +3741,7 @@ c3.selected = function (targetId) { return d3.merge( main.selectAll('.' + CLASS.shapes + getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS.shape) - .filter(function () { return d3.select(this).classed(SELECTED); }) + .filter(function () { return d3.select(this).classed(CLASS.SELECTED); }) .map(function (d) { return d.map(function (_d) { return _d.__data__; }); }) ); }; @@ -3752,14 +3754,14 @@ unselect = (this.nodeName === 'circle') ? unselectPoint : unselectBar, isTargetId = __data_selection_grouped || !ids || ids.indexOf(d.id) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0, - isSelected = shape.classed(SELECTED); + isSelected = shape.classed(CLASS.SELECTED); if (isTargetId && isTargetIndex) { if (__data_selection_isselectable(d) && !isSelected) { - select(shape.classed(SELECTED, true), d, i); + select(shape.classed(CLASS.SELECTED, true), d, i); } } else if (isDefined(resetOther) && resetOther) { if (isSelected) { - unselect(shape.classed(SELECTED, false), d, i); + unselect(shape.classed(CLASS.SELECTED, false), d, i); } } }); @@ -3772,11 +3774,11 @@ unselect = (this.nodeName === 'circle') ? unselectPoint : unselectBar, isTargetId = __data_selection_grouped || !ids || ids.indexOf(d.id) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0, - isSelected = shape.classed(SELECTED); + isSelected = shape.classed(CLASS.SELECTED); if (isTargetId && isTargetIndex) { if (__data_selection_isselectable(d)) { if (isSelected) { - unselect(shape.classed(SELECTED, false), d, i); + unselect(shape.classed(CLASS.SELECTED, false), d, i); } } } diff --git a/c3.min.js b/c3.min.js index da2eb66..40fe2d3 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,2 +1,2 @@ -!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={};e.version="0.1.24",e.generate=function(e){function f(a,b){if(!(a in e))throw Error(b)}function g(a,b){var c,d,f,g=e;for(c=0;cff&&(ff=0),0>hf&&(hf=0),df={top:qg?cf.top:lf-kg-(Ph?0:mf),right:0/0,bottom:20+(Ph?0:mf),left:qg?Th:cf.left},gf=qg?cf.left-Th-Uh:ff,jf=qg?hf:lf-df.top-df.bottom,0>gf&&(gf=0),0>jf&&(jf=0),ef={top:Ph?0:lf-mf,right:0/0,bottom:0,left:Ph?kf-nf:0},n(),Ph&&Cd(Ne.data.targets)&&(ef.left=ff/2+pf)}function n(){pf=hf/2,of=.95*pf,qf=Bd(Ne.data.targets)?.6*of:0}function o(){var a=qg?Se.axisX:Se.axisY,b=Me.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Me.select(Te).node().getBoundingClientRect(),e=c.right-d.left-r();return e>0?e:0}function p(){return Ue?Ue:v()}function q(){var a=Ve?Ve:w();return a>0?a:320}function r(){return Cd(Ne.data.targets)?0:We?We:qg||!Bg||Gg?1:t("y")}function s(){var a=1;return Cd(Ne.data.targets)?0:Xe?Xe:Ph?nf+(Kg&&!qg?t("y2"):a):Kg?Pg||qg?a:t("y2"):a}function t(a){var b=db(a);return b.isInner?20+wb(a):40+wb(a)}function u(a){return"y"!==a||Bg?"y2"!==a||Kg?(db(a).isInner?30:40)+("y2"===a?-10:0):Vh:mg&&!Ph?10:1}function v(){return+Me.select(Te).style("width").replace("px","")}function w(){return+Me.select(Te).style("height").replace("px","")}function x(a){return a?-5:-(cf.left-1)}function y(a){return a?-20:-1}function z(){return x(!qg)}function A(){return y(!qg)}function B(){return x(qg)}function C(){return y(qg)}function D(a){return a?ff+2+4:cf.left+20}function E(a){return a?80:hf+2}function F(){return D(!qg)}function G(){return E(!qg)}function H(){return D(qg)}function I(){return E(qg)}function J(){var a=qg?hf:ff,b=pc(),c=Rb()*(yd(Ne.data.targets)?(b-(Bh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function K(a){Qh=a}function L(a){Rh=a}function M(a){Sh=a}function N(){return mg?Ph?Rh*(Qh+1):kf:0}function O(){return mg?Ph?lf:Sh*(Qh+1):0}function P(){var a,b,c=!Df;vf=qg?1:0,wf=qg?hf:ff,xf=qg?0:hf,yf=qg?ff:1,zf=vf,Af=wf,Bf=qg?0:jf,Cf=qg?gf:1,Df=R(vf,wf,c?void 0:Df.domain(),function(){return Jf.tickOffset()}),Ef=S(xf,yf),Ff=S(xf,yf),Gf=R(vf,wf,gi,function(a){return a%1?0:Mf.tickOffset()}),Hf=S(Bf,Cf),If=S(Bf,Cf),a=Y(),b=Z(),Jf=V(Df,Kh,a,b),Mf=V(Gf,Nh,a,b),Kf=W(Ef,Lh,Hg,Jg),Lf=W(Ff,Mh,Qg,Sg),c||(Wh.scale(Gf),Ye&&$h.scale(Df)),Q()}function Q(){rf=zb(),sf=Ab(),tf=Ab(.98)}function R(a,b,e,f){var g=(Ah?Me.time.scale():Me.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Bh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function S(a,b){return Me.scale.linear().range([a,b])}function T(a){return"y2"===X(a)?Ff:Ef}function U(a){return"y2"===X(a)?If:Hf}function V(a,b,c,d){var e=(Bh?xb():Me.svg.axis()).scale(a).orient(b);return e.tickFormat(c).ticks(d),Bh?e.tickCentered(tg):e.tickOffset=function(){var a=qg?hf:ff;return a*Rb()/pc()/2},Bh&&e.categories(sg),e}function W(a,b,c,d){return Me.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function X(a){return a in Tf?Tf[a]:"y"}function Y(){var a=Ah?Ih:Bh?Cc:null;return ug&&("function"==typeof ug?a=ug:Ah&&(a=function(a){return Me.time.format(ug)(a)})),a}function Z(){var a=pc();return vg&&a>wg?wg:a}function $(a){return"string"==typeof a?a:a?a.text:null}function _(a,b){var c=a&&"object"==typeof a&&a.position?a.position:b;return{isInner:c.indexOf("inner")>=0,isOuter:c.indexOf("outer")>=0,isLeft:c.indexOf("left")>=0,isCenter:c.indexOf("center")>=0,isRight:c.indexOf("right")>=0,isTop:c.indexOf("top")>=0,isMiddle:c.indexOf("middle")>=0,isBottom:c.indexOf("bottom")>=0}}function ab(){return _(Ag,qg?"inner-top":"inner-right")}function bb(){return _(Fg,qg?"inner-right":"inner-top")}function cb(){return _(Og,qg?"inner-right":"inner-top")}function db(a){return"y2"===a?cb():"y"===a?bb():ab()}function eb(){return $(Ag)}function fb(){return $(Fg)}function gb(){return $(Og)}function hb(a,b){return a?b.isLeft?0:b.isCenter?ff/2:ff:b.isBottom?-hf:b.isMiddle?-hf/2:0}function ib(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function jb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function kb(){return hb(!qg,ab())}function lb(){return hb(qg,bb())}function mb(){return hb(qg,cb())}function nb(){return ib(!qg,ab())}function ob(){return ib(qg,bb())}function pb(){return ib(qg,cb())}function qb(){var a=ab();return qg?a.isInner?"1.2em":-30-wb("x"):a.isInner?"-0.5em":"3em"}function rb(){var a=bb();return qg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-wb("y")}function sb(){var a=cb();return qg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+wb("y2")}function tb(){return jb(!qg,ab())}function ub(){return jb(qg,bb())}function vb(){return jb(qg,cb())}function wb(a){var b=0,c="x"===a?Se.axisX:"y"===a?Se.axisY:Se.axisY2;return Me.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function xb(){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,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Ac(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 Me.min(Object.keys(i).map(function(a){return Me.min(i[a])}))}function Pb(a){var b,c,d,e,f,g,h=rc(a),i=yc(a);if(Sf.length>0)for(g=Bc(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 Me.max(Object.keys(i).map(function(a){return Me.max(i[a])}))}function Qb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return X(a.id)===c}),m="y2"===c?Mg:Dg,n="y2"===c?Lg:Cg,o=b(m)?m:Ob(l),p=b(n)?n:Pb(l),q="y2"===c?Ng:Eg,r=Xc()&&qg;return 0===l.length?"y2"===c?Ff.domain():Ef.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),"y"===c&&Ig&&(f=b(Ig.top)?Ig.top:e,g=b(Ig.bottom)?Ig.bottom:e),"y2"===c&&Rg&&(f=b(Rg.top)?Rg.top:e,g=b(Rg.bottom)?Rg.bottom:e),r&&(i=Yc(o,p),j=Wb(Ef.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]))),yd(l)&&!Ac(l)&&(g=o),[o-g,p+f])}function Rb(a){var b=Wb(gi),c=Wb(Df.domain());return a||0===c?1:b/c}function Sb(a){return yg?yg:Me.min(a,function(a){return Me.min(a.values,function(a){return a.x})})}function Tb(a){return xg?xg:Me.max(a,function(a){return Me.max(a.values,function(a){return a.x})})}function Ub(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Bh?d=0:yd(a)?(c=pc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Vb(a){var b=[Sb(a),Tb(a)],c=b[0],d=b[1],e=Ub(a,b),f=Ah?new Date(c.getTime()-e):c-e,g=Ah?new Date(d.getTime()+e):d+e;return[f,g]}function Wb(a){return a[1]-a[0]}function Xb(a){for(var b=0;bd?0:d}function ac(a){return Nf&&a===Nf||Sd(Of)&&Td(Of,a)}function bc(a){return!ac(a)}function cc(a){return Nf?Nf:Sd(Of)?Of[a]:null}function dc(a,b){return a in Ne.data.x&&Ne.data.x[a]&&Ne.data.x[a][b]?Ne.data.x[a][b]:b}function ec(a){Object.keys(a).forEach(function(b){Of[b]=a[b]})}function fc(a){var b;return a&&(b=Rf[a.id],a.name=b?b:a.id),a}function gc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=ic(b[d],a.id,d)}),Ne.data.x[a.id]=b})}function hc(a,b){a.forEach(function(a){b[a.id]&&gc([a],b[a.id])})}function ic(a,b,c){var d;return d=Ah?a?a instanceof Date?a:Od(a):Od(dc(b,c)):Ch&&!Bh?a?+a:dc(b,c):c}function jc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(Ne.data.x[b]=a.map(function(a){return a[c]})):Ne.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!Ne.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Qf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=cc(b),g=a[f],h=ic(g,b,e);return Ch&&Bh&&0===c&&g&&(0===e&&(sg=[]),sg.push(g)),"undefined"==typeof a[b]&&(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})}}),b.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++})}),Uf&&wd(rc(b).filter(function(a){return!(a in Vf)}),Uf),b.forEach(function(a){Yb(a.id_org,a)}),b}function mc(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 nc(a){return a>0&&Ne.data.targets[0].values[a-1]?Ne.data.targets[0].values[a-1].x:void 0}function oc(a){return a1?Ne.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Ne.data.targets[0]:null,a}function rc(a){return a=c(a)?Ne.data.targets:a,a.map(function(a){return a.id})}function sc(a){var b,c=rc();for(b=0;ba})}function Bc(a){return zc(a,function(a){return a>0})}function Cc(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&&(e=e.concat(dd(a,f))),a[g].x&&(e=e.concat(dd(a,g))),gd(e,b)):ed(a,b,f,g)}function fd(a,b){var c;return c=a.map(function(a){return ed(a.values,b)}),gd(c,b)}function gd(a,b){var c,d;return a.forEach(function(a){var e=Ud(a,b);(c>e||!c)&&(c=e,d=a)}),d}function hd(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 id(){return Xf&&"desc"===Xf.toLowerCase()}function jd(){return Xf&&"asc"===Xf.toLowerCase()}function kd(a){var b=jd(),c=id();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 Xf&&a.sort(Xf),a}function ld(a,c){var d,e,f,g,h,i,j,k=Cd(Ne.data.targets),l=k?cd:bd,m=a.filter(function(a){return a&&b(a.value)});rh&&0!==m.length&&(ei.html(uh(a,Y(),l,Hh)).style("display","block"),d=ei.property("offsetWidth"),e=ei.property("offsetHeight"),k?(g=ff/2+c[0],i=hf/2+c[1]+20):(qg?(f=o(),g=f+c[0]+100,h=g+d,j=p()-s(),i=Df(m[0].x)+20):(f=o(),g=f+r()+Df(m[0].x)+20,h=g+d,j=f+p()-s(),i=c[1]+15),h>j&&(g-=d+60),i+e>q()&&(i-=e+30)),ei.style("top",i+"px").style("left",g+"px"))}function md(){ei.style("display","none")}function nd(a){var c=a.filter(function(a){return a&&b(a.value)});rh&&(zd(Ne.data.targets)||Cd(Ne.data.targets)||bi.selectAll("line."+Se.xgridFocus).style("visibility","visible").data([c[0]]).attr(qg?"y1":"x1",Zc).attr(qg?"y2":"x2",Zc))}function od(){bi.select("line."+Se.xgridFocus).style("visibility","hidden")}function pd(a){return a.x||0===a.x?Df(a.x):null}function qd(a){return T(a.id)(a.value)}function rd(){var a,b,d={},e=0;return vc(tc(Fd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function vd(a,b){return dh?dh:b?2*a.tickOffset()*eh/b:0}function wd(a,b){var d=c(a)?rc():a;"string"==typeof d&&(d=[d]);for(var e=0;e0}function Td(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ud(a,b){return Math.pow(Df(a.x)-b[0],2)+Math.pow(Ef(a.value)-b[1],2)}function Vd(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Wd(a,b,c){fg(b,a.node()),bi.select("."+Se.selectedCircles+Rc(b.id)).selectAll("."+Se.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Dc(Se.selectedCircle,c)}).attr("cx",qg?qd:pd).attr("cy",qg?pd:qd).attr("stroke",function(){return Hh(b.id)}).attr("r",1.4*ch).transition().duration(100).attr("r",ch)}function Xd(a,b,c){gg(b,a.node()),bi.select("."+Se.selectedCircles+Rc(b.id)).selectAll("."+Se.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Yd(a,b,c,d){a?Wd(b,c,d):Xd(b,c,d)}function Zd(a,b){fg(b,a.node()),a.transition().duration(100).style("fill",function(){return Me.rgb(Hh(b.id)).darker(1)})}function $d(a,b){gg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hh(b.id)})}function _d(a,b,c,d){a?Zd(b,c,d):$d(b,c,d)}function ae(a){return a.filter(function(a){return b(a.value)})}function be(a,c){return(c?bi.selectAll("."+Se.circles+Rc(c)):bi).selectAll("."+Se.circle+(b(a)?"-"+a:""))}function ce(a,b){be(a,b).classed(Pe,!0).attr("r",bh)}function de(a){be(a).filter(function(){return Me.select(this).classed(Pe)}).classed(Pe,!1).attr("r",$g)}function ee(a){return bi.selectAll("."+Se.bar+(b(a)?"-"+a:""))}function fe(a){ee(a).classed(Pe,!0)}function ge(a){ee(a).classed(Pe,!1)}function he(a,b){var c=le(a,b);return function(a,b){var d=c(a,b),e=qg?1:0,f=qg?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 ie(a,b){var c=le(a,!1),d=b?je:ke;return function(a,b){return d(c(a,b),a,this)}}function je(a,b){var c;return qg?(c=Fd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ke(a,b,c){var d=c.getBBox();return qg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Fd(b)?-3:-6)}function le(a,b){var c=a.__max__+1,d=vd(Jf,c),e=sd(d,c,a,!!b),f=td(!!b),g=ud(a,!!b),h=b?U:T;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return qg&&(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 me(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 ne(b){var c,d,e;if(fi=Me.select(Te),fi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(fi.html(""),fi.classed("c3",!0),Ne.data.x={},Ne.data.targets=lc(b),m(),P(),Df.domain(Me.extent(Vb(Ne.data.targets))),Ef.domain(Qb(Ne.data.targets,"y")),Ff.domain(Qb(Ne.data.targets,"y2")),Gf.domain(Df.domain()),Hf.domain(Ef.domain()),If.domain(Ff.domain()),gi=Df.domain(),Wh.scale(Gf),Ye&&$h.scale(Df),_h=fi.append("svg").attr("width",ff+cf.left+cf.right).attr("height",hf+cf.top+cf.bottom).on("mouseenter",_e).on("mouseleave",af),ai=_h.append("defs"),ai.append("clipPath").attr("id",yh).append("rect").attr("width",ff).attr("height",hf),ai.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",z).attr("y",A).attr("width",F).attr("height",G),ai.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),bi=_h.append("g").attr("transform",Oh.main),ci=jg?_h.append("g").attr("transform",Oh.context):null,di=mg?_h.append("g").attr("transform",Oh.legend):null,ei=Me.select(Te).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),bi.append("g").attr("class",Se.axisX).attr("clip-path",qg?"":h("xaxis-clip")).attr("transform",Oh.x).append("text").attr("class",Se.axisXLabel).attr("transform",qg?"rotate(-90)":"").attr("dx",nb).attr("dy",qb).style("text-anchor",tb).text(eb),Bg&&bi.append("g").attr("class",Se.axisY).attr("clip-path",qg?h("yaxis-clip"):"").append("text").attr("class",Se.axisYLabel).attr("transform",qg?"":"rotate(-90)").attr("dx",ob).attr("dy",rb).style("text-anchor",ub).text(fb),Kg&&bi.append("g").attr("class",Se.axisY2).attr("transform",Oh.y2).append("text").attr("class",Se.axisY2Label).attr("transform",qg?"":"rotate(-90)").attr("dx",pb).style("text-anchor",vb).text(gb),d=bi.append("g").attr("clip-path",zh).attr("class",Se.grid),Tg&&d.append("g").attr("class",Se.xgrids),Sd(Vg)&&d.append("g").attr("class",Se.xgridLines),_g&&d.append("g").attr("class",Se.xgridFocus).append("line").attr("class",Se.xgridFocus).attr("x1",qg?0:-10).attr("x2",qg?ff:-10).attr("y1",qg?-10:cf.top).attr("y2",qg?-10:hf),Wg&&d.append("g").attr("class",Se.ygrids),Sd(Xg)&&d.append("g").attr("class",Se.ygridLines),bi.append("g").attr("clip-path",zh).attr("class",Se.regions),bi.append("g").attr("clip-path",zh).attr("class",Se.chart),c=bi.select("."+Se.chart).append("g").attr("class",Se.eventRects).style("fill-opacity",0).style("cursor",Ye?qg?"ns-resize":"ew-resize":null),bi.select("."+Se.chart).append("g").attr("class",Se.chartBars),bi.select("."+Se.chart).append("g").attr("class",Se.chartLines),bi.select("."+Se.chart).append("g").attr("class",Se.chartArcs).attr("transform",Oh.arc).append("text").attr("class",Se.chartArcsTitle).style("text-anchor","middle").text(Kb()),bi.select("."+Se.chart).append("g").attr("class",Se.chartTexts),Ye&&bi.insert("rect",$e?null:"g."+Se.grid).attr("class",Se.zoomRect).attr("width",ff).attr("height",hf).style("opacity",0).style("cursor",qg?"ns-resize":"ew-resize").call($h).on("dblclick.zoom",null),zg&&Wh.extent("function"!=typeof zg?zg:zg(Vb())),jg&&(ci.append("g").attr("clip-path",zh).attr("class",Se.chart),ci.select("."+Se.chart).append("g").attr("class",Se.chartBars),ci.select("."+Se.chart).append("g").attr("class",Se.chartLines),ci.append("g").attr("clip-path",zh).attr("class",Se.brush).call(Wh).selectAll("rect").attr(qg?"width":"height",qg?gf:jf),ci.append("g").attr("class",Se.axisX).attr("transform",Oh.subx).attr("clip-path",qg?"":h("xaxis-clip"))),Ae(Ne.data.targets),qg?bi.select("."+Se.axisX).style("opacity",0).call(Jf):(bi.select("."+Se.axisY).style("opacity",0).call(Kf),bi.select("."+Se.axisY2).style("opacity",0).call(Lf)),ze({withTransform:!0,withLegend:!0,durationForAxis:0}),vh){if(Ah&&"string"==typeof wh){for(wh=Od(wh),e=0;e0){d=[];for(var f in Rf)for(c=0;cf&&g>c&&d>h&&i>d):"path"===this.nodeName&&(l=hd(this),c=l.x,d=l.y,e=l.width,j=l.height,k=_d,p=!(c>g||f>c+e||d>i||h>d+j)),p^o&&(m.classed(Re,!o),m.classed(Qe,!n),k(!n,m,a,b))}))}function se(a){Cd(Ne.data.targets)||$f&&(Dh=a,bi.select("."+Se.chart).append("rect").attr("class",Se.dragarea).style("opacity",.1),Eh=!0,hg())}function te(){Cd(Ne.data.targets)||$f&&(bi.select("."+Se.dragarea).transition().duration(100).style("opacity",0).remove(),bi.selectAll("."+Se.shape).classed(Re,!1),Eh=!1,ig())}function ue(a){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H=rd(),I=Cd(Ne.data.targets),K=vc(Ne.data.targets);if(0!==K.length){if(a=d(a)?a:{},t=d(a.withY)?a.withY:!0,u=d(a.withSubchart)?a.withSubchart:!0,v=d(a.withTransition)?a.withTransition:!0,w=d(a.withTransform)?a.withTransform:!1,x=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,y=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,z=d(a.withLegend)?a.withLegend:!1,E=v?bf:0,F=d(a.durationForExit)?a.durationForExit:E,G=d(a.durationForAxis)?a.durationForAxis:E,z&&mg&&Ie(Ne.data.targets,a),y&&(Df.domain(Me.extent(Vb(K))),gi=Df.domain(),Ye&&$h.scale(Df).updateScaleExtent(),Gf.domain(Df.domain()),Wh.scale(Gf)),x&&(Df.domain(Wh.empty()?gi:Wh.extent()),Ye&&$h.scale(Df).updateScaleExtent()),Ef.domain(Qb(K,"y")),Ff.domain(Qb(K,"y2")),bi.select("."+Se.axisX).style("opacity",I?0:1).transition().duration(G).call(Jf),bi.select("."+Se.axisY).style("opacity",I?0:1).transition().duration(G).call(Kf),bi.select("."+Se.axisY2).style("opacity",I?0:1).transition().duration(G).call(Lf),A=he(H),C=ie(H,!0),D=ie(H,!1),bi.select("."+Se.axisX+" ."+Se.axisXLabel).attr("x",kb),bi.select("."+Se.axisY+" ."+Se.axisYLabel).attr("x",lb).attr("dy",rb),bi.select("."+Se.axisY2+" ."+Se.axisY2Label).attr("x",mb).attr("dy",sb),Hf.domain(Ef.domain()),If.domain(Ff.domain()),ei.style("display","none"),bi.select("line."+Se.xgridFocus).style("visibility","hidden"),Tg){if("year"===Ug){e=[];for(var L=Vb(),M=L[0].getFullYear(),N=L[1].getFullYear(),O=M;N>=O;O++)e.push(new Date(O+"-01-01 00:00:00"))}else e=Df.ticks(10);c=bi.select("."+Se.xgrids).selectAll("."+Se.xgrid).data(e),c.enter().append("line").attr("class",Se.xgrid),c.attr("x1",qg?0:function(a){return Df(a)-Jf.tickOffset()}).attr("x2",qg?ff:function(a){return Df(a)-Jf.tickOffset()}).attr("y1",qg?function(a){return Df(a)-Jf.tickOffset()}:cf.top).attr("y2",qg?function(a){return Df(a)-Jf.tickOffset()}:hf).style("opacity",function(){return+Me.select(this).attr(qg?"y1":"x1")===(qg?hf:0)?0:1}),c.exit().remove()}Sd(Vg)&&(f=bi.select("."+Se.xgridLines).selectAll("."+Se.xgridLine).data(Vg),g=f.enter().append("g").attr("class",function(a){return Se.xgridLine+(a.class?a.class:"")}),g.append("line").style("opacity",0),g.append("text").attr("text-anchor","end").attr("transform",qg?"":"rotate(-90)").attr("dx",qg?0:-cf.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(E).attr("x1",qg?0:$c).attr("x2",qg?ff:$c).attr("y1",qg?$c:cf.top).attr("y2",qg?$c:hf).style("opacity",1),f.select("text").transition().duration(E).attr("x",qg?ff:0).attr("y",$c).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(E).style("opacity",0).remove()),t&&Wg&&(h=bi.select("."+Se.ygrids).selectAll("."+Se.ygrid).data(Ef.ticks(Yg)),h.enter().append("line").attr("class",Se.ygrid),h.attr("x1",qg?Ef:0).attr("x2",qg?Ef:ff).attr("y1",qg?0:Ef).attr("y2",qg?hf:Ef),h.exit().remove()),t&&Sd(Xg)&&(i=bi.select("."+Se.ygridLines).selectAll("."+Se.ygridLine).data(Xg),j=i.enter().append("g").attr("class",function(a){return Se.ygridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",qg?"rotate(-90)":"").attr("dx",qg?0:-cf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(E).attr("x1",qg?_c:0).attr("x2",qg?_c:ff).attr("y1",qg?0:_c).attr("y2",qg?hf:_c).style("opacity",1),i.select("text").transition().duration(E).attr("x",qg?0:ff).attr("y",_c).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(E).style("opacity",0).remove()),l=bi.selectAll("."+Se.bars).selectAll("."+Se.bar).data(Kd),l.enter().append("path").attr("d",A).style("stroke","none").style("opacity",0).style("fill",function(a){return Hh(a.id)}).attr("class",Lc),l.style("opacity",Tc).transition().duration(E).attr("d",A).style("opacity",1),l.exit().transition().duration(F).style("opacity",0).remove(),n=bi.selectAll("."+Se.texts).selectAll("."+Se.text).data(Md),n.enter().append("text").attr("class",Ec).attr("text-anchor",function(a){return qg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),n.text(function(a){return bd(a.value)}).style("fill-opacity",Uc).transition().duration(E).attr("x",C).attr("y",D).style("fill-opacity",Wc),n.exit().transition().duration(F).style("fill-opacity",0).remove(),bi.selectAll("."+Se.line).style("opacity",Tc).transition().duration(E).attr("d",Xh).style("opacity",1),bi.selectAll("."+Se.area).style("opacity",0).transition().duration(E).attr("d",Yh).style("opacity",hi),k=bi.selectAll("."+Se.circles).selectAll("."+Se.circle).data(Ld),k.enter().append("circle").attr("class",Jc).style("opacity",0).attr("r",$g),k.style("opacity",Tc).transition().duration(E).style("opacity",Vc).attr("cx",qg?qd:pd).attr("cy",qg?pd:qd),k.exit().remove(),bi.selectAll("."+Se.chartArc).select("."+Se.arc).attr("transform",w?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(E).attrTween("d",function(a){var b,c=yb(a);return c?(b=Me.interpolate(this._current,c),this._current=b(0),function(a){return Bb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",w?"scale(1)":"").style("opacity",1),bi.selectAll("."+Se.chartArc).select("text").attr("transform",Cb).style("opacity",0).transition().duration(E).text(Fb).style("opacity",function(a){return uc(a.data.id)&&Jd(a.data)?1:0}),bi.select("."+Se.chartArcsTitle).style("opacity",Bd(Ne.data.targets)?1:0),jg&&(null!==Me.event&&"zoom"===Me.event.type&&Wh.extent(Df.orgDomain()).update(),u&&(ci.select("."+Se.axisX).style("opacity",I?0:1).transition().duration(E).call(Mf),Wh.empty()||Wh.extent(Df.orgDomain()).update(),B=he(H,!0),o=ci.selectAll("."+Se.bars).selectAll("."+Se.bar).data(Kd),o.enter().append("path").attr("d",B).style("stroke","none").style("fill",function(a){return Hh(a.id)}).attr("class",Lc),o.style("opacity",Tc).transition().duration(E).attr("d",B).style("opacity",1),o.exit().transition().duration(E).style("opacity",0).remove(),ci.selectAll("."+Se.line).style("opacity",Tc).transition().duration(E).attr("d",Zh).style("opacity",1))),bi.selectAll("."+Se.selectedCircles).filter(function(a){return Fd(a)}).selectAll("circle").remove(),bi.selectAll("."+Se.selectedCircle).transition().duration(E).attr("cx",qg?qd:pd).attr("cy",qg?pd:qd),Sd(Of)?(p=bi.select("."+Se.eventRects).selectAll("."+Se.eventRect).data([0]),pe(p.enter()),p.attr("x",0).attr("y",0).attr("width",ff).attr("height",hf)):(Ch&&!Bh?(s=function(a,b){var c=nc(b),d=oc(b),e=Ne.data.x[a.id][b];return(Df(d?d:e+50)-Df(c?c:e-50))/2},r=function(a,b){var c=nc(b),d=Ne.data.x[a.id][b];return(Df(d)+Df(c?c:d-50))/2}):(s=J(),r=function(a){return Df(a.x)-s/2}),q=qc(),bi.select("."+Se.eventRects).datum(q?q.values:[]),p=bi.select("."+Se.eventRects).selectAll("."+Se.eventRect).data(function(a){return a}),oe(p.enter()),p.attr("class",Qc).attr("x",qg?0:r).attr("y",qg?r:0).attr("width",qg?ff:s).attr("height",qg?s:hf),p.exit().remove()),m=bi.select("."+Se.regions).selectAll("rect."+Se.region).data(qh),m.enter().append("rect").style("fill-opacity",0),m.attr("class",Pc).attr("x",qg?0:$b).attr("y",qg?$b:cf.top).attr("width",qg?ff:_b).attr("height",qg?_b:hf).transition().duration(E).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),m.exit().transition().duration(E).style("fill-opacity",0).remove(),rc().forEach(function(a){ii[a]=!0})}}function ve(){ue({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function we(){return"mousemove"===Me.event.sourceEvent.type&&$h.altDomain?(Df.domain($h.altDomain),void $h.scale(Df).updateScaleExtent()):(Bh&&Df.orgDomain()[0]===gi[0]&&Df.domain([gi[0]-1e-10,Df.orgDomain()[1]]),ue({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Me.event.sourceEvent.type&&(Fh=!0)))}function xe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ye(){_h.attr("width",kf).attr("height",lf),_h.select("#"+yh).select("rect").attr("width",ff).attr("height",hf),_h.select("#xaxis-clip").select("rect").attr("width",F),_h.select("#yaxis-clip").select("rect").attr("width",H),_h.select("."+Se.zoomRect).attr("width",ff).attr("height",hf)}function ze(a){a=d(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.durationForExit=0,m(),P(),ye(),l(a.withTransition),ue(a)}function Ae(a){var b,c,d,e,f,g,h,i,j,k,l,m;h=bi.select("."+Se.chartTexts).selectAll("."+Se.chartText).data(a),i=h.enter().append("g").attr("class",function(a){return Se.chartText+Dc(Se.target,a.id)}).style("pointer-events","none"),i.append("g").attr("class",Fc).style("fill",function(a){return Hh(a.id)}),e=bi.select("."+Se.chartBars).selectAll("."+Se.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return Se.chartBar+Dc(Se.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Mc).style("fill",function(a){return Hh(a.id)}).style("stroke","none").style("cursor",function(a){return ag(a)?"pointer":null}),c=bi.select("."+Se.chartLines).selectAll("."+Se.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return Se.chartLine+Dc(Se.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Ic).style("opacity",0).style("stroke",function(a){return Hh(a.id)}),b.append("path").attr("class",Oc).style("opacity",function(){return hi=+Me.select(this).style("opacity"),0}).style("fill",function(a){return Hh(a.id)}),b.append("g").attr("class",function(a){return Dc(Se.selectedCircles,a.id)}),b.append("g").attr("class",Kc).style("fill",function(a){return Hh(a.id)}).style("cursor",function(a){return ag(a)?"pointer":null}),a.forEach(function(a){bi.selectAll("."+Se.selectedCircles+Rc(a.id)).selectAll("."+Se.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),g=bi.select("."+Se.chartArcs).selectAll("."+Se.chartArc).data(uf(a)),f=g.enter().append("g").attr("class",function(a){return Se.chartArc+Dc(Se.target,a.data.id)}),f.append("path").attr("class",Nc).style("opacity",0).style("fill",function(a){return Hh(a.data.id)}).style("cursor",function(a){return ag(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=yb(a),d=Eb(c),e=Mb();Gb(c.data.id),Fe(c.data.id),e(d,b)}).on("mousemove",function(a){var b=yb(a),c=[Eb(b)];ld(c,Me.mouse(this))}).on("mouseout",function(a,b){var c=yb(a),d=Eb(c),e=Nb();Hb(c.data.id),He(),md(),e(d,b)}).on("click",function(a,b){var c=yb(a),d=Eb(c),e=Lb();e(d,b)}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jg&&(m=ci.select("."+Se.chartBars).selectAll("."+Se.chartBar).data(a),l=m.enter().append("g").attr("class",function(a){return Se.chartBar+Dc(Se.target,a.id)}),l.append("g").attr("class",Mc).style("fill",function(a){return Hh(a.id)}),k=ci.select("."+Se.chartLines).selectAll("."+Se.chartLine).data(a),j=k.enter().append("g").attr("class",function(a){return Se.chartLine+Dc(Se.target,a.id)}),j.append("path").attr("class",Ic).style("opacity",0).style("stroke",function(a){return Hh(a.id)})),_h.selectAll("."+Se.target).filter(function(a){return uc(a.id)}).transition().style("opacity",1)}function Be(a,b){Ne.data.targets.forEach(function(b){for(var c=0;ce&&(e=(k-j)/2,v=0,B++)),A[a]=B,z[B]=e,w[a]=v,v+=j}var e,f,g=a.getBBox(),h=10*Math.ceil((g.width+r)/10),i=10*Math.ceil((g.height+q)/10),j=Ph?i:h,k=Ph?mf:nf;c&&(v=0,B=0,s=0,t=0),x[b]=h,y[b]=i,(!s||h>=s)&&(s=h),(!t||i>=t)&&(t=i),f=Ph?t:s,pg?(Object.keys(x).forEach(function(a){x[a]=s}),Object.keys(y).forEach(function(a){y[a]=t}),e=(k-f*p.length)/2,u>e?(v=0,B=0,p.forEach(function(a){d(a)})):d(b,!0)):d(b)}var f,g,h,i,j,k,n,o,p=rc(a),q=4,r=26,s=0,t=0,u=10,v=0,w={},x={},y={},z={},A={},B=0;b=c(b)?{}:b,o=d(b.withTransition)?b.withTransition:!0,Ph?(g=function(a){return s*(.2+A[a])},j=function(a){return z[A[a]]+w[a]}):(g=function(a){return z[A[a]]+w[a]},j=function(a){return t*(.2+A[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},n=function(a,b){return j(a,b)-7},f=di.selectAll("."+Se.legendItem).data(p).enter().append("g").attr("class",function(a){return Dc(Se.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof og?og(a):Ne.toggle(a)}).on("mouseover",function(a){Ne.focus(a)}).on("mouseout",function(){Ne.revert()}),f.append("text").text(function(a){return d(Rf[a])?Rf[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ph?h:-200).attr("y",Ph?-200:k),f.append("rect").attr("class",Se.legendItemEvent).style("fill-opacity",0).attr("x",Ph?i:-200).attr("y",Ph?-200:n).attr("width",function(a){return x[a]}).attr("height",function(a){return y[a]}),f.append("rect").attr("class",Se.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hh(a)}).attr("x",Ph?h:-200).attr("y",Ph?-200:j).attr("width",10).attr("height",10),di.selectAll("text").data(p).text(function(a){return d(Rf[a])?Rf[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(o?250:0).attr("x",h).attr("y",k),di.selectAll("rect."+Se.legendItemEvent).data(p).transition().duration(o?250:0).attr("x",i).attr("y",n),di.selectAll("rect."+Se.legendItemTile).data(p).transition().duration(o?250:0).attr("x",g).attr("y",j),L(s),M(t),K(B),m(),P(),ye(),l(!1)}function Je(a){return sc(a.id)}function Ke(a){return"data"in a&&sc(a.data.id)}function Le(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}}var Me=a.d3?a.d3:a.require?a.require("d3"):void 0,Ne={data:{}},Oe={},Pe="_expanded_",Qe="_selected_",Re="_included_",Se={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",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",dragarea:"c3-dragarea"},Te=g(["bindto"],"#chart"),Ue=g(["size","width"]),Ve=g(["size","height"]),We=g(["padding","left"]),Xe=g(["padding","right"]),Ye=g(["zoom","enabled"],!1),Ze=g(["zoom","extent"]),$e=g(["zoom","privileged"],!1),_e=g(["onenter"],function(){}),af=g(["onleave"],function(){}),bf=g(["transition","duration"],350);f("data","data is required in config");var cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf,rf,sf,tf,uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf=g(["data","x"]),Of=g(["data","xs"],{}),Pf=g(["data","x_format"],"%Y-%m-%d"),Qf=g(["data","id_converter"],function(a){return a}),Rf=g(["data","names"],{}),Sf=g(["data","groups"],[]),Tf=g(["data","axes"],{}),Uf=g(["data","type"]),Vf=g(["data","types"],{}),Wf=g(["data","labels"],{}),Xf=g(["data","order"]),Yf=g(["data","regions"],{}),Zf=g(["data","colors"],{}),$f=g(["data","selection","enabled"],!1),_f=g(["data","selection","grouped"],!1),ag=g(["data","selection","isselectable"],function(){return!0}),bg=g(["data","selection","multiple"],!0),cg=g(["data","onclick"],function(){}),dg=g(["data","onenter"],function(){}),eg=g(["data","onleave"],function(){}),fg=g(["data","onselected"],function(){}),gg=g(["data","onunselected"],function(){}),hg=g(["data","ondragstart"],function(){}),ig=g(["data","ondragend"],function(){}),jg=g(["subchart","show"],!1),kg=jg?g(["subchart","size","height"],60):0,lg=g(["color","pattern"],[]),mg=g(["legend","show"],!0),ng=g(["legend","position"],"bottom"),og=g(["legend","item","onclick"]),pg=g(["legend","equally"],!1),qg=g(["axis","rotated"],!1),rg=g(["axis","x","type"],"indexed"),sg=g(["axis","x","categories"],[]),tg=g(["axis","x","tick","centered"],!1),ug=g(["axis","x","tick","format"]),vg=g(["axis","x","tick","culling"],"categorized"===rg?!1:!0),wg=g(["axis","x","tick","count"],10),xg=g(["axis","x","max"]),yg=g(["axis","x","min"]),zg=g(["axis","x","default"]),Ag=g(["axis","x","label"],{}),Bg=g(["axis","y","show"],!0),Cg=g(["axis","y","max"]),Dg=g(["axis","y","min"]),Eg=g(["axis","y","center"]),Fg=g(["axis","y","label"],{}),Gg=g(["axis","y","inner"],!1),Hg=g(["axis","y","tick","format"]),Ig=g(["axis","y","padding"]),Jg=g(["axis","y","ticks"],10),Kg=g(["axis","y2","show"],!1),Lg=g(["axis","y2","max"]),Mg=g(["axis","y2","min"]),Ng=g(["axis","y2","center"]),Og=g(["axis","y2","label"]),Pg=g(["axis","y2","inner"],!1),Qg=g(["axis","y2","tick","format"]),Rg=g(["axis","y2","padding"]),Sg=g(["axis","y2","ticks"],10),Tg=g(["grid","x","show"],!1),Ug=g(["grid","x","type"],"tick"),Vg=g(["grid","x","lines"],[]),Wg=g(["grid","y","show"],!1),Xg=g(["grid","y","lines"],[]),Yg=g(["grid","y","ticks"],10),Zg=g(["point","show"],!0),$g=Zg?g(["point","r"],2.5):0,_g=g(["point","focus","line","enabled"],!0),ah=g(["point","focus","expand","enabled"],!0),bh=g(["point","focus","expand","r"],ah?4:$g),ch=g(["point","focus","select","r"],8),dh=g(["bar","width"]),eh=g(["bar","width","ratio"],.6),fh=g(["pie","label","show"],!0),gh=g(["pie","label","format"]),hh=g(["pie","onclick"],function(){}),ih=g(["pie","onmouseover"],function(){}),jh=g(["pie","onmouseout"],function(){}),kh=g(["donut","label","show"],!0),lh=g(["donut","label","format"]),mh=g(["donut","title"],""),nh=g(["donut","onclick"],function(){}),oh=g(["donut","onmouseover"],function(){}),ph=g(["donut","onmouseout"],function(){}),qh=g(["regions"],[]),rh=g(["tooltip","show"],!0),sh=g(["tooltip","format","title"]),th=g(["tooltip","format","value"]),uh=g(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=sh?sh:b,k=th?th:c;for(f=0;f"+(g||0===g?""+g+"":"")),i=a[f].name,h=k(a[f].value,a[f].ratio),e+="",e+=""+i+"",e+=""+h+"",e+="");return e+""}),vh=g(["tooltip","init","show"],!1),wh=g(["tooltip","init","x"],0),xh=g(["tooltip","init","position"],{top:"0px",left:"50px"}),yh=("string"==typeof Te?Te.replace("#",""):Te.id)+"-clip",zh=h(yh),Ah="timeseries"===rg,Bh="categorized"===rg,Ch=!Ah&&(Nf||Sd(Of)),Dh=null,Eh=!1,Fh=!1,Gh=!1,Hh=Nd(Zf,lg),Ih=function(){var a=[[Me.time.format("%Y/%-m/%-d"),function(){return!0}],[Me.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Me.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Me.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Me.time.format("%I %p"),function(a){return a.getHours()}],[Me.time.format("%I:%M"),function(a){return a.getMinutes()}],[Me.time.format(":%S"),function(a){return a.getSeconds()}],[Me.time.format(".%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)}}(),Jh=[],Kh=qg?"left":"bottom",Lh=qg?Gg?"top":"bottom":Gg?"right":"left",Mh=qg?Pg?"bottom":"top":Pg?"left":"right",Nh=qg?"left":"bottom",Oh={main:function(){return"translate("+cf.left+","+cf.top+")"},context:function(){return"translate("+df.left+","+df.top+")"},legend:function(){return"translate("+ef.left+","+ef.top+")"},x:function(){return"translate(0,"+(qg?0:hf)+")"},y:function(){return"translate(0,"+(qg?hf:0)+")"},y2:function(){return"translate("+(qg?0:ff)+","+(qg?1:0)+")"},subx:function(){return"translate(0,"+(qg?0:jf)+")"},arc:function(){return"translate("+ff/2+","+hf/2+")"}},Ph="right"===ng,Qh=0,Rh=0,Sh=0,Th=30,Uh=30,Vh=5;uf=Me.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Wh,Xh=function(){var a=Me.svg.line().x(qg?function(a){return T(a.id)(a.value)}:Zc).y(qg?Zc:function(a){return T(a.id)(a.value)});return function(b){var c,d,e=ae(b.values);return Dd(b)?(a.interpolate(Ed(b)?"cardinal":"linear"),Yf[b.id]?me(e,Df,T(b.id),Yf[b.id]):a(e)):(c=Df(e[0].x),d=T(b.id)(e[0].value),qg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yh=function(){var a;return a=qg?Me.svg.area().x0(function(a){return T(a.id)(0)}).x1(function(a){return T(a.id)(a.value)}).y(Zc):Me.svg.area().x(Zc).y0(function(a){return T(a.id)(0)}).y1(function(a){return T(a.id)(a.value)}),function(b){var c,d,e=ae(b.values);return xd([b],"area")||xd([b],"area-spline")?(a.interpolate(Ed(b)?"cardinal":"linear"),a(e)):(c=Df(e[0].x),d=T(b.id)(e[0].value),qg?"M "+d+" "+c:"M "+c+" "+d)}}(),Zh=function(){var a=Me.svg.line().x(qg?function(a){return U(a.id)(a.value)}:ad).y(qg?ad:function(a){return U(a.id)(a.value)});return function(b){var c=ae(b.values);return Dd(b)?a(c):"M "+Gf(c[0].x)+" "+U(b.id)(c[0].value)}}(),$h=function(){};Wh=Me.svg.brush().on("brush",ve),Wh.update=function(){return ci&&ci.select("."+Se.brush).call(this),this},Wh.scale=function(a){return qg?this.y(a):this.x(a)},Ye&&($h=Me.behavior.zoom().on("zoomstart",function(){$h.altDomain=Me.event.sourceEvent.altKey?Df.orgDomain():null}).on("zoom",Ye?we:null),$h.scale=function(a){return qg?this.y(a):this.x(a)},$h.orgScaleExtent=function(){var a=Ze?Ze:[1,10];return[a[0],Math.max(pc()/a[1],a[1])]},$h.updateScaleExtent=function(){var a=Wb(Df.orgDomain())/Wb(gi),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var _h,ai,bi,ci,di,ei,fi,gi,hi,ii={};if(Ne.focus=function(a){function b(a){vc(a).transition().duration(100).style("opacity",1)}var c=_h.selectAll(Sc(a)),d=c.filter(Je),e=c.filter(Ke);Ne.revert(),Ne.defocus(),b(d.classed(Se.focused,!0)),b(e),Cd(Ne.data.targets)&&Gb(a,!0),Fe(a)},Ne.defocus=function(a){function b(a){vc(a).transition().duration(100).style("opacity",.3)}var c=_h.selectAll(Sc(a)),d=c.filter(Je),e=c.filter(Ke);Ne.revert(),b(d.classed(Se.focused,!1)),b(e),Cd(Ne.data.targets)&&Hb(a),Ge(a)},Ne.revert=function(a){function b(a){vc(a).transition().duration(100).style("opacity",1)}var c=_h.selectAll(Sc(a)),d=c.filter(Je),e=c.filter(Ke);b(d.classed(Se.focused,!1)),b(e),Cd(Ne.data.targets)&&Hb(a),He()},Ne.show=function(a){xc(a),_h.selectAll(Sc(a)).transition().style("opacity",1),ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Ne.hide=function(a){wc(a),_h.selectAll(Sc(a)).transition().style("opacity",0),ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Ne.toggle=function(a){uc(a)?Ne.hide(a):Ne.show(a)},Ne.unzoom=function(){Wh.clear().update(),ue({withUpdateXDomain:!0})},Ne.load=function(a){return a.xs&&ec(a.xs),"categories"in a&&Bh&&(sg=a.categories,Jf.categories(sg)),"cacheIds"in a&&Xb(a.cacheIds)?void Be(Zb(a.cacheIds),a.done):void("unload"in a?De(a.unload?"string"==typeof a.unload?[a.unload]:a.unload:[],function(){Ce(a)}):Ce(a))},Ne.unload=function(a){De(a?"string"==typeof a?[a]:a:rc(),function(){ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},Ne.selected=function(a){return Me.merge(bi.selectAll("."+Se.shapes+Rc(a)).selectAll("."+Se.shape).filter(function(){return Me.select(this).classed(Qe)}).map(function(a){return a.map(function(a){return a.__data__})}))},Ne.select=function(a,b,c){$f&&bi.selectAll("."+Se.shapes).selectAll("."+Se.shape).each(function(e,f){var g=Me.select(this),h="circle"===this.nodeName?Wd:Zd,i="circle"===this.nodeName?Xd:$d,j=_f||!a||a.indexOf(e.id)>=0,k=!b||b.indexOf(f)>=0,l=g.classed(Qe);j&&k?ag(e)&&!l&&h(g.classed(Qe,!0),e,f):d(c)&&c&&l&&i(g.classed(Qe,!1),e,f)})},Ne.unselect=function(a,b){$f&&bi.selectAll("."+Se.shapes).selectAll("."+Se.shape).each(function(c,d){var e=Me.select(this),f="circle"===this.nodeName?Xd:$d,g=_f||!a||a.indexOf(c.id)>=0,h=!b||b.indexOf(d)>=0,i=e.classed(Qe);g&&h&&ag(c)&&i&&f(e.classed(Qe,!1),c,d)})},Ne.toLine=function(a){wd(a,"line"),ze()},Ne.toSpline=function(a){wd(a,"spline"),ze()},Ne.toBar=function(a){wd(a,"bar"),ze()},Ne.toScatter=function(a){wd(a,"scatter"),ze()},Ne.toArea=function(a){wd(a,"area"),ze()},Ne.toAreaSpline=function(a){wd(a,"area-spline"),ze()},Ne.toPie=function(a){wd(a,"pie"),ze({withTransform:!0})},Ne.toDonut=function(a){wd(a,"donut"),ze({withTransform:!0})},Ne.groups=function(a){return c(a)?Sf:(Sf=a,ue(),Sf)},Ne.xgrids=function(a){return a?(Vg=a,ue(),Vg):Vg},Ne.xgrids.add=function(a){return a?Ne.xgrids(Vg.concat(a)):void 0},Ne.xgrids.remove=function(a){var b=Le(a);return Ne.xgrids(Vg.filter(b))},Ne.ygrids=function(a){return a?(Xg=a,ue(),Xg):Xg},Ne.ygrids.add=function(a){return a?Ne.ygrids(Xg.concat(a)):void 0},Ne.ygrids.remove=function(a){var b=Le(a);return Ne.ygrids(Xg.filter(b))},Ne.regions=function(a){return c(a)?qh:(qh=a,ue(),qh)},Ne.regions.add=function(a){return c(a)?qh:(qh=qh.concat(a),ue(),qh)},Ne.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;_h.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),qh=qh.filter(function(b){return b.classes.indexOf(a)<0})}),qh},Ne.data.get=function(a){var b=Ne.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ne.data.getAsTarget=function(a){var b=tc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ne.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Rf[b]=a[b]}),Ie(Ne.data.targets,{withTransition:!0}),Rf):Rf},Ne.x=function(a){return arguments.length&&(gc(Ne.data.targets,a),ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ne.data.x},Ne.xs=function(a){return arguments.length&&(hc(Ne.data.targets,a),ue({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ne.data.x},Ne.resize=function(a){Ue=a?a.width:null,Ve=a?a.height:null,ze({withLegend:!0,withTransition:!1})},Ne.destroy=function(){Ne.data.targets=void 0,Ne.data.x={},fi.html(""),a.onresize=null},"url"in e.data)Me.csv(e.data.url,function(a,b){ne(b)});else if("rows"in e.data)ne(jc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");ne(kc(e.data.columns))}return Ne},"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={},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",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",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.version="0.1.24",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;ccf&&(cf=0),0>ef&&(ef=0),af={top:ng?_e.top:hf-hg-(Mh?0:jf),right:0/0,bottom:20+(Mh?0:jf),left:ng?Qh:_e.left},df=ng?_e.left-Qh-Rh:cf,ff=ng?ef:hf-af.top-af.bottom,0>df&&(df=0),0>ff&&(ff=0),bf={top:Mh?0:hf-jf,right:0/0,bottom:0,left:Mh?gf-kf:0},o(),Mh&&Dd(Oe.data.targets)&&(bf.left=cf/2+mf)}function o(){mf=ef/2,lf=.95*mf,nf=Cd(Oe.data.targets)?.6*lf:0}function p(){var a=ng?f.axisX:f.axisY,b=Ne.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ne.select(Qe).node().getBoundingClientRect(),e=c.right-d.left-s();return e>0?e:0}function q(){return Re?Re:w()}function r(){var a=Se?Se:x();return a>0?a:320}function s(){return Dd(Oe.data.targets)?0:Te?Te:ng||!yg||Dg?1:u("y")}function t(){var a=1;return Dd(Oe.data.targets)?0:Ue?Ue:Mh?kf+(Hg&&!ng?u("y2"):a):Hg?Mg||ng?a:u("y2"):a}function u(a){var b=eb(a);return b.isInner?20+xb(a):40+xb(a)}function v(a){return"y"!==a||yg?"y2"!==a||Hg?(eb(a).isInner?30:40)+("y2"===a?-10:0):Sh:jg&&!Mh?10:1}function w(){return+Ne.select(Qe).style("width").replace("px","")}function x(){return+Ne.select(Qe).style("height").replace("px","")}function y(a){return a?-5:-(_e.left-1)}function z(a){return a?-20:-1}function A(){return y(!ng)}function B(){return z(!ng)}function C(){return y(ng)}function D(){return z(ng)}function E(a){return a?cf+2+4:_e.left+20}function F(a){return a?80:ef+2}function G(){return E(!ng)}function H(){return F(!ng)}function I(){return E(ng)}function J(){return F(ng)}function K(){var a=ng?ef:cf,b=qc(),c=Sb()*(zd(Oe.data.targets)?(b-(yh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function L(a){Nh=a}function M(a){Oh=a}function N(a){Ph=a}function O(){return jg?Mh?Oh*(Nh+1):gf:0}function P(){return jg?Mh?hf:Ph*(Nh+1):0}function Q(){var a,b,c=!Af;sf=ng?1:0,tf=ng?ef:cf,uf=ng?0:ef,vf=ng?cf:1,wf=sf,xf=tf,yf=ng?0:ff,zf=ng?df:1,Af=S(sf,tf,c?void 0:Af.domain(),function(){return Gf.tickOffset()}),Bf=T(uf,vf),Cf=T(uf,vf),Df=S(sf,tf,di,function(a){return a%1?0:Jf.tickOffset()}),Ef=T(yf,zf),Ff=T(yf,zf),a=Z(),b=$(),Gf=W(Af,Hh,a,b),Jf=W(Df,Kh,a,b),Hf=X(Bf,Ih,Eg,Gg),If=X(Cf,Jh,Ng,Pg),c||(Th.scale(Df),Ve&&Xh.scale(Af)),R()}function R(){of=Ab(),pf=Bb(),qf=Bb(.98)}function S(a,b,e,f){var g=(xh?Ne.time.scale():Ne.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),yh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function T(a,b){return Ne.scale.linear().range([a,b])}function U(a){return"y2"===Y(a)?Cf:Bf}function V(a){return"y2"===Y(a)?Ff:Ef}function W(a,b,c,d){var e=(yh?yb():Ne.svg.axis()).scale(a).orient(b);return e.tickFormat(c).ticks(d),yh?e.tickCentered(qg):e.tickOffset=function(){var a=ng?ef:cf;return a*Sb()/qc()/2},yh&&e.categories(pg),e}function X(a,b,c,d){return Ne.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Y(a){return a in Qf?Qf[a]:"y"}function Z(){var a=xh?Fh:yh?Dc:null;return rg&&("function"==typeof rg?a=rg:xh&&(a=function(a){return Ne.time.format(rg)(a)})),a}function $(){var a=qc();return sg&&a>tg?tg:a}function _(a){return"string"==typeof a?a:a?a.text:null}function ab(a,b){var c=a&&"object"==typeof a&&a.position?a.position:b;return{isInner:c.indexOf("inner")>=0,isOuter:c.indexOf("outer")>=0,isLeft:c.indexOf("left")>=0,isCenter:c.indexOf("center")>=0,isRight:c.indexOf("right")>=0,isTop:c.indexOf("top")>=0,isMiddle:c.indexOf("middle")>=0,isBottom:c.indexOf("bottom")>=0}}function bb(){return ab(xg,ng?"inner-top":"inner-right")}function cb(){return ab(Cg,ng?"inner-right":"inner-top")}function db(){return ab(Lg,ng?"inner-right":"inner-top")}function eb(a){return"y2"===a?db():"y"===a?cb():bb()}function fb(){return _(xg)}function gb(){return _(Cg)}function hb(){return _(Lg)}function ib(a,b){return a?b.isLeft?0:b.isCenter?cf/2:cf:b.isBottom?-ef:b.isMiddle?-ef/2:0}function jb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function kb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function lb(){return ib(!ng,bb())}function mb(){return ib(ng,cb())}function nb(){return ib(ng,db())}function ob(){return jb(!ng,bb())}function pb(){return jb(ng,cb())}function qb(){return jb(ng,db())}function rb(){var a=bb();return ng?a.isInner?"1.2em":-30-xb("x"):a.isInner?"-0.5em":"3em"}function sb(){var a=cb();return ng?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-xb("y")}function tb(){var a=db();return ng?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+xb("y2")}function ub(){return kb(!ng,bb())}function vb(){return kb(ng,cb())}function wb(){return kb(ng,db())}function xb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ne.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function yb(){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,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Bc(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 Ne.min(Object.keys(i).map(function(a){return Ne.min(i[a])}))}function Qb(a){var b,c,d,e,f,g,h=sc(a),i=zc(a);if(Pf.length>0)for(g=Cc(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 Ne.max(Object.keys(i).map(function(a){return Ne.max(i[a])}))}function Rb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Y(a.id)===c}),m="y2"===c?Jg:Ag,n="y2"===c?Ig:zg,o=b(m)?m:Pb(l),p=b(n)?n:Qb(l),q="y2"===c?Kg:Bg,r=Yc()&&ng;return 0===l.length?"y2"===c?Cf.domain():Bf.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),"y"===c&&Fg&&(f=b(Fg.top)?Fg.top:e,g=b(Fg.bottom)?Fg.bottom:e),"y2"===c&&Og&&(f=b(Og.top)?Og.top:e,g=b(Og.bottom)?Og.bottom:e),r&&(i=Zc(o,p),j=Xb(Bf.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]))),zd(l)&&!Bc(l)&&(g=o),[o-g,p+f])}function Sb(a){var b=Xb(di),c=Xb(Af.domain());return a||0===c?1:b/c}function Tb(a){return vg?vg:Ne.min(a,function(a){return Ne.min(a.values,function(a){return a.x})})}function Ub(a){return ug?ug:Ne.max(a,function(a){return Ne.max(a.values,function(a){return a.x})})}function Vb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return yh?d=0:zd(a)?(c=qc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Wb(a){var b=[Tb(a),Ub(a)],c=b[0],d=b[1],e=Vb(a,b),f=xh?new Date(c.getTime()-e):c-e,g=xh?new Date(d.getTime()+e):d+e;return[f,g]}function Xb(a){return a[1]-a[0]}function Yb(a){for(var b=0;bd?0:d}function bc(a){return Kf&&a===Kf||Td(Lf)&&Ud(Lf,a)}function cc(a){return!bc(a)}function dc(a){return Kf?Kf:Td(Lf)?Lf[a]:null}function ec(a,b){return a in Oe.data.x&&Oe.data.x[a]&&Oe.data.x[a][b]?Oe.data.x[a][b]:b}function fc(a){Object.keys(a).forEach(function(b){Lf[b]=a[b]})}function gc(a){var b;return a&&(b=Of[a.id],a.name=b?b:a.id),a}function hc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=jc(b[d],a.id,d)}),Oe.data.x[a.id]=b})}function ic(a,b){a.forEach(function(a){b[a.id]&&hc([a],b[a.id])})}function jc(a,b,c){var d;return d=xh?a?a instanceof Date?a:Pd(a):Pd(ec(b,c)):zh&&!yh?a?+a:ec(b,c):c}function kc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(Oe.data.x[b]=a.map(function(a){return a[c]})):Oe.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!Oe.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=Nf(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=dc(b),g=a[f],h=jc(g,b,e);return zh&&yh&&0===c&&g&&(0===e&&(pg=[]),pg.push(g)),"undefined"==typeof a[b]&&(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})}}),b.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++})}),Rf&&xd(sc(b).filter(function(a){return!(a in Sf)}),Rf),b.forEach(function(a){Zb(a.id_org,a)}),b}function nc(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 oc(a){return a>0&&Oe.data.targets[0].values[a-1]?Oe.data.targets[0].values[a-1].x:void 0}function pc(a){return a1?Oe.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Oe.data.targets[0]:null,a}function sc(a){return a=c(a)?Oe.data.targets:a,a.map(function(a){return a.id})}function tc(a){var b,c=sc();for(b=0;ba})}function Cc(a){return Ac(a,function(a){return a>0})}function Dc(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&&(e=e.concat(ed(a,f))),a[g].x&&(e=e.concat(ed(a,g))),hd(e,b)):fd(a,b,f,g)}function gd(a,b){var c;return c=a.map(function(a){return fd(a.values,b)}),hd(c,b)}function hd(a,b){var c,d;return a.forEach(function(a){var e=Vd(a,b);(c>e||!c)&&(c=e,d=a)}),d}function id(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 jd(){return Uf&&"desc"===Uf.toLowerCase()}function kd(){return Uf&&"asc"===Uf.toLowerCase()}function ld(a){var b=kd(),c=jd();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 Uf&&a.sort(Uf),a}function md(a,c){var d,e,f,g,h,i,j,k=Dd(Oe.data.targets),l=k?dd:cd,m=a.filter(function(a){return a&&b(a.value)});oh&&0!==m.length&&(bi.html(rh(a,Z(),l,Eh)).style("display","block"),d=bi.property("offsetWidth"),e=bi.property("offsetHeight"),k?(g=cf/2+c[0],i=ef/2+c[1]+20):(ng?(f=p(),g=f+c[0]+100,h=g+d,j=q()-t(),i=Af(m[0].x)+20):(f=p(),g=f+s()+Af(m[0].x)+20,h=g+d,j=f+q()-t(),i=c[1]+15),h>j&&(g-=d+60),i+e>r()&&(i-=e+30)),bi.style("top",i+"px").style("left",g+"px"))}function nd(){bi.style("display","none")}function od(a){var c=a.filter(function(a){return a&&b(a.value)});oh&&(Ad(Oe.data.targets)||Dd(Oe.data.targets)||$h.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ng?"y1":"x1",$c).attr(ng?"y2":"x2",$c))}function pd(){$h.select("line."+f.xgridFocus).style("visibility","hidden")}function qd(a){return a.x||0===a.x?Af(a.x):null}function rd(a){return U(a.id)(a.value)}function sd(){var a,b,d={},e=0;return wc(uc(Gd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function wd(a,b){return ah?ah:b?2*a.tickOffset()*bh/b:0}function xd(a,b){var d=c(a)?sc():a;"string"==typeof d&&(d=[d]);for(var e=0;e0}function Ud(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Vd(a,b){return Math.pow(Af(a.x)-b[0],2)+Math.pow(Bf(a.value)-b[1],2)}function Wd(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Xd(a,b,c){cg(b,a.node()),$h.select("."+f.selectedCircles+Sc(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Ec(f.selectedCircle,c)}).attr("cx",ng?rd:qd).attr("cy",ng?qd:rd).attr("stroke",function(){return Eh(b.id)}).attr("r",1.4*_g).transition().duration(100).attr("r",_g)}function Yd(a,b,c){dg(b,a.node()),$h.select("."+f.selectedCircles+Sc(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Zd(a,b,c,d){a?Xd(b,c,d):Yd(b,c,d)}function $d(a,b){cg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ne.rgb(Eh(b.id)).darker(1)})}function _d(a,b){dg(b,a.node()),a.transition().duration(100).style("fill",function(){return Eh(b.id)})}function ae(a,b,c,d){a?$d(b,c,d):_d(b,c,d)}function be(a){return a.filter(function(a){return b(a.value)})}function ce(a,c){return(c?$h.selectAll("."+f.circles+Sc(c)):$h).selectAll("."+f.circle+(b(a)?"-"+a:""))}function de(a,b){ce(a,b).classed(f.EXPANDED,!0).attr("r",$g)}function ee(a){ce(a).filter(function(){return Ne.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Xg)}function fe(a){return $h.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ge(a){fe(a).classed(f.EXPANDED,!0)}function he(a){fe(a).classed(f.EXPANDED,!1)}function ie(a,b){var c=me(a,b);return function(a,b){var d=c(a,b),e=ng?1:0,f=ng?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 je(a,b){var c=me(a,!1),d=b?ke:le;return function(a,b){return d(c(a,b),a,this)}}function ke(a,b){var c;return ng?(c=Gd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function le(a,b,c){var d=c.getBBox();return ng?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Gd(b)?-3:-6)}function me(a,b){var c=a.__max__+1,d=wd(Gf,c),e=td(d,c,a,!!b),f=ud(!!b),g=vd(a,!!b),h=b?V:U;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ng&&(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 ne(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 oe(b){var c,d,e;if(ci=Ne.select(Qe),ci.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ci.html(""),ci.classed("c3",!0),Oe.data.x={},Oe.data.targets=mc(b),n(),Q(),Af.domain(Ne.extent(Wb(Oe.data.targets))),Bf.domain(Rb(Oe.data.targets,"y")),Cf.domain(Rb(Oe.data.targets,"y2")),Df.domain(Af.domain()),Ef.domain(Bf.domain()),Ff.domain(Cf.domain()),di=Af.domain(),Th.scale(Df),Ve&&Xh.scale(Af),Yh=ci.append("svg").attr("width",cf+_e.left+_e.right).attr("height",ef+_e.top+_e.bottom).on("mouseenter",Ye).on("mouseleave",Ze),Zh=Yh.append("defs"),Zh.append("clipPath").attr("id",vh).append("rect").attr("width",cf).attr("height",ef),Zh.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",A).attr("y",B).attr("width",G).attr("height",H),Zh.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",C).attr("y",D).attr("width",I).attr("height",J),$h=Yh.append("g").attr("transform",Lh.main),_h=gg?Yh.append("g").attr("transform",Lh.context):null,ai=jg?Yh.append("g").attr("transform",Lh.legend):null,bi=Ne.select(Qe).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),$h.append("g").attr("class",f.axisX).attr("clip-path",ng?"":i("xaxis-clip")).attr("transform",Lh.x).append("text").attr("class",f.axisXLabel).attr("transform",ng?"rotate(-90)":"").attr("dx",ob).attr("dy",rb).style("text-anchor",ub).text(fb),yg&&$h.append("g").attr("class",f.axisY).attr("clip-path",ng?i("yaxis-clip"):"").append("text").attr("class",f.axisYLabel).attr("transform",ng?"":"rotate(-90)").attr("dx",pb).attr("dy",sb).style("text-anchor",vb).text(gb),Hg&&$h.append("g").attr("class",f.axisY2).attr("transform",Lh.y2).append("text").attr("class",f.axisY2Label).attr("transform",ng?"":"rotate(-90)").attr("dx",qb).style("text-anchor",wb).text(hb),d=$h.append("g").attr("clip-path",wh).attr("class",f.grid),Qg&&d.append("g").attr("class",f.xgrids),Td(Sg)&&d.append("g").attr("class",f.xgridLines),Yg&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus).attr("x1",ng?0:-10).attr("x2",ng?cf:-10).attr("y1",ng?-10:_e.top).attr("y2",ng?-10:ef),Tg&&d.append("g").attr("class",f.ygrids),Td(Ug)&&d.append("g").attr("class",f.ygridLines),$h.append("g").attr("clip-path",wh).attr("class",f.regions),$h.append("g").attr("clip-path",wh).attr("class",f.chart),c=$h.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ve?ng?"ns-resize":"ew-resize":null),$h.select("."+f.chart).append("g").attr("class",f.chartBars),$h.select("."+f.chart).append("g").attr("class",f.chartLines),$h.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Lh.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Lb()),$h.select("."+f.chart).append("g").attr("class",f.chartTexts),Ve&&$h.insert("rect",Xe?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",cf).attr("height",ef).style("opacity",0).style("cursor",ng?"ns-resize":"ew-resize").call(Xh).on("dblclick.zoom",null),wg&&Th.extent("function"!=typeof wg?wg:wg(Wb())),gg&&(_h.append("g").attr("clip-path",wh).attr("class",f.chart),_h.select("."+f.chart).append("g").attr("class",f.chartBars),_h.select("."+f.chart).append("g").attr("class",f.chartLines),_h.append("g").attr("clip-path",wh).attr("class",f.brush).call(Th).selectAll("rect").attr(ng?"width":"height",ng?df:ff),_h.append("g").attr("class",f.axisX).attr("transform",Lh.subx).attr("clip-path",ng?"":i("xaxis-clip"))),Be(Oe.data.targets),ng?$h.select("."+f.axisX).style("opacity",0).call(Gf):($h.select("."+f.axisY).style("opacity",0).call(Hf),$h.select("."+f.axisY2).style("opacity",0).call(If)),Ae({withTransform:!0,withLegend:!0,durationForAxis:0}),sh){if(xh&&"string"==typeof th){for(th=Pd(th),e=0;e0){d=[];for(var g in Of)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=ae,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 te(a){Dd(Oe.data.targets)||Xf&&(Ah=a,$h.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Bh=!0,eg())}function ue(){Dd(Oe.data.targets)||Xf&&($h.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),$h.selectAll("."+f.shape).classed(f.INCLUDED,!1),Bh=!1,fg())}function ve(a){var c,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=sd(),J=Dd(Oe.data.targets),L=wc(Oe.data.targets);if(0!==L.length){if(a=d(a)?a:{},u=d(a.withY)?a.withY:!0,v=d(a.withSubchart)?a.withSubchart:!0,w=d(a.withTransition)?a.withTransition:!0,x=d(a.withTransform)?a.withTransform:!1,y=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,z=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,A=d(a.withLegend)?a.withLegend:!1,F=w?$e:0,G=d(a.durationForExit)?a.durationForExit:F,H=d(a.durationForAxis)?a.durationForAxis:F,A&&jg&&Je(Oe.data.targets,a),z&&(Af.domain(Ne.extent(Wb(L))),di=Af.domain(),Ve&&Xh.scale(Af).updateScaleExtent(),Df.domain(Af.domain()),Th.scale(Df)),y&&(Af.domain(Th.empty()?di:Th.extent()),Ve&&Xh.scale(Af).updateScaleExtent()),Bf.domain(Rb(L,"y")),Cf.domain(Rb(L,"y2")),$h.select("."+f.axisX).style("opacity",J?0:1).transition().duration(H).call(Gf),$h.select("."+f.axisY).style("opacity",J?0:1).transition().duration(H).call(Hf),$h.select("."+f.axisY2).style("opacity",J?0:1).transition().duration(H).call(If),B=ie(I),D=je(I,!0),E=je(I,!1),$h.select("."+f.axisX+" ."+f.axisXLabel).attr("x",lb),$h.select("."+f.axisY+" ."+f.axisYLabel).attr("x",mb).attr("dy",sb),$h.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",nb).attr("dy",tb),Ef.domain(Bf.domain()),Ff.domain(Cf.domain()),bi.style("display","none"),$h.select("line."+f.xgridFocus).style("visibility","hidden"),Qg){if("year"===Rg){e=[];for(var M=Wb(),N=M[0].getFullYear(),O=M[1].getFullYear(),P=N;O>=P;P++)e.push(new Date(P+"-01-01 00:00:00"))}else e=Af.ticks(10);c=$h.select("."+f.xgrids).selectAll("."+f.xgrid).data(e),c.enter().append("line").attr("class",f.xgrid),c.attr("x1",ng?0:function(a){return Af(a)-Gf.tickOffset()}).attr("x2",ng?cf:function(a){return Af(a)-Gf.tickOffset()}).attr("y1",ng?function(a){return Af(a)-Gf.tickOffset()}:_e.top).attr("y2",ng?function(a){return Af(a)-Gf.tickOffset()}:ef).style("opacity",function(){return+Ne.select(this).attr(ng?"y1":"x1")===(ng?ef:0)?0:1}),c.exit().remove()}Td(Sg)&&(g=$h.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Sg),h=g.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),h.append("line").style("opacity",0),h.append("text").attr("text-anchor","end").attr("transform",ng?"":"rotate(-90)").attr("dx",ng?0:-_e.top).attr("dy",-5).style("opacity",0),g.select("line").transition().duration(F).attr("x1",ng?0:_c).attr("x2",ng?cf:_c).attr("y1",ng?_c:_e.top).attr("y2",ng?_c:ef).style("opacity",1),g.select("text").transition().duration(F).attr("x",ng?cf:0).attr("y",_c).text(function(a){return a.text}).style("opacity",1),g.exit().transition().duration(F).style("opacity",0).remove()),u&&Tg&&(i=$h.select("."+f.ygrids).selectAll("."+f.ygrid).data(Bf.ticks(Vg)),i.enter().append("line").attr("class",f.ygrid),i.attr("x1",ng?Bf:0).attr("x2",ng?Bf:cf).attr("y1",ng?0:Bf).attr("y2",ng?ef:Bf),i.exit().remove()),u&&Td(Ug)&&(j=$h.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ug),k=j.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",ng?"rotate(-90)":"").attr("dx",ng?0:-_e.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(F).attr("x1",ng?ad:0).attr("x2",ng?ad:cf).attr("y1",ng?0:ad).attr("y2",ng?ef:ad).style("opacity",1),j.select("text").transition().duration(F).attr("x",ng?0:cf).attr("y",ad).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(F).style("opacity",0).remove()),m=$h.selectAll("."+f.bars).selectAll("."+f.bar).data(Ld),m.enter().append("path").attr("d",B).style("stroke","none").style("opacity",0).style("fill",function(a){return Eh(a.id)}).attr("class",Mc),m.style("opacity",Uc).transition().duration(F).attr("d",B).style("opacity",1),m.exit().transition().duration(G).style("opacity",0).remove(),o=$h.selectAll("."+f.texts).selectAll("."+f.text).data(Nd),o.enter().append("text").attr("class",Fc).attr("text-anchor",function(a){return ng?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),o.text(function(a){return cd(a.value)}).style("fill-opacity",Vc).transition().duration(F).attr("x",D).attr("y",E).style("fill-opacity",Xc),o.exit().transition().duration(G).style("fill-opacity",0).remove(),$h.selectAll("."+f.line).style("opacity",Uc).transition().duration(F).attr("d",Uh).style("opacity",1),$h.selectAll("."+f.area).style("opacity",0).transition().duration(F).attr("d",Vh).style("opacity",ei),l=$h.selectAll("."+f.circles).selectAll("."+f.circle).data(Md),l.enter().append("circle").attr("class",Kc).style("opacity",0).attr("r",Xg),l.style("opacity",Uc).transition().duration(F).style("opacity",Wc).attr("cx",ng?rd:qd).attr("cy",ng?qd:rd),l.exit().remove(),$h.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(F).attrTween("d",function(a){var b,c=zb(a);return c?(b=Ne.interpolate(this._current,c),this._current=b(0),function(a){return Cb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",x?"scale(1)":"").style("opacity",1),$h.selectAll("."+f.chartArc).select("text").attr("transform",Db).style("opacity",0).transition().duration(F).text(Gb).style("opacity",function(a){return vc(a.data.id)&&Kd(a.data)?1:0}),$h.select("."+f.chartArcsTitle).style("opacity",Cd(Oe.data.targets)?1:0),gg&&(null!==Ne.event&&"zoom"===Ne.event.type&&Th.extent(Af.orgDomain()).update(),v&&(_h.select("."+f.axisX).style("opacity",J?0:1).transition().duration(F).call(Jf),Th.empty()||Th.extent(Af.orgDomain()).update(),C=ie(I,!0),p=_h.selectAll("."+f.bars).selectAll("."+f.bar).data(Ld),p.enter().append("path").attr("d",C).style("stroke","none").style("fill",function(a){return Eh(a.id)}).attr("class",Mc),p.style("opacity",Uc).transition().duration(F).attr("d",C).style("opacity",1),p.exit().transition().duration(F).style("opacity",0).remove(),_h.selectAll("."+f.line).style("opacity",Uc).transition().duration(F).attr("d",Wh).style("opacity",1))),$h.selectAll("."+f.selectedCircles).filter(function(a){return Gd(a)}).selectAll("circle").remove(),$h.selectAll("."+f.selectedCircle).transition().duration(F).attr("cx",ng?rd:qd).attr("cy",ng?qd:rd),Td(Lf)?(q=$h.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),qe(q.enter()),q.attr("x",0).attr("y",0).attr("width",cf).attr("height",ef)):(zh&&!yh?(t=function(a,b){var c=oc(b),d=pc(b),e=Oe.data.x[a.id][b];return(Af(d?d:e+50)-Af(c?c:e-50))/2},s=function(a,b){var c=oc(b),d=Oe.data.x[a.id][b];return(Af(d)+Af(c?c:d-50))/2}):(t=K(),s=function(a){return Af(a.x)-t/2}),r=rc(),$h.select("."+f.eventRects).datum(r?r.values:[]),q=$h.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),pe(q.enter()),q.attr("class",Rc).attr("x",ng?0:s).attr("y",ng?s:0).attr("width",ng?cf:t).attr("height",ng?t:ef),q.exit().remove()),n=$h.select("."+f.regions).selectAll("rect."+f.region).data(nh),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Qc).attr("x",ng?0:_b).attr("y",ng?_b:_e.top).attr("width",ng?cf:ac).attr("height",ng?ac:ef).transition().duration(F).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),n.exit().transition().duration(F).style("fill-opacity",0).remove(),sc().forEach(function(a){fi[a]=!0})}}function we(){ve({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function xe(){return"mousemove"===Ne.event.sourceEvent.type&&Xh.altDomain?(Af.domain(Xh.altDomain),void Xh.scale(Af).updateScaleExtent()):(yh&&Af.orgDomain()[0]===di[0]&&Af.domain([di[0]-1e-10,Af.orgDomain()[1]]),ve({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ne.event.sourceEvent.type&&(Ch=!0)))}function ye(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ze(){Yh.attr("width",gf).attr("height",hf),Yh.select("#"+vh).select("rect").attr("width",cf).attr("height",ef),Yh.select("#xaxis-clip").select("rect").attr("width",G),Yh.select("#yaxis-clip").select("rect").attr("width",I),Yh.select("."+f.zoomRect).attr("width",cf).attr("height",ef)}function Ae(a){a=d(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.durationForExit=0,n(),Q(),ze(),m(a.withTransition),ve(a)}function Be(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=$h.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Ec(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Gc).style("fill",function(a){return Eh(a.id)}),e=$h.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Ec(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Nc).style("fill",function(a){return Eh(a.id)}).style("stroke","none").style("cursor",function(a){return Zf(a)?"pointer":null}),c=$h.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Ec(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Jc).style("opacity",0).style("stroke",function(a){return Eh(a.id)}),b.append("path").attr("class",Pc).style("opacity",function(){return ei=+Ne.select(this).style("opacity"),0}).style("fill",function(a){return Eh(a.id)}),b.append("g").attr("class",function(a){return Ec(f.selectedCircles,a.id)}),b.append("g").attr("class",Lc).style("fill",function(a){return Eh(a.id)}).style("cursor",function(a){return Zf(a)?"pointer":null}),a.forEach(function(a){$h.selectAll("."+f.selectedCircles+Sc(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=$h.select("."+f.chartArcs).selectAll("."+f.chartArc).data(rf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Ec(f.target,a.data.id)}),g.append("path").attr("class",Oc).style("opacity",0).style("fill",function(a){return Eh(a.data.id)}).style("cursor",function(a){return Zf(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=zb(a),d=Fb(c),e=Nb();Hb(c.data.id),Ge(c.data.id),e(d,b)}).on("mousemove",function(a){var b=zb(a),c=[Fb(b)];md(c,Ne.mouse(this))}).on("mouseout",function(a,b){var c=zb(a),d=Fb(c),e=Ob();Ib(c.data.id),Ie(),nd(),e(d,b)}).on("click",function(a,b){var c=zb(a),d=Fb(c),e=Mb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),gg&&(n=_h.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Ec(f.target,a.id)}),m.append("g").attr("class",Nc).style("fill",function(a){return Eh(a.id)}),l=_h.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Ec(f.target,a.id)}),k.append("path").attr("class",Jc).style("opacity",0).style("stroke",function(a){return Eh(a.id)})),Yh.selectAll("."+f.target).filter(function(a){return vc(a.id)}).transition().style("opacity",1)}function Ce(a,b){Oe.data.targets.forEach(function(b){for(var c=0;ce&&(e=(k-j)/2,w=0,C++)),B[a]=C,A[C]=e,x[a]=w,w+=j}var e,f,g=a.getBBox(),h=10*Math.ceil((g.width+s)/10),i=10*Math.ceil((g.height+r)/10),j=Mh?i:h,k=Mh?jf:kf;c&&(w=0,C=0,t=0,u=0),y[b]=h,z[b]=i,(!t||h>=t)&&(t=h),(!u||i>=u)&&(u=i),f=Mh?u:t,mg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),e=(k-f*q.length)/2,v>e?(w=0,C=0,q.forEach(function(a){d(a)})):d(b,!0)):d(b)}var g,h,i,j,k,l,o,p,q=sc(a),r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A={},B={},C=0;b=c(b)?{}:b,p=d(b.withTransition)?b.withTransition:!0,Mh?(h=function(a){return t*(.2+B[a])},k=function(a){return A[B[a]]+x[a]}):(h=function(a){return A[B[a]]+x[a]},k=function(a){return u*(.2+B[a])}),i=function(a,b){return h(a,b)+14},l=function(a,b){return k(a,b)+9},j=function(a,b){return h(a,b)-4},o=function(a,b){return k(a,b)-7},g=ai.selectAll("."+f.legendItem).data(q).enter().append("g").attr("class",function(a){return Ec(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof lg?lg(a):Oe.toggle(a)}).on("mouseover",function(a){Oe.focus(a)}).on("mouseout",function(){Oe.revert()}),g.append("text").text(function(a){return d(Of[a])?Of[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Mh?i:-200).attr("y",Mh?-200:l),g.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Mh?j:-200).attr("y",Mh?-200:o).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),g.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Eh(a)}).attr("x",Mh?i:-200).attr("y",Mh?-200:k).attr("width",10).attr("height",10),ai.selectAll("text").data(q).text(function(a){return d(Of[a])?Of[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",i).attr("y",l),ai.selectAll("rect."+f.legendItemEvent).data(q).transition().duration(p?250:0).attr("x",j).attr("y",o),ai.selectAll("rect."+f.legendItemTile).data(q).transition().duration(p?250:0).attr("x",h).attr("y",k),M(t),N(u),L(C),n(),Q(),ze(),m(!1)}function Ke(a){return tc(a.id)}function Le(a){return"data"in a&&tc(a.data.id)}function Me(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}}var Ne=a.d3?a.d3:a.require?a.require("d3"):void 0,Oe={data:{}},Pe={},Qe=h(["bindto"],"#chart"),Re=h(["size","width"]),Se=h(["size","height"]),Te=h(["padding","left"]),Ue=h(["padding","right"]),Ve=h(["zoom","enabled"],!1),We=h(["zoom","extent"]),Xe=h(["zoom","privileged"],!1),Ye=h(["onenter"],function(){}),Ze=h(["onleave"],function(){}),$e=h(["transition","duration"],350);g("data","data is required in config");var _e,af,bf,cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf,rf,sf,tf,uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf=h(["data","x"]),Lf=h(["data","xs"],{}),Mf=h(["data","x_format"],"%Y-%m-%d"),Nf=h(["data","id_converter"],function(a){return a}),Of=h(["data","names"],{}),Pf=h(["data","groups"],[]),Qf=h(["data","axes"],{}),Rf=h(["data","type"]),Sf=h(["data","types"],{}),Tf=h(["data","labels"],{}),Uf=h(["data","order"]),Vf=h(["data","regions"],{}),Wf=h(["data","colors"],{}),Xf=h(["data","selection","enabled"],!1),Yf=h(["data","selection","grouped"],!1),Zf=h(["data","selection","isselectable"],function(){return!0}),$f=h(["data","selection","multiple"],!0),_f=h(["data","onclick"],function(){}),ag=h(["data","onenter"],function(){}),bg=h(["data","onleave"],function(){}),cg=h(["data","onselected"],function(){}),dg=h(["data","onunselected"],function(){}),eg=h(["data","ondragstart"],function(){}),fg=h(["data","ondragend"],function(){}),gg=h(["subchart","show"],!1),hg=gg?h(["subchart","size","height"],60):0,ig=h(["color","pattern"],[]),jg=h(["legend","show"],!0),kg=h(["legend","position"],"bottom"),lg=h(["legend","item","onclick"]),mg=h(["legend","equally"],!1),ng=h(["axis","rotated"],!1),og=h(["axis","x","type"],"indexed"),pg=h(["axis","x","categories"],[]),qg=h(["axis","x","tick","centered"],!1),rg=h(["axis","x","tick","format"]),sg=h(["axis","x","tick","culling"],"categorized"===og?!1:!0),tg=h(["axis","x","tick","count"],10),ug=h(["axis","x","max"]),vg=h(["axis","x","min"]),wg=h(["axis","x","default"]),xg=h(["axis","x","label"],{}),yg=h(["axis","y","show"],!0),zg=h(["axis","y","max"]),Ag=h(["axis","y","min"]),Bg=h(["axis","y","center"]),Cg=h(["axis","y","label"],{}),Dg=h(["axis","y","inner"],!1),Eg=h(["axis","y","tick","format"]),Fg=h(["axis","y","padding"]),Gg=h(["axis","y","ticks"],10),Hg=h(["axis","y2","show"],!1),Ig=h(["axis","y2","max"]),Jg=h(["axis","y2","min"]),Kg=h(["axis","y2","center"]),Lg=h(["axis","y2","label"]),Mg=h(["axis","y2","inner"],!1),Ng=h(["axis","y2","tick","format"]),Og=h(["axis","y2","padding"]),Pg=h(["axis","y2","ticks"],10),Qg=h(["grid","x","show"],!1),Rg=h(["grid","x","type"],"tick"),Sg=h(["grid","x","lines"],[]),Tg=h(["grid","y","show"],!1),Ug=h(["grid","y","lines"],[]),Vg=h(["grid","y","ticks"],10),Wg=h(["point","show"],!0),Xg=Wg?h(["point","r"],2.5):0,Yg=h(["point","focus","line","enabled"],!0),Zg=h(["point","focus","expand","enabled"],!0),$g=h(["point","focus","expand","r"],Zg?4:Xg),_g=h(["point","focus","select","r"],8),ah=h(["bar","width"]),bh=h(["bar","width","ratio"],.6),ch=h(["pie","label","show"],!0),dh=h(["pie","label","format"]),eh=h(["pie","onclick"],function(){}),fh=h(["pie","onmouseover"],function(){}),gh=h(["pie","onmouseout"],function(){}),hh=h(["donut","label","show"],!0),ih=h(["donut","label","format"]),jh=h(["donut","title"],""),kh=h(["donut","onclick"],function(){}),lh=h(["donut","onmouseover"],function(){}),mh=h(["donut","onmouseout"],function(){}),nh=h(["regions"],[]),oh=h(["tooltip","show"],!0),ph=h(["tooltip","format","title"]),qh=h(["tooltip","format","value"]),rh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ph?ph:b,l=qh?qh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),sh=h(["tooltip","init","show"],!1),th=h(["tooltip","init","x"],0),uh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),vh=("string"==typeof Qe?Qe.replace("#",""):Qe.id)+"-clip",wh=i(vh),xh="timeseries"===og,yh="categorized"===og,zh=!xh&&(Kf||Td(Lf)),Ah=null,Bh=!1,Ch=!1,Dh=!1,Eh=Od(Wf,ig),Fh=function(){var a=[[Ne.time.format("%Y/%-m/%-d"),function(){return!0}],[Ne.time.format("%-m/%-d"),function(a){return a.getMonth()}],[Ne.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ne.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ne.time.format("%I %p"),function(a){return a.getHours()}],[Ne.time.format("%I:%M"),function(a){return a.getMinutes()}],[Ne.time.format(":%S"),function(a){return a.getSeconds()}],[Ne.time.format(".%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)}}(),Gh=[],Hh=ng?"left":"bottom",Ih=ng?Dg?"top":"bottom":Dg?"right":"left",Jh=ng?Mg?"bottom":"top":Mg?"left":"right",Kh=ng?"left":"bottom",Lh={main:function(){return"translate("+_e.left+","+_e.top+")"},context:function(){return"translate("+af.left+","+af.top+")"},legend:function(){return"translate("+bf.left+","+bf.top+")"},x:function(){return"translate(0,"+(ng?0:ef)+")"},y:function(){return"translate(0,"+(ng?ef:0)+")"},y2:function(){return"translate("+(ng?0:cf)+","+(ng?1:0)+")"},subx:function(){return"translate(0,"+(ng?0:ff)+")"},arc:function(){return"translate("+cf/2+","+ef/2+")"}},Mh="right"===kg,Nh=0,Oh=0,Ph=0,Qh=30,Rh=30,Sh=5;rf=Ne.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Th,Uh=function(){var a=Ne.svg.line().x(ng?function(a){return U(a.id)(a.value)}:$c).y(ng?$c:function(a){return U(a.id)(a.value)});return function(b){var c,d,e=be(b.values);return Ed(b)?(a.interpolate(Fd(b)?"cardinal":"linear"),Vf[b.id]?ne(e,Af,U(b.id),Vf[b.id]):a(e)):(c=Af(e[0].x),d=U(b.id)(e[0].value),ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Vh=function(){var a;return a=ng?Ne.svg.area().x0(function(a){return U(a.id)(0)}).x1(function(a){return U(a.id)(a.value)}).y($c):Ne.svg.area().x($c).y0(function(a){return U(a.id)(0)}).y1(function(a){return U(a.id)(a.value)}),function(b){var c,d,e=be(b.values);return yd([b],"area")||yd([b],"area-spline")?(a.interpolate(Fd(b)?"cardinal":"linear"),a(e)):(c=Af(e[0].x),d=U(b.id)(e[0].value),ng?"M "+d+" "+c:"M "+c+" "+d)}}(),Wh=function(){var a=Ne.svg.line().x(ng?function(a){return V(a.id)(a.value)}:bd).y(ng?bd:function(a){return V(a.id)(a.value)});return function(b){var c=be(b.values);return Ed(b)?a(c):"M "+Df(c[0].x)+" "+V(b.id)(c[0].value)}}(),Xh=function(){};Th=Ne.svg.brush().on("brush",we),Th.update=function(){return _h&&_h.select("."+f.brush).call(this),this},Th.scale=function(a){return ng?this.y(a):this.x(a)},Ve&&(Xh=Ne.behavior.zoom().on("zoomstart",function(){Xh.altDomain=Ne.event.sourceEvent.altKey?Af.orgDomain():null}).on("zoom",Ve?xe:null),Xh.scale=function(a){return ng?this.y(a):this.x(a)},Xh.orgScaleExtent=function(){var a=We?We:[1,10];return[a[0],Math.max(qc()/a[1],a[1])]},Xh.updateScaleExtent=function(){var a=Xb(Af.orgDomain())/Xb(di),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Yh,Zh,$h,_h,ai,bi,ci,di,ei,fi={};if(Oe.focus=function(a){function b(a){wc(a).transition().duration(100).style("opacity",1)}var c=Yh.selectAll(Tc(a)),d=c.filter(Ke),e=c.filter(Le);Oe.revert(),Oe.defocus(),b(d.classed(f.focused,!0)),b(e),Dd(Oe.data.targets)&&Hb(a,!0),Ge(a)},Oe.defocus=function(a){function b(a){wc(a).transition().duration(100).style("opacity",.3)}var c=Yh.selectAll(Tc(a)),d=c.filter(Ke),e=c.filter(Le);Oe.revert(),b(d.classed(f.focused,!1)),b(e),Dd(Oe.data.targets)&&Ib(a),He(a)},Oe.revert=function(a){function b(a){wc(a).transition().duration(100).style("opacity",1)}var c=Yh.selectAll(Tc(a)),d=c.filter(Ke),e=c.filter(Le);b(d.classed(f.focused,!1)),b(e),Dd(Oe.data.targets)&&Ib(a),Ie()},Oe.show=function(a){yc(a),Yh.selectAll(Tc(a)).transition().style("opacity",1),ve({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Oe.hide=function(a){xc(a),Yh.selectAll(Tc(a)).transition().style("opacity",0),ve({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!1})},Oe.toggle=function(a){vc(a)?Oe.hide(a):Oe.show(a)},Oe.unzoom=function(){Th.clear().update(),ve({withUpdateXDomain:!0})},Oe.load=function(a){return a.xs&&fc(a.xs),"categories"in a&&yh&&(pg=a.categories,Gf.categories(pg)),"cacheIds"in a&&Yb(a.cacheIds)?void Ce($b(a.cacheIds),a.done):void("unload"in a?Ee(a.unload?"string"==typeof a.unload?[a.unload]:a.unload:[],function(){De(a)}):De(a))},Oe.unload=function(a){Ee(a?"string"==typeof a?[a]:a:sc(),function(){ve({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},Oe.selected=function(a){return Ne.merge($h.selectAll("."+f.shapes+Sc(a)).selectAll("."+f.shape).filter(function(){return Ne.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},Oe.select=function(a,b,c){Xf&&$h.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ne.select(this),i="circle"===this.nodeName?Xd:$d,j="circle"===this.nodeName?Yd:_d,k=Yf||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Zf(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},Oe.unselect=function(a,b){Xf&&$h.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ne.select(this),g="circle"===this.nodeName?Yd:_d,h=Yf||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Zf(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},Oe.toLine=function(a){xd(a,"line"),Ae()},Oe.toSpline=function(a){xd(a,"spline"),Ae()},Oe.toBar=function(a){xd(a,"bar"),Ae()},Oe.toScatter=function(a){xd(a,"scatter"),Ae()},Oe.toArea=function(a){xd(a,"area"),Ae()},Oe.toAreaSpline=function(a){xd(a,"area-spline"),Ae()},Oe.toPie=function(a){xd(a,"pie"),Ae({withTransform:!0})},Oe.toDonut=function(a){xd(a,"donut"),Ae({withTransform:!0})},Oe.groups=function(a){return c(a)?Pf:(Pf=a,ve(),Pf)},Oe.xgrids=function(a){return a?(Sg=a,ve(),Sg):Sg},Oe.xgrids.add=function(a){return a?Oe.xgrids(Sg.concat(a)):void 0},Oe.xgrids.remove=function(a){var b=Me(a);return Oe.xgrids(Sg.filter(b))},Oe.ygrids=function(a){return a?(Ug=a,ve(),Ug):Ug},Oe.ygrids.add=function(a){return a?Oe.ygrids(Ug.concat(a)):void 0},Oe.ygrids.remove=function(a){var b=Me(a);return Oe.ygrids(Ug.filter(b))},Oe.regions=function(a){return c(a)?nh:(nh=a,ve(),nh)},Oe.regions.add=function(a){return c(a)?nh:(nh=nh.concat(a),ve(),nh)},Oe.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;Yh.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),nh=nh.filter(function(b){return b.classes.indexOf(a)<0})}),nh},Oe.data.get=function(a){var b=Oe.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Oe.data.getAsTarget=function(a){var b=uc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Oe.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Of[b]=a[b]}),Je(Oe.data.targets,{withTransition:!0}),Of):Of},Oe.x=function(a){return arguments.length&&(hc(Oe.data.targets,a),ve({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Oe.data.x},Oe.xs=function(a){return arguments.length&&(ic(Oe.data.targets,a),ve({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Oe.data.x},Oe.resize=function(a){Re=a?a.width:null,Se=a?a.height:null,Ae({withLegend:!0,withTransition:!1})},Oe.destroy=function(){Oe.data.targets=void 0,Oe.data.x={},ci.html(""),a.onresize=null},"url"in e.data)Ne.csv(e.data.url,function(a,b){oe(b)});else if("rows"in e.data)oe(kc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");oe(lc(e.data.columns))}return Oe},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file