diff --git a/c3.js b/c3.js index 38a4353..cd4a6b0 100644 --- a/c3.js +++ b/c3.js @@ -299,7 +299,7 @@ /*-- Set Chart Params --*/ - var margin, margin2, margin3, width, width2, height, height2, currentWidth, currentHeight, legendHeight, legendWidth; + var margin, margin2, margin3, width, width2, height, height2, currentWidth, currentHeight; var radius, radiusExpanded, innerRadius, svgArc, svgArcExpanded, svgArcExpandedSub, pie; var xMin, xMax, yMin, yMax, subXMin, subXMax, subYMin, subYMax; var x, y, y2, subX, subY, subY2, xAxis, yAxis, yAxis2, subXAxis; @@ -345,9 +345,7 @@ } function transformLegend(withTransition) { var duration = withTransition !== false ? 250 : 0; - if (__legend_show) { - legend.transition().duration(duration).attr("transform", translate.legend); - } + legend.transition().duration(duration).attr("transform", translate.legend); } function transformAll(withTransition) { transformMain(withTransition); @@ -361,10 +359,10 @@ var rotated_padding_left = 30, rotated_padding_right = 30, rotated_padding_top = 5; function updateSizes() { + var legendHeight = getLegendHeight(), legendWidth = getLegendWidth(); + currentWidth = getCurrentWidth(); currentHeight = getCurrentHeight(); - legendHeight = getLegendHeight(); - legendWidth = getLegendWidth(); // for main margin = { @@ -448,7 +446,7 @@ } else if (__padding_right) { return __padding_right; } else if (isLegendRight) { - return legendWidth + (__axis_y2_show && !__axis_rotated ? getAxisWidthByAxisId('y2') : defaultPadding); + return getLegendWidth() + (__axis_y2_show && !__axis_rotated ? getAxisWidthByAxisId('y2') : defaultPadding); } else if (__axis_y2_show) { return __axis_y2_inner || __axis_rotated ? defaultPadding : getAxisWidthByAxisId('y2'); } else { @@ -1994,6 +1992,9 @@ return false; } + function isEmpty(o) { + return !o || (typeof o === 'string' && o.length === 0) || (typeof o === 'object' && Object.keys(o).length === 0); + } function notEmpty(o) { return Object.keys(o).length > 0; } @@ -2401,7 +2402,12 @@ // Define regions main = svg.append("g").attr("transform", translate.main); context = __subchart_show ? svg.append("g").attr("transform", translate.context) : null; - legend = __legend_show ? svg.append("g").attr("transform", translate.legend) : null; + legend = svg.append("g").attr("transform", translate.legend); + + if (!__legend_show) { + legend.style('visibility', 'hidden'); + hiddenLegendIds = mapToIds(c3.data.targets); + } // Define tooltip tooltip = d3.select(__bindto) @@ -2603,7 +2609,7 @@ } if (window.onresize.add) { window.onresize.add(function () { - updateAndRedraw({withTransition: false, withLegend: true}); + updateAndRedraw({withLegend: true, withTransition: false, withTransitionForTransform: false}); }); } } @@ -3593,9 +3599,7 @@ // Reset fadein for future load withoutFadeIn[id] = false; // Remove target's elements - if (__legend_show) { - legend.selectAll('.' + CLASS.legendItem + getTargetSelectorSuffix(id)).remove(); - } + legend.selectAll('.' + CLASS.legendItem + getTargetSelectorSuffix(id)).remove(); // Remove target c3.data.targets = c3.data.targets.filter(function (t) { return t.id !== id; @@ -3606,11 +3610,9 @@ /*-- Draw Legend --*/ function toggleFocusLegend(id, focus) { - var legendItem, isTarget, notTarget; - if (!__legend_show) { return; } - legendItem = legend.selectAll('.' + CLASS.legendItem); - isTarget = function (d) { return (!id || d === id); }; - notTarget = function (d) { return !isTarget(d); }; + var legendItem = legend.selectAll('.' + CLASS.legendItem), + isTarget = function (d) { return (!id || d === id); }, + notTarget = function (d) { return !isTarget(d); }; legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : 1); legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? 1 : 0.3); } @@ -3621,7 +3623,6 @@ toggleFocusLegend(id, false); } function revertLegend() { - if (!__legend_show) { return; } legend.selectAll('.' + CLASS.legendItem) .transition().duration(100) .style('opacity', 1); @@ -3648,7 +3649,7 @@ var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; var withTransition, withTransitionForTransform, withTransformAll; - options = isUndefined(options) ? {} : options; + options = options || {}; withTransition = isDefined(options.withTransition) ? options.withTransition : true; withTransitionForTransform = isDefined(options.withTransitionForTransform) ? options.withTransitionForTransform : true; withTransformAll = isDefined(options.withTransformAll) ? options.withTransformAll : true; @@ -3658,7 +3659,7 @@ itemWidth = Math.ceil((box.width + paddingRight) / 10) * 10, itemHeight = Math.ceil((box.height + paddingTop) / 10) * 10, itemLength = isLegendRight ? itemHeight : itemWidth, - areaLength = isLegendRight ? legendHeight : legendWidth, + areaLength = isLegendRight ? getLegendHeight() : getLegendWidth(), margin, maxLength; // MEMO: care about condifion of step, totalLength @@ -3684,7 +3685,7 @@ maxHeight = 0; } - if (!isLegendToShow(id)) { + if (__legend_show && !isLegendToShow(id)) { widths[id] = heights[id] = steps[id] = offsets[id] = 0; return; } @@ -3730,6 +3731,7 @@ .data(targetIds) .enter().append('g') .attr('class', function (id) { return generateClass(CLASS.legendItem, id); }) + .style('visibility', function (id) { return isLegendToShow(id) ? 'visible' : 'hidden'; }) .style('cursor', 'pointer') .on('click', function (id) { typeof __legend_item_onclick === 'function' ? __legend_item_onclick(id) : c3.toggle(id); @@ -4151,12 +4153,18 @@ }; c3.legend.show = function (targetIds) { - if (!__legend_show) { return; } + if (!__legend_show) { + __legend_show = true; + legend.style('visibility', 'visible'); + } showLegend(mapToTargetIds(targetIds)); redraw({withTransitionForHorizontalAxis: false}); }; c3.legend.hide = function (targetIds) { - if (!__legend_show) { return; } + if (__legend_show && isEmpty(targetIds)) { + __legend_show = false; + legend.style('visibility', 'hidden'); + } hideLegend(mapToTargetIds(targetIds)); redraw({withTransitionForHorizontalAxis: false}); }; @@ -4164,7 +4172,7 @@ c3.resize = function (size) { __size_width = size ? size.width : null; __size_height = size ? size.height : null; - updateAndRedraw({withLegend: true, withTransition: false}); + updateAndRedraw({withLegend: true, withTransition: false, withTransitionForTransform: false}); }; c3.destroy = function () { diff --git a/c3.min.js b/c3.min.js index d34dd25..9fd02a3 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.28"},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.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;cuf&&(uf=0),0>wf&&(wf=0),sf={top:Fg?rf.top:zf-zg-(ki?0:Af),right:0/0,bottom:20+(ki?0:Af),left:Fg?oi:rf.left},vf=Fg?rf.left-oi-pi:uf,xf=Fg?wf:zf-sf.top-sf.bottom,0>vf&&(vf=0),0>xf&&(xf=0),tf={top:ki?0:zf-Af,right:0/0,bottom:0,left:ki?yf-Bf:0},p(),ki&&Rd(df.data.targets)&&(tf.left=uf/2+Df)}function o(){yi.select("line."+f.xgridFocus).attr("x1",Fg?0:-10).attr("x2",Fg?uf:-10).attr("y1",Fg?-10:rf.top).attr("y2",Fg?-10:wf)}function p(){Df=wf/2,Cf=.95*Df,Ef=Qd(df.data.targets)?.6*Cf:0}function q(){var a=Fg?f.axisX:f.axisY,b=cf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=cf.select(ff).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return gf?gf:x()}function s(){var a=hf?hf:y();return a>0?a:320}function t(){return Rd(df.data.targets)?0:jf?jf:Fg||!Sg||Xg?1:v("y")}function u(){var a=1;return Rd(df.data.targets)?0:kf?kf:ki?Bf+(_g&&!Fg?v("y2"):a):_g?eh||Fg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Sg?"y2"!==a||_g?(gb(a).isInner?30:40)+("y2"===a?-10:0):qi:Bg&&!ki?10:1}function x(){return+cf.select(ff).style("width").replace("px","")}function y(){return+cf.select(ff).style("height").replace("px","")}function z(a){return a?-5:-(rf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Fg)}function C(){return A(!Fg)}function D(){return z(Fg)}function E(){return A(Fg)}function F(a){return a?uf+2+4:rf.left+20}function G(a){return a?80:wf+2}function H(){return F(!Fg)}function I(){return G(!Fg)}function J(){return F(Fg)}function K(){return G(Fg)}function L(){var a=Fg?wf:uf,b=tc(),c=Vb()*(Nd(df.data.targets)?(b-(Wh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){li=a}function N(a){mi=a}function O(a){ni=a}function P(){return Bg?ki?mi*(li+1):yf:0}function Q(){return Bg?ki?zf:ni*(li+1):0}function R(){var a,b=!Rf;Jf=Fg?1:0,Kf=Fg?wf:uf,Lf=Fg?0:wf,Mf=Fg?uf:1,Nf=Jf,Of=Kf,Pf=Fg?0:xf,Qf=Fg?vf:1,Rf=T(Jf,Kf,b?void 0:Rf.domain(),function(){return Xf.tickOffset()}),Sf=U(Lf,Mf),Tf=U(Lf,Mf),Uf=T(Jf,Kf,Di,function(a){return a%1?0:$f.tickOffset()}),Vf=U(Pf,Qf),Wf=U(Pf,Qf),a=$(),Xf=X(Rf,fi,a),$f=X(Uf,ii,a),Yf=Y(Sf,gi,Yg,$g),Zf=Y(Tf,hi,fh,hh),b||(ri.scale(Uf),lf&&vi.scale(Rf)),S()}function S(){Ff=Db(),Gf=Eb(),Hf=Eb(.98)}function T(a,b,e,f){var g=(Vh?cf.time.scale():cf.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Wh){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 U(a,b){return cf.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Tf:Sf}function W(a){return"y2"===Z(a)?Wf:Vf}function X(a,b,c){var d=(Wh?Bb():cf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Wh?d.tickCentered(Ig):d.tickOffset=function(){var a=Fg?wf:uf;return a*Vb()/tc()/2},Wh&&d.categories(Hg),d}function Y(a,b,c,d){return cf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in fg?fg[a]:"y"}function $(){var a=Vh?ci:Wh?Mc:function(a){return 0>a?a.toFixed(0):a};return Jg&&("function"==typeof Jg?a=Jg:Vh&&(a=function(a){return cf.time.format(Jg)(a)})),a}function _(a){var b;return"y"===a?b=Wg:"y2"===a?b=dh:"x"===a&&(b=Rg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Wg=b:"y2"===a?dh=b:"x"===a&&(Rg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Fg?"inner-top":"inner-right")}function eb(){return cb("y",Fg?"inner-right":"inner-top")}function fb(){return cb("y2",Fg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?uf/2:uf:b.isBottom?-wf:b.isMiddle?-wf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Fg,db())}function ob(){return kb(Fg,eb())}function pb(){return kb(Fg,fb())}function qb(){return lb(!Fg,db())}function rb(){return lb(Fg,eb())}function sb(){return lb(Fg,fb())}function tb(){var a=db();return Fg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Fg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Fg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Fg,db())}function xb(){return mb(Fg,eb())}function yb(){return mb(Fg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return cf.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){yi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),yi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),yi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){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=Kc(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 cf.min(Object.keys(i).map(function(a){return cf.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ic(a);if(eg.length>0)for(g=Lc(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 cf.max(Object.keys(i).map(function(a){return cf.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?bh:Ug,n="y2"===c?ah:Tg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?ch:Vg,r=id()&&Fg;return 0===l.length?"y2"===c?Tf.domain():Sf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=jd(o,p),j=$b(Sf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Zg&&(f=b(Zg.top)?Zg.top:e,g=b(Zg.bottom)?Zg.bottom:e),"y2"===c&&gh&&(f=b(gh.top)?gh.top:e,g=b(gh.bottom)?gh.bottom:e),Nd(l)&&!Kc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Di),c=$b(Rf.domain());return a||0===c?1:b/c}function Wb(a){return Pg?Pg:cf.min(a,function(a){return cf.min(a.values,function(a){return a.x})})}function Xb(a){return Og?Og:cf.max(a,function(a){return cf.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Wh?d=0:Nd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Vh?new Date(c.getTime()-e):c-e,g=Vh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return _f&&a===_f||fe(ag)&&ge(ag,a)}function fc(a){return!ec(a)}function gc(a){return _f?_f:fe(ag)?ag[a]:null}function hc(a,b){return a in df.data.x&&df.data.x[a]&&df.data.x[a][b]?df.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){ag[b]=a[b]})}function jc(a){var b;return a&&(b=dg[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),df.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Vh?a?a instanceof Date?a:be(a):be(hc(b,c)):Xh&&!Wh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(df.data.x[b]=a.map(function(a){return a[c]})):df.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!df.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=cg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Xh&&Wh&&0===c&&g&&(0===e&&(Hg=[]),Hg.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++})}),gg&&Ld(vc(b).filter(function(a){return!(a in hg)}),gg),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&df.data.targets[0].values[a-1]?df.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?df.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?df.data.targets[0]:null,a}function vc(a){return a.map(function(a){return a.id})}function wc(a){return a?"string"==typeof a?[a]:a:vc(df.data.targets)}function xc(a,b){var c,d=vc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Vh?new Date(h):h);i.push(d)}return i}function Ec(a){di=di.concat(a)}function Fc(a){di=di.filter(function(b){return a.indexOf(b)<0})}function Gc(a){ei=ei.concat(a)}function Hc(a){ei=ei.filter(function(b){return a.indexOf(b)<0})}function Ic(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Jc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Lc(a){return Jc(a,function(a){return a>0})}function Mc(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(rd(a,f))),a[g].x&&(e=e.concat(rd(a,g))),ud(e,b)):sd(a,b,f,g)}function td(a,b){var c;return c=a.map(function(a){return sd(a.values,b)}),ud(c,b)}function ud(a,b){var c,d;return a.forEach(function(a){var e=he(a,b);(c>e||!c)&&(c=e,d=a)}),d}function vd(a,b){return cf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function wd(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 xd(){return jg&&"desc"===jg.toLowerCase()}function yd(){return jg&&"asc"===jg.toLowerCase()}function zd(a){var b=yd(),c=xd();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 jg&&a.sort(jg),a}function Ad(a,c){var d,e,f,g,h,i,j,k=Rd(df.data.targets),l=k?ld:kd,m=a.filter(function(a){return a&&b(a.value)});Ih&&0!==m.length&&(Bi.html(Lh(a,$(),l,bi)).style("display","block"),d=Bi.property("offsetWidth"),e=Bi.property("offsetHeight"),k?(g=uf/2+c[0],i=wf/2+c[1]+20):(Fg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Rf(m[0].x)+20):(f=q(),g=f+t()+Rf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Bi.style("top",i+"px").style("left",g+"px"))}function Bd(){Bi.style("display","none")}function Cd(a){var c=a.filter(function(a){return a&&b(a.value)});Ih&&(Od(df.data.targets)||Rd(df.data.targets)||yi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Fg?"y1":"x1",nd).attr(Fg?"y2":"x2",nd))}function Dd(){yi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ed(a){return a.x||0===a.x?Rf(a.x):null}function Fd(a){return V(a.id)(a.value)}function Gd(){var a,b,d={},e=0;return Bc(yc(Ud)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Kd(a,b){return uh?uh:b?2*a.tickOffset()*vh/b:0}function Ld(a,b){wc(a).forEach(function(a){Fi[a]=b===hg[a],hg[a]=b})}function Md(a,b){var c=!1;return a.forEach(function(a){hg[a.id]===b&&(c=!0),a.id in hg||"line"!==b||(c=!0)}),c}function Nd(a){return Md(a,"bar")}function Od(a){return Md(a,"scatter")}function Pd(a){return Md(a,"pie")}function Qd(a){return Md(a,"donut")}function Rd(a){return Pd(a)||Qd(a)}function Sd(a){var b="string"==typeof a?a:a.id;return!(b in hg)||"line"===hg[b]||"spline"===hg[b]||"area"===hg[b]||"area-spline"===hg[b]}function Td(a){var b="string"==typeof a?a:a.id;return"spline"===hg[b]||"area-spline"===hg[b]}function Ud(a){var b="string"==typeof a?a:a.id;return"bar"===hg[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"scatter"===hg[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"pie"===hg[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"donut"===hg[b]}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){return Ud(a)?a.values:[]}function $d(a){return Sd(a)||Vd(a)?a.values:[]}function _d(a){return Ud(a)||Sd(a)?a.values:[]}function ae(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function be(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+bg+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=bg?cf.time.format(bg).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+bg),c}function ce(a,b){var c=cf.mouse(a),d=cf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function ge(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function he(a,b){var c="y"===Z(a.id)?Sf:Tf,d=Fg?1:0,e=Fg?0:1;return Math.pow(Rf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ie(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function je(a,b,c){ug(b,a.node()),yi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Nc(f.selectedCircle,c)}).attr("cx",Fg?Fd:Ed).attr("cy",Fg?Ed:Fd).attr("stroke",function(){return bi(b)}).attr("r",1.4*th).transition().duration(100).attr("r",th)}function ke(a,b,c){vg(b,a.node()),yi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function le(a,b,c,d){a?je(b,c,d):ke(b,c,d)}function me(a,b){ug(b,a.node()),a.transition().duration(100).style("fill",function(){return cf.rgb(bi(b)).darker(1)})}function ne(a,b){vg(b,a.node()),a.transition().duration(100).style("fill",function(){return bi(b)})}function oe(a,b,c,d){a?me(b,c,d):ne(b,c,d)}function pe(a){return a.filter(function(a){return b(a.value)})}function qe(a,c){return(c?yi.selectAll("."+f.circles+_c(c)):yi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function re(a,b){qe(a,b).classed(f.EXPANDED,!0).attr("r",sh)}function se(a){qe(a).filter(function(){return cf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",ph)}function te(a){return yi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ue(a){te(a).classed(f.EXPANDED,!0)}function ve(a){te(a).classed(f.EXPANDED,!1)}function we(a,b){var c=Ae(a,b);return function(a,b){var d=c(a,b),e=Fg?1:0,f=Fg?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 xe(a,b){var c=Ae(a,!1),d=b?ye:ze;return function(a,b){return d(c(a,b),a,this)}}function ye(a,b){var c;return Fg?(c=Ud(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function ze(a,b,c){var d=c.getBBox();return Fg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Ud(b)?-3:-6)}function Ae(a,b){var c=a.__max__+1,d=Kd(Xf,c),e=Hd(d,c,a,!!b),f=Id(!!b),g=Jd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Fg&&(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 Be(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 Ce(b){var c,d,e;if(Ci=cf.select(ff),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),df.data.x={},df.data.targets=pc(b),n(),R(),Rf.domain(cf.extent(Zb(df.data.targets))),Sf.domain(Ub(df.data.targets,"y")),Tf.domain(Ub(df.data.targets,"y2")),Uf.domain(Rf.domain()),Vf.domain(Sf.domain()),Wf.domain(Tf.domain()),Di=Rf.domain(),ri.scale(Uf),lf&&vi.scale(Rf),wi=Ci.append("svg").attr("width",uf+rf.left+rf.right).attr("height",wf+rf.top+rf.bottom).on("mouseenter",of).on("mouseleave",pf),xi=wi.append("defs"),xi.append("clipPath").attr("id",Ph).append("rect").attr("width",uf).attr("height",wf),xi.append("clipPath").attr("id",Qh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),xi.append("clipPath").attr("id",Rh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),yi=wi.append("g").attr("transform",ji.main),zi=yg?wi.append("g").attr("transform",ji.context):null,Ai=Bg?wi.append("g").attr("transform",ji.legend):null,Bi=cf.select(ff).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ze(vc(df.data.targets),{withTransform:!1,withTransitionForTransform:!1}),yi.append("g").attr("class",f.axisX).attr("clip-path",Fg?"":Th).attr("transform",ji.x).append("text").attr("class",f.axisXLabel).attr("transform",Fg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Sg&&yi.append("g").attr("class",f.axisY).attr("clip-path",Fg?Uh:"").attr("transform",ji.y).append("text").attr("class",f.axisYLabel).attr("transform",Fg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),_g&&yi.append("g").attr("class",f.axisY2).attr("transform",ji.y2).append("text").attr("class",f.axisY2Label).attr("transform",Fg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=yi.append("g").attr("clip-path",Sh).attr("class",f.grid),ih&&d.append("g").attr("class",f.xgrids),fe(kh)&&d.append("g").attr("class",f.xgridLines),qh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),lh&&d.append("g").attr("class",f.ygrids),fe(mh)&&d.append("g").attr("class",f.ygridLines),yi.append("g").attr("clip-path",Sh).attr("class",f.regions),yi.append("g").attr("clip-path",Sh).attr("class",f.chart),c=yi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",lf?Fg?"ns-resize":"ew-resize":null),yi.select("."+f.chart).append("g").attr("class",f.chartBars),yi.select("."+f.chart).append("g").attr("class",f.chartLines),yi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ji.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),yi.select("."+f.chart).append("g").attr("class",f.chartTexts),lf&&yi.insert("rect",nf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",uf).attr("height",wf).style("opacity",0).style("cursor",Fg?"ns-resize":"ew-resize").call(vi).on("dblclick.zoom",null),Qg&&ri.extent("function"!=typeof Qg?Qg:Qg(Zb())),yg&&(zi.append("g").attr("clip-path",Sh).attr("class",f.chart),zi.select("."+f.chart).append("g").attr("class",f.chartBars),zi.select("."+f.chart).append("g").attr("class",f.chartLines),zi.append("g").attr("clip-path",Sh).attr("class",f.brush).call(ri).selectAll("rect").attr(Fg?"width":"height",Fg?vf:xf),zi.append("g").attr("class",f.axisX).attr("transform",ji.subx).attr("clip-path",Fg?"":Th)),Pe(df.data.targets),Fg?yi.select("."+f.axisX).style("opacity",0).call(Xf):(yi.select("."+f.axisY).style("opacity",0).call(Yf),yi.select("."+f.axisY2).style("opacity",0).call(Zf)),Je({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Mh){if(Vh&&"string"==typeof Nh){for(Nh=be(Nh),e=0;e0){d=[];for(var g in dg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=wd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=oe,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 He(a){Rd(df.data.targets)||ng&&(Yh=a,yi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Zh=!0,wg())}function Ie(){Rd(df.data.targets)||ng&&(yi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),yi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Zh=!1,xg())}function Je(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S=Gd(),T=Rd(df.data.targets),U=Bc(df.data.targets);if(0!==U.length){if(a=d(a)?a:{},x=d(a.withY)?a.withY:!0,y=d(a.withSubchart)?a.withSubchart:!0,z=d(a.withTransition)?a.withTransition:!0,D=d(a.withTransform)?a.withTransform:!1,E=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,F=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,G=d(a.withLegend)?a.withLegend:!1,A=d(a.withTransitionForExit)?a.withTransitionForExit:z,B=d(a.withTransitionForAxis)?a.withTransitionForAxis:z,C=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:z,M=z?qf:0,N=A?M:0,O=B?M:0,G&&Bg&&Ze(vc(df.data.targets),a),F&&(Rf.domain(cf.extent(Zb(U))),Di=Rf.domain(),lf&&vi.scale(Rf).updateScaleExtent(),Uf.domain(Rf.domain()),ri.scale(Uf)),E&&(Rf.domain(ri.empty()?Di:ri.extent()),lf&&vi.scale(Rf).updateScaleExtent()),Sf.domain(Ub(U,"y")),Tf.domain(Ub(U,"y2")),Od(U)||(P=Dc(Cc(U)).sort(),Xf.tickValues(P),$f.tickValues(P)),c=yi.select("."+f.axisX).style("opacity",T?0:1),(Fg||C)&&(c=c.transition().duration(O)),c.call(Xf),e=yi.select("."+f.axisY).style("opacity",T?0:1),(!Fg||C)&&(e=e.transition().duration(O)),e.call(Yf),yi.select("."+f.axisY2).style("opacity",T?0:1).transition().duration(O).call(Zf),E&&Kg&&P){for(Q=1;Q=Y;Y++)h.push(new Date(Y+"-01-01 00:00:00"))}else h=Rf.ticks(10);g=yi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Fg?0:function(a){return Rf(a)-Xf.tickOffset()}).attr("x2",Fg?uf:function(a){return Rf(a)-Xf.tickOffset()}).attr("y1",Fg?function(a){return Rf(a)-Xf.tickOffset()}:rf.top).attr("y2",Fg?function(a){return Rf(a)-Xf.tickOffset()}:wf).style("opacity",function(){return+cf.select(this).attr(Fg?"y1":"x1")===(Fg?wf:0)?0:1}),g.exit().remove()}fe(kh)&&(i=yi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(kh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Fg?"":"rotate(-90)").attr("dx",Fg?0:-rf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(M).attr("x1",Fg?0:od).attr("x2",Fg?uf:od).attr("y1",Fg?od:rf.top).attr("y2",Fg?od:wf).style("opacity",1),i.select("text").transition().duration(M).attr("x",Fg?uf:0).attr("y",od).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(M).style("opacity",0).remove()),x&&lh&&(k=yi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Sf.ticks(nh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Fg?Sf:0).attr("x2",Fg?Sf:uf).attr("y1",Fg?0:Sf).attr("y2",Fg?wf:Sf),k.exit().remove()),x&&fe(mh)&&(l=yi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(mh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Fg?"rotate(-90)":"").attr("dx",Fg?0:-rf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(M).attr("x1",Fg?pd:0).attr("x2",Fg?pd:uf).attr("y1",Fg?0:pd).attr("y2",Fg?wf:pd).style("opacity",1),l.select("text").transition().duration(M).attr("x",Fg?0:uf).attr("y",pd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(M).style("opacity",0).remove()),p=yi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),p.enter().append("path").attr("d",H).style("stroke","none").style("opacity",0).style("fill",function(a){return bi(a)}).attr("class",Vc),p.style("opacity",ed).transition().duration(M).attr("d",H).style("opacity",1),p.exit().transition().duration(N).style("opacity",0).remove(),r=yi.selectAll("."+f.texts).selectAll("."+f.text).data(_d),r.enter().append("text").attr("class",Oc).attr("text-anchor",function(a){return Fg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return md(a.id)(a.value)}).style("fill-opacity",fd).transition().duration(M).attr("x",J).attr("y",K).style("fill-opacity",hd),r.exit().transition().duration(N).style("fill-opacity",0).remove(),yi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",si).style("opacity",1),yi.selectAll("."+f.area).style("opacity",0).transition().duration(M).attr("d",ti).style("opacity",Ei),n=yi.selectAll("."+f.circles).selectAll("."+f.circle).data($d),n.enter().append("circle").attr("class",Tc).style("opacity",0).attr("r",ph),n.style("opacity",ed).transition().duration(M).style("opacity",gd).attr("cx",Fg?Fd:Ed).attr("cy",Fg?Ed:Fd),n.exit().remove(),yi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",D?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(M).attrTween("d",function(a){var b,c=Cb(a);return c?(b=cf.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",D?"scale(1)":"").style("opacity",1),yi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(M).text(Jb).style("opacity",function(a){return zc(a.data.id)&&Yd(a.data)?1:0}),yi.select("."+f.chartArcsTitle).style("opacity",Qd(df.data.targets)?1:0),yg&&(null!==cf.event&&"zoom"===cf.event.type&&ri.extent(Rf.orgDomain()).update(),y&&(zi.select("."+f.axisX).style("opacity",T?0:1).transition().duration(M).call($f),ri.empty()||ri.extent(Rf.orgDomain()).update(),I=we(S,!0),s=zi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),s.enter().append("path").attr("d",I).style("stroke","none").style("fill",function(a){return bi(a)}).attr("class",Vc),s.style("opacity",ed).transition().duration(M).attr("d",I).style("opacity",1),s.exit().transition().duration(M).style("opacity",0).remove(),zi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ui).style("opacity",1))),yi.selectAll("."+f.selectedCircles).filter(function(a){return Ud(a)}).selectAll("circle").remove(),yi.selectAll("."+f.selectedCircle).transition().duration(M).attr("cx",Fg?Fd:Ed).attr("cy",Fg?Ed:Fd),fe(ag)?(t=yi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ee(t.enter()),t.attr("x",0).attr("y",0).attr("width",uf).attr("height",wf)):(Xh&&!Wh?(w=function(a,b){var c=rc(b),d=sc(b),e=df.data.x[a.id][b];return(Rf(d?d:e+50)-Rf(c?c:e-50))/2},v=function(a,b){var c=rc(b),d=df.data.x[a.id][b];return(Rf(d)+Rf(c?c:d-50))/2}):(w=L(),v=function(a){return Rf(a.x)-w/2}),u=uc(),yi.select("."+f.eventRects).datum(u?u.values:[]),t=yi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),De(t.enter()),t.attr("class",$c).attr("x",Fg?0:v).attr("y",Fg?v:0).attr("width",Fg?uf:w).attr("height",Fg?w:wf),t.exit().remove()),q=yi.select("."+f.regions).selectAll("rect."+f.region).data(Hh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",Zc).attr("x",Fg?0:cc).attr("y",Fg?cc:rf.top).attr("width",Fg?uf:dc).attr("height",Fg?dc:wf).transition().duration(M).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(M).style("fill-opacity",0).remove(),vc(df.data.targets).forEach(function(a){Fi[a]=!0})}}function Ke(){Je({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Le(){return"mousemove"===cf.event.sourceEvent.type&&vi.altDomain?(Rf.domain(vi.altDomain),void vi.scale(Rf).updateScaleExtent()):(Wh&&Rf.orgDomain()[0]===Di[0]&&Rf.domain([Di[0]-1e-10,Rf.orgDomain()[1]]),Je({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===cf.event.sourceEvent.type&&($h=!0)))}function Me(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Ne(){wi.attr("width",yf).attr("height",zf),wi.select("#"+Ph).select("rect").attr("width",uf).attr("height",wf),wi.select("#"+Qh).select("rect").attr("width",H),wi.select("#"+Rh).select("rect").attr("width",J),wi.select("."+f.zoomRect).attr("width",uf).attr("height",wf)}function Oe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Ne(),m(a.withTransition),Je(a)}function Pe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=yi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Nc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Pc).style("fill",function(a){return bi(a)}),e=yi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Wc).style("fill",function(a){return bi(a)}).style("stroke","none").style("cursor",function(a){return pg(a)?"pointer":null}),c=yi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return bi(a)}),b.append("path").attr("class",Yc).style("opacity",function(){return Ei=+cf.select(this).style("opacity"),0}).style("fill",function(a){return bi(a)}),b.append("g").attr("class",function(a){return Nc(f.selectedCircles,a.id)}),b.append("g").attr("class",Uc).style("fill",function(a){return bi(a)}).style("cursor",function(a){return pg(a)?"pointer":null}),a.forEach(function(a){yi.selectAll("."+f.selectedCircles+_c(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(If(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Nc(f.target,a.data.id)}),g.append("path").attr("class",Xc).style("opacity",0).style("fill",function(a){return bi(a.data)}).style("cursor",function(a){return pg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ue(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Ad(c,cf.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),We(),Bd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),yg&&(n=zi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}),m.append("g").attr("class",Wc).style("fill",function(a){return bi(a)}),l=zi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}),k.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return bi(a)})),wi.selectAll("."+f.target).filter(function(a){return zc(a.id)}).transition().style("opacity",1)}function Qe(a,b){df.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=ki?j:i,l=ki?Af:Bf;return d&&(x=0,D=0,u=0,v=0),Ac(c)?(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=ki?v:u,void(Eg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c))):void(z[c]=A[c]=C[c]=y[c]=0)}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=c(b)?{}:b,p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,ki?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=Ai.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Nc(f.legendItem,a)}).style("cursor","pointer").on("click",function(a){"function"==typeof Dg?Dg(a):df.toggle(a)}).on("mouseover",function(a){df.focus(a)}).on("mouseout",function(){df.revert()}),o.append("text").text(function(a){return d(dg[a])?dg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",ki?h:-200).attr("y",ki?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ki?i:-200).attr("y",ki?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return bi(a)}).attr("x",ki?h:-200).attr("y",ki?-200:j).attr("width",10).attr("height",10),Ai.selectAll("text").data(a).text(function(a){return d(dg[a])?dg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),Ai.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),Ai.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),Ne(),r&&m(q)}function $e(a){return xc(df.data.targets,a.id)}function _e(a){return"data"in a&&xc(df.data.targets,a.data.id)}function af(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function bf(a,b,c){var d=!Rd(df.data.targets);Ld(a,b),Oe(c?c:{withTransitionForAxis:d})}var cf=a.d3?a.d3:a.require?a.require("d3"):void 0,df={data:{},axis:{},legend:{}},ef={},ff=h(["bindto"],"#chart"),gf=h(["size","width"]),hf=h(["size","height"]),jf=h(["padding","left"]),kf=h(["padding","right"]),lf=h(["zoom","enabled"],!1),mf=h(["zoom","extent"]),nf=h(["zoom","privileged"],!1),of=h(["onenter"],function(){}),pf=h(["onleave"],function(){}),qf=h(["transition","duration"],350);g("data","data is required in config");var rf,sf,tf,uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f=h(["data","x"]),ag=h(["data","xs"],{}),bg=h(["data","x_format"]),cg=h(["data","id_converter"],function(a){return a}),dg=h(["data","names"],{}),eg=h(["data","groups"],[]),fg=h(["data","axes"],{}),gg=h(["data","type"]),hg=h(["data","types"],{}),ig=h(["data","labels"],{}),jg=h(["data","order"]),kg=h(["data","regions"],{}),lg=h(["data","color"]),mg=h(["data","colors"],{}),ng=h(["data","selection","enabled"],!1),og=h(["data","selection","grouped"],!1),pg=h(["data","selection","isselectable"],function(){return!0}),qg=h(["data","selection","multiple"],!0),rg=h(["data","onclick"],function(){}),sg=h(["data","onenter"],function(){}),tg=h(["data","onleave"],function(){}),ug=h(["data","onselected"],function(){}),vg=h(["data","onunselected"],function(){}),wg=h(["data","ondragstart"],function(){}),xg=h(["data","ondragend"],function(){}),yg=h(["subchart","show"],!1),zg=yg?h(["subchart","size","height"],60):0,Ag=h(["color","pattern"],[]),Bg=h(["legend","show"],!0),Cg=h(["legend","position"],"bottom"),Dg=h(["legend","item","onclick"]),Eg=h(["legend","equally"],!1),Fg=h(["axis","rotated"],!1),Gg=h(["axis","x","type"],"indexed"),Hg=h(["axis","x","categories"],[]),Ig=h(["axis","x","tick","centered"],!1),Jg=h(["axis","x","tick","format"]),Kg=h(["axis","x","tick","culling"],{}),Lg=h(["axis","x","tick","culling","max"],"categorized"===Gg?1/0:10),Mg=h(["axis","x","tick","count"]),Ng=h(["axis","x","tick","fit"],!1),Og=h(["axis","x","max"]),Pg=h(["axis","x","min"]),Qg=h(["axis","x","default"]),Rg=h(["axis","x","label"],{}),Sg=h(["axis","y","show"],!0),Tg=h(["axis","y","max"]),Ug=h(["axis","y","min"]),Vg=h(["axis","y","center"]),Wg=h(["axis","y","label"],{}),Xg=h(["axis","y","inner"],!1),Yg=h(["axis","y","tick","format"]),Zg=h(["axis","y","padding"],{}),$g=h(["axis","y","ticks"],10),_g=h(["axis","y2","show"],!1),ah=h(["axis","y2","max"]),bh=h(["axis","y2","min"]),ch=h(["axis","y2","center"]),dh=h(["axis","y2","label"],{}),eh=h(["axis","y2","inner"],!1),fh=h(["axis","y2","tick","format"]),gh=h(["axis","y2","padding"],{}),hh=h(["axis","y2","ticks"],10),ih=h(["grid","x","show"],!1),jh=h(["grid","x","type"],"tick"),kh=h(["grid","x","lines"],[]),lh=h(["grid","y","show"],!1),mh=h(["grid","y","lines"],[]),nh=h(["grid","y","ticks"],10),oh=h(["point","show"],!0),ph=oh?h(["point","r"],2.5):0,qh=h(["point","focus","line","enabled"],!0),rh=h(["point","focus","expand","enabled"],!0),sh=h(["point","focus","expand","r"],rh?4:ph),th=h(["point","focus","select","r"],8),uh=h(["bar","width"]),vh=h(["bar","width","ratio"],.6),wh=h(["pie","label","show"],!0),xh=h(["pie","label","format"]),yh=h(["pie","onclick"],function(){}),zh=h(["pie","onmouseover"],function(){}),Ah=h(["pie","onmouseout"],function(){}),Bh=h(["donut","label","show"],!0),Ch=h(["donut","label","format"]),Dh=h(["donut","title"],""),Eh=h(["donut","onclick"],function(){}),Fh=h(["donut","onmouseover"],function(){}),Gh=h(["donut","onmouseout"],function(){}),Hh=h(["regions"],[]),Ih=h(["tooltip","show"],!0),Jh=h(["tooltip","format","title"]),Kh=h(["tooltip","format","value"]),Lh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Jh?Jh:b,l=Kh?Kh: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+""}),Mh=h(["tooltip","init","show"],!1),Nh=h(["tooltip","init","x"],0),Oh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Ph=("string"==typeof ff?ff.replace("#",""):ff.id)+"-clip",Qh=Ph+"-xaxis",Rh=Ph+"-yaxis",Sh=i(Ph),Th=i(Th),Uh=i(Uh),Vh="timeseries"===Gg,Wh="categorized"===Gg,Xh=!Vh&&(_f||fe(ag)),Yh=null,Zh=!1,$h=!1,_h=!1,ai=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bi=ae(mg,fe(Ag)?Ag:ai,lg),ci=function(){var a=[[cf.time.format("%Y/%-m/%-d"),function(){return!0}],[cf.time.format("%-m/%-d"),function(a){return a.getMonth()}],[cf.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[cf.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[cf.time.format("%I %p"),function(a){return a.getHours()}],[cf.time.format("%I:%M"),function(a){return a.getMinutes()}],[cf.time.format(":%S"),function(a){return a.getSeconds()}],[cf.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)}}(),di=[],ei=[],fi=Fg?"left":"bottom",gi=Fg?Xg?"top":"bottom":Xg?"right":"left",hi=Fg?eh?"bottom":"top":eh?"left":"right",ii=Fg?"left":"bottom",ji={main:function(){return"translate("+rf.left+","+rf.top+")"},context:function(){return"translate("+sf.left+","+sf.top+")"},legend:function(){return"translate("+tf.left+","+tf.top+")"},x:function(){return"translate(0,"+(Fg?0:wf)+")"},y:function(){return"translate(0,"+(Fg?wf:0)+")"},y2:function(){return"translate("+(Fg?0:uf)+","+(Fg?1:0)+")"},subx:function(){return"translate(0,"+(Fg?0:xf)+")"},arc:function(){return"translate("+uf/2+","+wf/2+")"}},ki="right"===Cg,li=0,mi=0,ni=0,oi=30,pi=30,qi=5;If=cf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var ri,si=function(){var a=cf.svg.line().x(Fg?function(a){return V(a.id)(a.value)}:nd).y(Fg?nd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=pe(b.values);return Sd(b)?(a.interpolate(Td(b)?"cardinal":"linear"),kg[b.id]?Be(e,Rf,V(b.id),kg[b.id]):a(e)):(c=Rf(e[0].x),d=V(b.id)(e[0].value),Fg?"M "+d+" "+c:"M "+c+" "+d)}}(),ti=function(){var a;return a=Fg?cf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(nd):cf.svg.area().x(nd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=pe(b.values);return Md([b],"area")||Md([b],"area-spline")?(a.interpolate(Td(b)?"cardinal":"linear"),a(e)):(c=Rf(e[0].x),d=V(b.id)(e[0].value),Fg?"M "+d+" "+c:"M "+c+" "+d)}}(),ui=function(){var a=cf.svg.line().x(Fg?function(a){return W(a.id)(a.value)}:qd).y(Fg?qd:function(a){return W(a.id)(a.value)});return function(b){var c=pe(b.values);return Sd(b)?a(c):"M "+Uf(c[0].x)+" "+W(b.id)(c[0].value)}}(),vi=function(){};ri=cf.svg.brush().on("brush",Ke),ri.update=function(){return zi&&zi.select("."+f.brush).call(this),this},ri.scale=function(a){return Fg?this.y(a):this.x(a)},lf&&(vi=cf.behavior.zoom().on("zoomstart",function(){vi.altDomain=cf.event.sourceEvent.altKey?Rf.orgDomain():null}).on("zoom",lf?Le:null),vi.scale=function(a){return Fg?this.y(a):this.x(a)},vi.orgScaleExtent=function(){var a=mf?mf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},vi.updateScaleExtent=function(){var a=$b(Rf.orgDomain())/$b(Di),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wi,xi,yi,zi,Ai,Bi,Ci,Di,Ei,Fi={};if(df.focus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=wi.selectAll(ad(a)),d=c.filter($e),e=c.filter(_e);df.revert(),df.defocus(),b(d.classed(f.focused,!0)),b(e),Rd(df.data.targets)&&Kb(a,!0),Ue(a)},df.defocus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",.3)}var c=wi.selectAll(ad(a)),d=c.filter($e),e=c.filter(_e);df.revert(),b(d.classed(f.focused,!1)),b(e),Rd(df.data.targets)&&Lb(a),Ve(a)},df.revert=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=wi.selectAll(ad(a)),d=c.filter($e),e=c.filter(_e);b(d.classed(f.focused,!1)),b(e),Rd(df.data.targets)&&Lb(a),We()},df.show=function(a,b){a=wc(a),b=b||{},Fc(a),wi.selectAll(bd(a)).transition().style("opacity",1),b.withLegend&&Ye(a),Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},df.hide=function(a,b){a=wc(a),b=b||{},Ec(a),wi.selectAll(bd(a)).transition().style("opacity",0),b.withLegend&&Ye(a),Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},df.toggle=function(a){zc(a)?df.hide(a):df.show(a)},df.unzoom=function(){ri.clear().update(),Je({withUpdateXDomain:!0})},df.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Wh&&(Hg=a.categories,Xf.categories(Hg)),"cacheIds"in a&&_b(a.cacheIds)?void Qe(bc(a.cacheIds),a.done):void("unload"in a?Se(wc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Re(a)}):Re(a))},df.unload=function(a){Se(wc(a),function(){Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},df.selected=function(a){return cf.merge(yi.selectAll("."+f.shapes+_c(a)).selectAll("."+f.shape).filter(function(){return cf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},df.select=function(a,b,c){ng&&yi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=cf.select(this),i="circle"===this.nodeName?je:me,j="circle"===this.nodeName?ke:ne,k=og||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?pg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},df.unselect=function(a,b){ng&&yi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=cf.select(this),g="circle"===this.nodeName?ke:ne,h=og||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&pg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},df.toLine=function(a){bf(a,"line")},df.toSpline=function(a){bf(a,"spline")},df.toBar=function(a){bf(a,"bar")},df.toScatter=function(a){bf(a,"scatter")},df.toArea=function(a){bf(a,"area")},df.toAreaSpline=function(a){bf(a,"area-spline")},df.toPie=function(a){bf(a,"pie",{withTransform:!0})},df.toDonut=function(a){bf(a,"donut",{withTransform:!0})},df.groups=function(a){return c(a)?eg:(eg=a,Je(),eg)},df.xgrids=function(a){return a?(kh=a,Je(),kh):kh},df.xgrids.add=function(a){return a?df.xgrids(kh.concat(a)):void 0},df.xgrids.remove=function(a){var b=af(a);return df.xgrids(kh.filter(b))},df.ygrids=function(a){return a?(mh=a,Je(),mh):mh},df.ygrids.add=function(a){return a?df.ygrids(mh.concat(a)):void 0},df.ygrids.remove=function(a){var b=af(a);return df.ygrids(mh.filter(b))},df.regions=function(a){return c(a)?Hh:(Hh=a,Je(),Hh)},df.regions.add=function(a){return c(a)?Hh:(Hh=Hh.concat(a),Je(),Hh)},df.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;wi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Hh=Hh.filter(function(b){return b.classes.indexOf(a)<0})}),Hh},df.data.get=function(a){var b=df.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},df.data.getAsTarget=function(a){var b=yc(function(b){return b.id===a});return b.length>0?b[0]:void 0},df.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){dg[b]=a[b]}),Ze(vc(df.data.targets),{withTransition:!0}),dg):dg},df.x=function(a){return arguments.length&&(kc(df.data.targets,a),Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),df.data.x},df.xs=function(a){return arguments.length&&(lc(df.data.targets,a),Je({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),df.data.x},df.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},df.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Tg=+a.y),b(a.y2)&&(ah=+a.y2)):Tg=ah=+a,Je())},df.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ug=+a.y),b(a.y2)&&(bh=+a.y2)):Ug=bh=+a,Je())},df.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&df.axis.max(a.max),"undefined"!=typeof a.min&&df.axis.min(a.min)) -},df.legend.show=function(a){Bg&&(Xe(wc(a)),Je({withTransitionForHorizontalAxis:!1}))},df.legend.hide=function(a){Bg&&(Ye(wc(a)),Je({withTransitionForHorizontalAxis:!1}))},df.resize=function(a){gf=a?a.width:null,hf=a?a.height:null,Oe({withLegend:!0,withTransition:!1})},df.destroy=function(){df.data.targets=void 0,df.data.x={},Ci.html(""),a.onresize=null},"url"in e.data)cf.csv(e.data.url,function(a,b){Ce(b)});else if("rows"in e.data)Ce(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Ce(oc(e.data.columns))}return df},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.28"},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.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;cvf&&(vf=0),0>xf&&(xf=0),tf={top:Eg?sf.top:Af-yg-(ji?0:a),right:0/0,bottom:20+(ji?0:a),left:Eg?ni:sf.left},wf=Eg?sf.left-ni-oi:vf,yf=Eg?xf:Af-tf.top-tf.bottom,0>wf&&(wf=0),0>yf&&(yf=0),uf={top:ji?0:Af-a,right:0/0,bottom:0,left:ji?zf-b:0},p(),ji&&Rd(ef.data.targets)&&(uf.left=vf/2+Cf)}function o(){xi.select("line."+f.xgridFocus).attr("x1",Eg?0:-10).attr("x2",Eg?vf:-10).attr("y1",Eg?-10:sf.top).attr("y2",Eg?-10:xf)}function p(){Cf=xf/2,Bf=.95*Cf,Df=Qd(ef.data.targets)?.6*Bf:0}function q(){var a=Eg?f.axisX:f.axisY,b=df.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=df.select(gf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return hf?hf:x()}function s(){var a=jf?jf:y();return a>0?a:320}function t(){return Rd(ef.data.targets)?0:kf?kf:Eg||!Rg||Wg?1:v("y")}function u(){var a=1;return Rd(ef.data.targets)?0:lf?lf:ji?P()+($g&&!Eg?v("y2"):a):$g?dh||Eg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Rg?"y2"!==a||$g?(gb(a).isInner?30:40)+("y2"===a?-10:0):pi:Ag&&!ji?10:1}function x(){return+df.select(gf).style("width").replace("px","")}function y(){return+df.select(gf).style("height").replace("px","")}function z(a){return a?-5:-(sf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Eg)}function C(){return A(!Eg)}function D(){return z(Eg)}function E(){return A(Eg)}function F(a){return a?vf+2+4:sf.left+20}function G(a){return a?80:xf+2}function H(){return F(!Eg)}function I(){return G(!Eg)}function J(){return F(Eg)}function K(){return G(Eg)}function L(){var a=Eg?xf:vf,b=tc(),c=Vb()*(Nd(ef.data.targets)?(b-(Vh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){ki=a}function N(a){li=a}function O(a){mi=a}function P(){return Ag?ji?li*(ki+1):zf:0}function Q(){return Ag?ji?Af:mi*(ki+1):0}function R(){var a,b=!Qf;If=Eg?1:0,Jf=Eg?xf:vf,Kf=Eg?0:xf,Lf=Eg?vf:1,Mf=If,Nf=Jf,Of=Eg?0:yf,Pf=Eg?wf:1,Qf=T(If,Jf,b?void 0:Qf.domain(),function(){return Wf.tickOffset()}),Rf=U(Kf,Lf),Sf=U(Kf,Lf),Tf=T(If,Jf,Ci,function(a){return a%1?0:Zf.tickOffset()}),Uf=U(Of,Pf),Vf=U(Of,Pf),a=$(),Wf=X(Qf,ei,a),Zf=X(Tf,hi,a),Xf=Y(Rf,fi,Xg,Zg),Yf=Y(Sf,gi,eh,gh),b||(qi.scale(Tf),mf&&ui.scale(Qf)),S()}function S(){Ef=Db(),Ff=Eb(),Gf=Eb(.98)}function T(a,b,e,f){var g=(Uh?df.time.scale():df.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Vh){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 U(a,b){return df.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Sf:Rf}function W(a){return"y2"===Z(a)?Vf:Uf}function X(a,b,c){var d=(Vh?Bb():df.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Vh?d.tickCentered(Hg):d.tickOffset=function(){var a=Eg?xf:vf;return a*Vb()/tc()/2},Vh&&d.categories(Gg),d}function Y(a,b,c,d){return df.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in eg?eg[a]:"y"}function $(){var a=Uh?bi:Vh?Mc:function(a){return 0>a?a.toFixed(0):a};return Ig&&("function"==typeof Ig?a=Ig:Uh&&(a=function(a){return df.time.format(Ig)(a)})),a}function _(a){var b;return"y"===a?b=Vg:"y2"===a?b=ch:"x"===a&&(b=Qg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Vg=b:"y2"===a?ch=b:"x"===a&&(Qg=b):c&&(c.text=b)}function cb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function db(){return cb("x",Eg?"inner-top":"inner-right")}function eb(){return cb("y",Eg?"inner-right":"inner-top")}function fb(){return cb("y2",Eg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?vf/2:vf:b.isBottom?-xf:b.isMiddle?-xf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Eg,db())}function ob(){return kb(Eg,eb())}function pb(){return kb(Eg,fb())}function qb(){return lb(!Eg,db())}function rb(){return lb(Eg,eb())}function sb(){return lb(Eg,fb())}function tb(){var a=db();return Eg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Eg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Eg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Eg,db())}function xb(){return mb(Eg,eb())}function yb(){return mb(Eg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return df.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){xi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),xi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),xi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){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=Kc(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 df.min(Object.keys(i).map(function(a){return df.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=vc(a),i=Ic(a);if(dg.length>0)for(g=Lc(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 df.max(Object.keys(i).map(function(a){return df.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ah:Tg,n="y2"===c?_g:Sg,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?bh:Ug,r=id()&&Eg;return 0===l.length?"y2"===c?Sf.domain():Rf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=jd(o,p),j=$b(Rf.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Yg&&(f=b(Yg.top)?Yg.top:e,g=b(Yg.bottom)?Yg.bottom:e),"y2"===c&&fh&&(f=b(fh.top)?fh.top:e,g=b(fh.bottom)?fh.bottom:e),Nd(l)&&!Kc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ci),c=$b(Qf.domain());return a||0===c?1:b/c}function Wb(a){return Og?Og:df.min(a,function(a){return df.min(a.values,function(a){return a.x})})}function Xb(a){return Ng?Ng:df.max(a,function(a){return df.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Vh?d=0:Nd(a)?(c=tc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Uh?new Date(c.getTime()-e):c-e,g=Uh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return $f&&a===$f||ge(_f)&&he(_f,a)}function fc(a){return!ec(a)}function gc(a){return $f?$f:ge(_f)?_f[a]:null}function hc(a,b){return a in ef.data.x&&ef.data.x[a]&&ef.data.x[a][b]?ef.data.x[a][b]:b}function ic(a){Object.keys(a).forEach(function(b){_f[b]=a[b]})}function jc(a){var b;return a&&(b=cg[a.id],a.name=b?b:a.id),a}function kc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=mc(b[d],a.id,d)}),ef.data.x[a.id]=b})}function lc(a,b){a.forEach(function(a){b[a.id]&&kc([a],b[a.id])})}function mc(a,b,c){var d;return d=Uh?a?a instanceof Date?a:be(a):be(hc(b,c)):Wh&&!Vh?a?+a:hc(b,c):c}function nc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0&&(ef.data.x[b]=a.map(function(a){return a[c]})):ef.data.x[b]=a.map(function(a,b){return b})}),c.forEach(function(a){if(!ef.data.x[a])throw new Error('x is not defined for id = "'+a+'".')}),b=c.map(function(b,c){var d=bg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=mc(g,b,e);return Wh&&Vh&&0===c&&g&&(0===e&&(Gg=[]),Gg.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++})}),fg&&Ld(vc(b).filter(function(a){return!(a in gg)}),fg),b.forEach(function(a){ac(a.id_org,a)}),b}function qc(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 rc(a){return a>0&&ef.data.targets[0].values[a-1]?ef.data.targets[0].values[a-1].x:void 0}function sc(a){return a1?ef.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?ef.data.targets[0]:null,a}function vc(a){return a.map(function(a){return a.id})}function wc(a){return a?"string"==typeof a?[a]:a:vc(ef.data.targets)}function xc(a,b){var c,d=vc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Uh?new Date(h):h);i.push(d)}return i}function Ec(a){ci=ci.concat(a)}function Fc(a){ci=ci.filter(function(b){return a.indexOf(b)<0})}function Gc(a){di=di.concat(a)}function Hc(a){di=di.filter(function(b){return a.indexOf(b)<0})}function Ic(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Jc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Lc(a){return Jc(a,function(a){return a>0})}function Mc(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(rd(a,f))),a[g].x&&(e=e.concat(rd(a,g))),ud(e,b)):sd(a,b,f,g)}function td(a,b){var c;return c=a.map(function(a){return sd(a.values,b)}),ud(c,b)}function ud(a,b){var c,d;return a.forEach(function(a){var e=ie(a,b);(c>e||!c)&&(c=e,d=a)}),d}function vd(a,b){return df.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function wd(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 xd(){return ig&&"desc"===ig.toLowerCase()}function yd(){return ig&&"asc"===ig.toLowerCase()}function zd(a){var b=yd(),c=xd();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 ig&&a.sort(ig),a}function Ad(a,c){var d,e,f,g,h,i,j,k=Rd(ef.data.targets),l=k?ld:kd,m=a.filter(function(a){return a&&b(a.value)});Hh&&0!==m.length&&(Ai.html(Kh(a,$(),l,ai)).style("display","block"),d=Ai.property("offsetWidth"),e=Ai.property("offsetHeight"),k?(g=vf/2+c[0],i=xf/2+c[1]+20):(Eg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Qf(m[0].x)+20):(f=q(),g=f+t()+Qf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ai.style("top",i+"px").style("left",g+"px"))}function Bd(){Ai.style("display","none")}function Cd(a){var c=a.filter(function(a){return a&&b(a.value)});Hh&&(Od(ef.data.targets)||Rd(ef.data.targets)||xi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Eg?"y1":"x1",nd).attr(Eg?"y2":"x2",nd))}function Dd(){xi.select("line."+f.xgridFocus).style("visibility","hidden")}function Ed(a){return a.x||0===a.x?Qf(a.x):null}function Fd(a){return V(a.id)(a.value)}function Gd(){var a,b,d={},e=0;return Bc(yc(Ud)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Kd(a,b){return th?th:b?2*a.tickOffset()*uh/b:0}function Ld(a,b){wc(a).forEach(function(a){Ei[a]=b===gg[a],gg[a]=b})}function Md(a,b){var c=!1;return a.forEach(function(a){gg[a.id]===b&&(c=!0),a.id in gg||"line"!==b||(c=!0)}),c}function Nd(a){return Md(a,"bar")}function Od(a){return Md(a,"scatter")}function Pd(a){return Md(a,"pie")}function Qd(a){return Md(a,"donut")}function Rd(a){return Pd(a)||Qd(a)}function Sd(a){var b="string"==typeof a?a:a.id;return!(b in gg)||"line"===gg[b]||"spline"===gg[b]||"area"===gg[b]||"area-spline"===gg[b]}function Td(a){var b="string"==typeof a?a:a.id;return"spline"===gg[b]||"area-spline"===gg[b]}function Ud(a){var b="string"==typeof a?a:a.id;return"bar"===gg[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"scatter"===gg[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"pie"===gg[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"donut"===gg[b]}function Yd(a){return Wd(a)||Xd(a)}function Zd(a){return Ud(a)?a.values:[]}function $d(a){return Sd(a)||Vd(a)?a.values:[]}function _d(a){return Ud(a)||Sd(a)?a.values:[]}function ae(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function be(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+ag+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=ag?df.time.format(ag).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+ag),c}function ce(a,b){var c=df.mouse(a),d=df.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function he(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ie(a,b){var c="y"===Z(a.id)?Rf:Sf,d=Eg?1:0,e=Eg?0:1;return Math.pow(Qf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function je(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function ke(a,b,c){tg(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Nc(f.selectedCircle,c)}).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd).attr("stroke",function(){return ai(b)}).attr("r",1.4*sh).transition().duration(100).attr("r",sh)}function le(a,b,c){ug(b,a.node()),xi.select("."+f.selectedCircles+_c(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function me(a,b,c,d){a?ke(b,c,d):le(b,c,d)}function ne(a,b){tg(b,a.node()),a.transition().duration(100).style("fill",function(){return df.rgb(ai(b)).darker(1)})}function oe(a,b){ug(b,a.node()),a.transition().duration(100).style("fill",function(){return ai(b)})}function pe(a,b,c,d){a?ne(b,c,d):oe(b,c,d)}function qe(a){return a.filter(function(a){return b(a.value)})}function re(a,c){return(c?xi.selectAll("."+f.circles+_c(c)):xi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function se(a,b){re(a,b).classed(f.EXPANDED,!0).attr("r",rh)}function te(a){re(a).filter(function(){return df.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",oh)}function ue(a){return xi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function ve(a){ue(a).classed(f.EXPANDED,!0)}function we(a){ue(a).classed(f.EXPANDED,!1)}function xe(a,b){var c=Be(a,b);return function(a,b){var d=c(a,b),e=Eg?1:0,f=Eg?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function ye(a,b){var c=Be(a,!1),d=b?ze:Ae;return function(a,b){return d(c(a,b),a,this)}}function ze(a,b){var c;return Eg?(c=Ud(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ae(a,b,c){var d=c.getBBox();return Eg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Ud(b)?-3:-6)}function Be(a,b){var c=a.__max__+1,d=Kd(Wf,c),e=Hd(d,c,a,!!b),f=Id(!!b),g=Jd(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Eg&&(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 Ce(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 De(b){var c,d,e;if(Bi=df.select(gf),Bi.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Bi.html(""),Bi.classed("c3",!0),ef.data.x={},ef.data.targets=pc(b),n(),R(),Qf.domain(df.extent(Zb(ef.data.targets))),Rf.domain(Ub(ef.data.targets,"y")),Sf.domain(Ub(ef.data.targets,"y2")),Tf.domain(Qf.domain()),Uf.domain(Rf.domain()),Vf.domain(Sf.domain()),Ci=Qf.domain(),qi.scale(Tf),mf&&ui.scale(Qf),vi=Bi.append("svg").attr("width",vf+sf.left+sf.right).attr("height",xf+sf.top+sf.bottom).on("mouseenter",pf).on("mouseleave",qf),wi=vi.append("defs"),wi.append("clipPath").attr("id",Oh).append("rect").attr("width",vf).attr("height",xf),wi.append("clipPath").attr("id",Ph).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),wi.append("clipPath").attr("id",Qh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),xi=vi.append("g").attr("transform",ii.main),yi=xg?vi.append("g").attr("transform",ii.context):null,zi=vi.append("g").attr("transform",ii.legend),Ag||(zi.style("visibility","hidden"),di=vc(ef.data.targets)),Ai=df.select(gf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),$e(vc(ef.data.targets),{withTransform:!1,withTransitionForTransform:!1}),xi.append("g").attr("class",f.axisX).attr("clip-path",Eg?"":Sh).attr("transform",ii.x).append("text").attr("class",f.axisXLabel).attr("transform",Eg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Rg&&xi.append("g").attr("class",f.axisY).attr("clip-path",Eg?Th:"").attr("transform",ii.y).append("text").attr("class",f.axisYLabel).attr("transform",Eg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),$g&&xi.append("g").attr("class",f.axisY2).attr("transform",ii.y2).append("text").attr("class",f.axisY2Label).attr("transform",Eg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=xi.append("g").attr("clip-path",Rh).attr("class",f.grid),hh&&d.append("g").attr("class",f.xgrids),ge(jh)&&d.append("g").attr("class",f.xgridLines),ph&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),kh&&d.append("g").attr("class",f.ygrids),ge(lh)&&d.append("g").attr("class",f.ygridLines),xi.append("g").attr("clip-path",Rh).attr("class",f.regions),xi.append("g").attr("clip-path",Rh).attr("class",f.chart),c=xi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",mf?Eg?"ns-resize":"ew-resize":null),xi.select("."+f.chart).append("g").attr("class",f.chartBars),xi.select("."+f.chart).append("g").attr("class",f.chartLines),xi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ii.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),xi.select("."+f.chart).append("g").attr("class",f.chartTexts),mf&&xi.insert("rect",of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",vf).attr("height",xf).style("opacity",0).style("cursor",Eg?"ns-resize":"ew-resize").call(ui).on("dblclick.zoom",null),Pg&&qi.extent("function"!=typeof Pg?Pg:Pg(Zb())),xg&&(yi.append("g").attr("clip-path",Rh).attr("class",f.chart),yi.select("."+f.chart).append("g").attr("class",f.chartBars),yi.select("."+f.chart).append("g").attr("class",f.chartLines),yi.append("g").attr("clip-path",Rh).attr("class",f.brush).call(qi).selectAll("rect").attr(Eg?"width":"height",Eg?wf:yf),yi.append("g").attr("class",f.axisX).attr("transform",ii.subx).attr("clip-path",Eg?"":Sh)),Qe(ef.data.targets),Eg?xi.select("."+f.axisX).style("opacity",0).call(Wf):(xi.select("."+f.axisY).style("opacity",0).call(Xf),xi.select("."+f.axisY2).style("opacity",0).call(Yf)),Ke({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Lh){if(Uh&&"string"==typeof Mh){for(Mh=be(Mh),e=0;e0){d=[];for(var g in cg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=wd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=pe,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 Ie(a){Rd(ef.data.targets)||mg&&(Xh=a,xi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Yh=!0,vg())}function Je(){Rd(ef.data.targets)||mg&&(xi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),xi.selectAll("."+f.shape).classed(f.INCLUDED,!1),Yh=!1,wg())}function Ke(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S=Gd(),T=Rd(ef.data.targets),U=Bc(ef.data.targets);if(0!==U.length){if(a=d(a)?a:{},x=d(a.withY)?a.withY:!0,y=d(a.withSubchart)?a.withSubchart:!0,z=d(a.withTransition)?a.withTransition:!0,D=d(a.withTransform)?a.withTransform:!1,E=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,F=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,G=d(a.withLegend)?a.withLegend:!1,A=d(a.withTransitionForExit)?a.withTransitionForExit:z,B=d(a.withTransitionForAxis)?a.withTransitionForAxis:z,C=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:z,M=z?rf:0,N=A?M:0,O=B?M:0,G&&Ag&&$e(vc(ef.data.targets),a),F&&(Qf.domain(df.extent(Zb(U))),Ci=Qf.domain(),mf&&ui.scale(Qf).updateScaleExtent(),Tf.domain(Qf.domain()),qi.scale(Tf)),E&&(Qf.domain(qi.empty()?Ci:qi.extent()),mf&&ui.scale(Qf).updateScaleExtent()),Rf.domain(Ub(U,"y")),Sf.domain(Ub(U,"y2")),Od(U)||(P=Dc(Cc(U)).sort(),Wf.tickValues(P),Zf.tickValues(P)),c=xi.select("."+f.axisX).style("opacity",T?0:1),(Eg||C)&&(c=c.transition().duration(O)),c.call(Wf),e=xi.select("."+f.axisY).style("opacity",T?0:1),(!Eg||C)&&(e=e.transition().duration(O)),e.call(Xf),xi.select("."+f.axisY2).style("opacity",T?0:1).transition().duration(O).call(Yf),E&&Jg&&P){for(Q=1;Q=Y;Y++)h.push(new Date(Y+"-01-01 00:00:00"))}else h=Qf.ticks(10);g=xi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Eg?0:function(a){return Qf(a)-Wf.tickOffset()}).attr("x2",Eg?vf:function(a){return Qf(a)-Wf.tickOffset()}).attr("y1",Eg?function(a){return Qf(a)-Wf.tickOffset()}:sf.top).attr("y2",Eg?function(a){return Qf(a)-Wf.tickOffset()}:xf).style("opacity",function(){return+df.select(this).attr(Eg?"y1":"x1")===(Eg?xf:0)?0:1}),g.exit().remove()}ge(jh)&&(i=xi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(jh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Eg?"":"rotate(-90)").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(M).attr("x1",Eg?0:od).attr("x2",Eg?vf:od).attr("y1",Eg?od:sf.top).attr("y2",Eg?od:xf).style("opacity",1),i.select("text").transition().duration(M).attr("x",Eg?vf:0).attr("y",od).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(M).style("opacity",0).remove()),x&&kh&&(k=xi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Rf.ticks(mh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Eg?Rf:0).attr("x2",Eg?Rf:vf).attr("y1",Eg?0:Rf).attr("y2",Eg?xf:Rf),k.exit().remove()),x&&ge(lh)&&(l=xi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(lh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Eg?"rotate(-90)":"").attr("dx",Eg?0:-sf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(M).attr("x1",Eg?pd:0).attr("x2",Eg?pd:vf).attr("y1",Eg?0:pd).attr("y2",Eg?xf:pd).style("opacity",1),l.select("text").transition().duration(M).attr("x",Eg?0:vf).attr("y",pd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(M).style("opacity",0).remove()),p=xi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),p.enter().append("path").attr("d",H).style("stroke","none").style("opacity",0).style("fill",function(a){return ai(a)}).attr("class",Vc),p.style("opacity",ed).transition().duration(M).attr("d",H).style("opacity",1),p.exit().transition().duration(N).style("opacity",0).remove(),r=xi.selectAll("."+f.texts).selectAll("."+f.text).data(_d),r.enter().append("text").attr("class",Oc).attr("text-anchor",function(a){return Eg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return md(a.id)(a.value)}).style("fill-opacity",fd).transition().duration(M).attr("x",J).attr("y",K).style("fill-opacity",hd),r.exit().transition().duration(N).style("fill-opacity",0).remove(),xi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ri).style("opacity",1),xi.selectAll("."+f.area).style("opacity",0).transition().duration(M).attr("d",si).style("opacity",Di),n=xi.selectAll("."+f.circles).selectAll("."+f.circle).data($d),n.enter().append("circle").attr("class",Tc).style("opacity",0).attr("r",oh),n.style("opacity",ed).transition().duration(M).style("opacity",gd).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),n.exit().remove(),xi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",D?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(M).attrTween("d",function(a){var b,c=Cb(a);return c?(b=df.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",D?"scale(1)":"").style("opacity",1),xi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(M).text(Jb).style("opacity",function(a){return zc(a.data.id)&&Yd(a.data)?1:0}),xi.select("."+f.chartArcsTitle).style("opacity",Qd(ef.data.targets)?1:0),xg&&(null!==df.event&&"zoom"===df.event.type&&qi.extent(Qf.orgDomain()).update(),y&&(yi.select("."+f.axisX).style("opacity",T?0:1).transition().duration(M).call(Zf),qi.empty()||qi.extent(Qf.orgDomain()).update(),I=xe(S,!0),s=yi.selectAll("."+f.bars).selectAll("."+f.bar).data(Zd),s.enter().append("path").attr("d",I).style("stroke","none").style("fill",function(a){return ai(a)}).attr("class",Vc),s.style("opacity",ed).transition().duration(M).attr("d",I).style("opacity",1),s.exit().transition().duration(M).style("opacity",0).remove(),yi.selectAll("."+f.line).style("opacity",ed).transition().duration(M).attr("d",ti).style("opacity",1))),xi.selectAll("."+f.selectedCircles).filter(function(a){return Ud(a)}).selectAll("circle").remove(),xi.selectAll("."+f.selectedCircle).transition().duration(M).attr("cx",Eg?Fd:Ed).attr("cy",Eg?Ed:Fd),ge(_f)?(t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Fe(t.enter()),t.attr("x",0).attr("y",0).attr("width",vf).attr("height",xf)):(Wh&&!Vh?(w=function(a,b){var c=rc(b),d=sc(b),e=ef.data.x[a.id][b];return(Qf(d?d:e+50)-Qf(c?c:e-50))/2},v=function(a,b){var c=rc(b),d=ef.data.x[a.id][b];return(Qf(d)+Qf(c?c:d-50))/2}):(w=L(),v=function(a){return Qf(a.x)-w/2}),u=uc(),xi.select("."+f.eventRects).datum(u?u.values:[]),t=xi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ee(t.enter()),t.attr("class",$c).attr("x",Eg?0:v).attr("y",Eg?v:0).attr("width",Eg?vf:w).attr("height",Eg?w:xf),t.exit().remove()),q=xi.select("."+f.regions).selectAll("rect."+f.region).data(Gh),q.enter().append("rect").style("fill-opacity",0),q.attr("class",Zc).attr("x",Eg?0:cc).attr("y",Eg?cc:sf.top).attr("width",Eg?vf:dc).attr("height",Eg?dc:xf).transition().duration(M).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(M).style("fill-opacity",0).remove(),vc(ef.data.targets).forEach(function(a){Ei[a]=!0})}}function Le(){Ke({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Me(){return"mousemove"===df.event.sourceEvent.type&&ui.altDomain?(Qf.domain(ui.altDomain),void ui.scale(Qf).updateScaleExtent()):(Vh&&Qf.orgDomain()[0]===Ci[0]&&Qf.domain([Ci[0]-1e-10,Qf.orgDomain()[1]]),Ke({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===df.event.sourceEvent.type&&(Zh=!0)))}function Ne(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Oe(){vi.attr("width",zf).attr("height",Af),vi.select("#"+Oh).select("rect").attr("width",vf).attr("height",xf),vi.select("#"+Ph).select("rect").attr("width",H),vi.select("#"+Qh).select("rect").attr("width",J),vi.select("."+f.zoomRect).attr("width",vf).attr("height",xf)}function Pe(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Oe(),m(a.withTransition),Ke(a)}function Qe(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=xi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Nc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Pc).style("fill",function(a){return ai(a)}),e=xi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}).style("stroke","none").style("cursor",function(a){return og(a)?"pointer":null}),c=xi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)}),b.append("path").attr("class",Yc).style("opacity",function(){return Di=+df.select(this).style("opacity"),0}).style("fill",function(a){return ai(a)}),b.append("g").attr("class",function(a){return Nc(f.selectedCircles,a.id)}),b.append("g").attr("class",Uc).style("fill",function(a){return ai(a)}).style("cursor",function(a){return og(a)?"pointer":null}),a.forEach(function(a){xi.selectAll("."+f.selectedCircles+_c(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=xi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Hf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Nc(f.target,a.data.id)}),g.append("path").attr("class",Xc).style("opacity",0).style("fill",function(a){return ai(a.data)}).style("cursor",function(a){return og(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Ve(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Ad(c,df.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Xe(),Bd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),xg&&(n=yi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Nc(f.target,a.id)}),m.append("g").attr("class",Wc).style("fill",function(a){return ai(a)}),l=yi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Nc(f.target,a.id)}),k.append("path").attr("class",Sc).style("opacity",0).style("stroke",function(a){return ai(a)})),vi.selectAll("."+f.target).filter(function(a){return zc(a.id)}).transition().style("opacity",1)}function Re(a,b){ef.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=ji?j:i,l=ji?Q():P();return d&&(w=0,C=0,t=0,u=0),Ag&&!Ac(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=ji?u:t,void(Dg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,ji?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=zi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Nc(f.legendItem,a)}).style("visibility",function(a){return Ac(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Cg?Cg(a):ef.toggle(a)}).on("mouseover",function(a){ef.focus(a)}).on("mouseout",function(){ef.revert()}),l.append("text").text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",ji?g:-200).attr("y",ji?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",ji?h:-200).attr("y",ji?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ai(a)}).attr("x",ji?g:-200).attr("y",ji?-200:i).attr("width",10).attr("height",10),zi.selectAll("text").data(a).text(function(a){return d(cg[a])?cg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),zi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),zi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Oe(),q&&m(p)}function _e(a){return xc(ef.data.targets,a.id)}function af(a){return"data"in a&&xc(ef.data.targets,a.data.id)}function bf(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function cf(a,b,c){var d=!Rd(ef.data.targets);Ld(a,b),Pe(c?c:{withTransitionForAxis:d})}var df=a.d3?a.d3:a.require?a.require("d3"):void 0,ef={data:{},axis:{},legend:{}},ff={},gf=h(["bindto"],"#chart"),hf=h(["size","width"]),jf=h(["size","height"]),kf=h(["padding","left"]),lf=h(["padding","right"]),mf=h(["zoom","enabled"],!1),nf=h(["zoom","extent"]),of=h(["zoom","privileged"],!1),pf=h(["onenter"],function(){}),qf=h(["onleave"],function(){}),rf=h(["transition","duration"],350);g("data","data is required in config");var sf,tf,uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f=h(["data","x"]),_f=h(["data","xs"],{}),ag=h(["data","x_format"]),bg=h(["data","id_converter"],function(a){return a}),cg=h(["data","names"],{}),dg=h(["data","groups"],[]),eg=h(["data","axes"],{}),fg=h(["data","type"]),gg=h(["data","types"],{}),hg=h(["data","labels"],{}),ig=h(["data","order"]),jg=h(["data","regions"],{}),kg=h(["data","color"]),lg=h(["data","colors"],{}),mg=h(["data","selection","enabled"],!1),ng=h(["data","selection","grouped"],!1),og=h(["data","selection","isselectable"],function(){return!0}),pg=h(["data","selection","multiple"],!0),qg=h(["data","onclick"],function(){}),rg=h(["data","onenter"],function(){}),sg=h(["data","onleave"],function(){}),tg=h(["data","onselected"],function(){}),ug=h(["data","onunselected"],function(){}),vg=h(["data","ondragstart"],function(){}),wg=h(["data","ondragend"],function(){}),xg=h(["subchart","show"],!1),yg=xg?h(["subchart","size","height"],60):0,zg=h(["color","pattern"],[]),Ag=h(["legend","show"],!0),Bg=h(["legend","position"],"bottom"),Cg=h(["legend","item","onclick"]),Dg=h(["legend","equally"],!1),Eg=h(["axis","rotated"],!1),Fg=h(["axis","x","type"],"indexed"),Gg=h(["axis","x","categories"],[]),Hg=h(["axis","x","tick","centered"],!1),Ig=h(["axis","x","tick","format"]),Jg=h(["axis","x","tick","culling"],{}),Kg=h(["axis","x","tick","culling","max"],"categorized"===Fg?1/0:10),Lg=h(["axis","x","tick","count"]),Mg=h(["axis","x","tick","fit"],!1),Ng=h(["axis","x","max"]),Og=h(["axis","x","min"]),Pg=h(["axis","x","default"]),Qg=h(["axis","x","label"],{}),Rg=h(["axis","y","show"],!0),Sg=h(["axis","y","max"]),Tg=h(["axis","y","min"]),Ug=h(["axis","y","center"]),Vg=h(["axis","y","label"],{}),Wg=h(["axis","y","inner"],!1),Xg=h(["axis","y","tick","format"]),Yg=h(["axis","y","padding"],{}),Zg=h(["axis","y","ticks"],10),$g=h(["axis","y2","show"],!1),_g=h(["axis","y2","max"]),ah=h(["axis","y2","min"]),bh=h(["axis","y2","center"]),ch=h(["axis","y2","label"],{}),dh=h(["axis","y2","inner"],!1),eh=h(["axis","y2","tick","format"]),fh=h(["axis","y2","padding"],{}),gh=h(["axis","y2","ticks"],10),hh=h(["grid","x","show"],!1),ih=h(["grid","x","type"],"tick"),jh=h(["grid","x","lines"],[]),kh=h(["grid","y","show"],!1),lh=h(["grid","y","lines"],[]),mh=h(["grid","y","ticks"],10),nh=h(["point","show"],!0),oh=nh?h(["point","r"],2.5):0,ph=h(["point","focus","line","enabled"],!0),qh=h(["point","focus","expand","enabled"],!0),rh=h(["point","focus","expand","r"],qh?4:oh),sh=h(["point","focus","select","r"],8),th=h(["bar","width"]),uh=h(["bar","width","ratio"],.6),vh=h(["pie","label","show"],!0),wh=h(["pie","label","format"]),xh=h(["pie","onclick"],function(){}),yh=h(["pie","onmouseover"],function(){}),zh=h(["pie","onmouseout"],function(){}),Ah=h(["donut","label","show"],!0),Bh=h(["donut","label","format"]),Ch=h(["donut","title"],""),Dh=h(["donut","onclick"],function(){}),Eh=h(["donut","onmouseover"],function(){}),Fh=h(["donut","onmouseout"],function(){}),Gh=h(["regions"],[]),Hh=h(["tooltip","show"],!0),Ih=h(["tooltip","format","title"]),Jh=h(["tooltip","format","value"]),Kh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Ih?Ih:b,l=Jh?Jh: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+""}),Lh=h(["tooltip","init","show"],!1),Mh=h(["tooltip","init","x"],0),Nh=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Oh=("string"==typeof gf?gf.replace("#",""):gf.id)+"-clip",Ph=Oh+"-xaxis",Qh=Oh+"-yaxis",Rh=i(Oh),Sh=i(Sh),Th=i(Th),Uh="timeseries"===Fg,Vh="categorized"===Fg,Wh=!Uh&&($f||ge(_f)),Xh=null,Yh=!1,Zh=!1,$h=!1,_h=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ai=ae(lg,ge(zg)?zg:_h,kg),bi=function(){var a=[[df.time.format("%Y/%-m/%-d"),function(){return!0}],[df.time.format("%-m/%-d"),function(a){return a.getMonth()}],[df.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[df.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[df.time.format("%I %p"),function(a){return a.getHours()}],[df.time.format("%I:%M"),function(a){return a.getMinutes()}],[df.time.format(":%S"),function(a){return a.getSeconds()}],[df.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)}}(),ci=[],di=[],ei=Eg?"left":"bottom",fi=Eg?Wg?"top":"bottom":Wg?"right":"left",gi=Eg?dh?"bottom":"top":dh?"left":"right",hi=Eg?"left":"bottom",ii={main:function(){return"translate("+sf.left+","+sf.top+")"},context:function(){return"translate("+tf.left+","+tf.top+")"},legend:function(){return"translate("+uf.left+","+uf.top+")"},x:function(){return"translate(0,"+(Eg?0:xf)+")"},y:function(){return"translate(0,"+(Eg?xf:0)+")"},y2:function(){return"translate("+(Eg?0:vf)+","+(Eg?1:0)+")"},subx:function(){return"translate(0,"+(Eg?0:yf)+")"},arc:function(){return"translate("+vf/2+","+xf/2+")"}},ji="right"===Bg,ki=0,li=0,mi=0,ni=30,oi=30,pi=5;Hf=df.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var qi,ri=function(){var a=df.svg.line().x(Eg?function(a){return V(a.id)(a.value)}:nd).y(Eg?nd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=qe(b.values);return Sd(b)?(a.interpolate(Td(b)?"cardinal":"linear"),jg[b.id]?Ce(e,Qf,V(b.id),jg[b.id]):a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),si=function(){var a;return a=Eg?df.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(nd):df.svg.area().x(nd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=qe(b.values);return Md([b],"area")||Md([b],"area-spline")?(a.interpolate(Td(b)?"cardinal":"linear"),a(e)):(c=Qf(e[0].x),d=V(b.id)(e[0].value),Eg?"M "+d+" "+c:"M "+c+" "+d)}}(),ti=function(){var a=df.svg.line().x(Eg?function(a){return W(a.id)(a.value)}:qd).y(Eg?qd:function(a){return W(a.id)(a.value)});return function(b){var c=qe(b.values);return Sd(b)?a(c):"M "+Tf(c[0].x)+" "+W(b.id)(c[0].value)}}(),ui=function(){};qi=df.svg.brush().on("brush",Le),qi.update=function(){return yi&&yi.select("."+f.brush).call(this),this},qi.scale=function(a){return Eg?this.y(a):this.x(a)},mf&&(ui=df.behavior.zoom().on("zoomstart",function(){ui.altDomain=df.event.sourceEvent.altKey?Qf.orgDomain():null}).on("zoom",mf?Me:null),ui.scale=function(a){return Eg?this.y(a):this.x(a)},ui.orgScaleExtent=function(){var a=nf?nf:[1,10];return[a[0],Math.max(tc()/a[1],a[1])]},ui.updateScaleExtent=function(){var a=$b(Qf.orgDomain())/$b(Ci),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var vi,wi,xi,yi,zi,Ai,Bi,Ci,Di,Ei={};if(ef.focus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),ef.defocus(),b(d.classed(f.focused,!0)),b(e),Rd(ef.data.targets)&&Kb(a,!0),Ve(a)},ef.defocus=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",.3)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);ef.revert(),b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),We(a)},ef.revert=function(a){function b(a){Bc(a).transition().duration(100).style("opacity",1)}var c=vi.selectAll(ad(a)),d=c.filter(_e),e=c.filter(af);b(d.classed(f.focused,!1)),b(e),Rd(ef.data.targets)&&Lb(a),Xe()},ef.show=function(a,b){a=wc(a),b=b||{},Fc(a),vi.selectAll(bd(a)).transition().style("opacity",1),b.withLegend&&Ye(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.hide=function(a,b){a=wc(a),b=b||{},Ec(a),vi.selectAll(bd(a)).transition().style("opacity",0),b.withLegend&&Ze(a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},ef.toggle=function(a){zc(a)?ef.hide(a):ef.show(a)},ef.unzoom=function(){qi.clear().update(),Ke({withUpdateXDomain:!0})},ef.load=function(a){return a.xs&&ic(a.xs),"categories"in a&&Vh&&(Gg=a.categories,Wf.categories(Gg)),"cacheIds"in a&&_b(a.cacheIds)?void Re(bc(a.cacheIds),a.done):void("unload"in a?Te(wc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Se(a)}):Se(a))},ef.unload=function(a){Te(wc(a),function(){Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},ef.selected=function(a){return df.merge(xi.selectAll("."+f.shapes+_c(a)).selectAll("."+f.shape).filter(function(){return df.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},ef.select=function(a,b,c){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=df.select(this),i="circle"===this.nodeName?ke:ne,j="circle"===this.nodeName?le:oe,k=ng||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?og(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},ef.unselect=function(a,b){mg&&xi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=df.select(this),g="circle"===this.nodeName?le:oe,h=ng||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&og(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},ef.toLine=function(a){cf(a,"line")},ef.toSpline=function(a){cf(a,"spline")},ef.toBar=function(a){cf(a,"bar")},ef.toScatter=function(a){cf(a,"scatter")},ef.toArea=function(a){cf(a,"area")},ef.toAreaSpline=function(a){cf(a,"area-spline")},ef.toPie=function(a){cf(a,"pie",{withTransform:!0})},ef.toDonut=function(a){cf(a,"donut",{withTransform:!0})},ef.groups=function(a){return c(a)?dg:(dg=a,Ke(),dg)},ef.xgrids=function(a){return a?(jh=a,Ke(),jh):jh},ef.xgrids.add=function(a){return a?ef.xgrids(jh.concat(a)):void 0},ef.xgrids.remove=function(a){var b=bf(a);return ef.xgrids(jh.filter(b))},ef.ygrids=function(a){return a?(lh=a,Ke(),lh):lh},ef.ygrids.add=function(a){return a?ef.ygrids(lh.concat(a)):void 0},ef.ygrids.remove=function(a){var b=bf(a);return ef.ygrids(lh.filter(b))},ef.regions=function(a){return c(a)?Gh:(Gh=a,Ke(),Gh)},ef.regions.add=function(a){return c(a)?Gh:(Gh=Gh.concat(a),Ke(),Gh)},ef.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;vi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Gh=Gh.filter(function(b){return b.classes.indexOf(a)<0})}),Gh},ef.data.get=function(a){var b=ef.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},ef.data.getAsTarget=function(a){var b=yc(function(b){return b.id===a});return b.length>0?b[0]:void 0},ef.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){cg[b]=a[b]}),$e(vc(ef.data.targets),{withTransition:!0}),cg):cg},ef.x=function(a){return arguments.length&&(kc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.xs=function(a){return arguments.length&&(lc(ef.data.targets,a),Ke({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),ef.data.x},ef.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},ef.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Sg=+a.y),b(a.y2)&&(_g=+a.y2)):Sg=_g=+a,Ke())},ef.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Tg=+a.y),b(a.y2)&&(ah=+a.y2)):Tg=ah=+a,Ke()) +},ef.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&ef.axis.max(a.max),"undefined"!=typeof a.min&&ef.axis.min(a.min))},ef.legend.show=function(a){Ag||(Ag=!0,zi.style("visibility","visible")),Ye(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.legend.hide=function(a){Ag&&fe(a)&&(Ag=!1,zi.style("visibility","hidden")),Ze(wc(a)),Ke({withTransitionForHorizontalAxis:!1})},ef.resize=function(a){hf=a?a.width:null,jf=a?a.height:null,Pe({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},ef.destroy=function(){ef.data.targets=void 0,ef.data.x={},Bi.html(""),a.onresize=null},"url"in e.data)df.csv(e.data.url,function(a,b){De(b)});else if("rows"in e.data)De(nc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");De(oc(e.data.columns))}return ef},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file