diff --git a/c3.js b/c3.js index c624edc..66209db 100644 --- a/c3.js +++ b/c3.js @@ -3095,7 +3095,7 @@ var mainCircle, mainBar, mainRegion, mainText, contextBar, eventRect, eventRectUpdate; var barIndices = getBarIndices(), maxDataCountTarget; var rectX, rectW; - var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransitionForHorizontalAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; + var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; var hideAxis = hasArcType(c3.data.targets); var drawBar, drawBarOnSub, xForText, yForText; var transitions, duration, durationForExit, durationForAxis; @@ -3112,16 +3112,15 @@ withTransitionForExit = isDefined(options.withTransitionForExit) ? options.withTransitionForExit : withTransition; withTransitionForAxis = isDefined(options.withTransitionForAxis) ? options.withTransitionForAxis : withTransition; - withTransitionForHorizontalAxis = isDefined(options.withTransitionForHorizontalAxis) ? options.withTransitionForHorizontalAxis : withTransition; duration = withTransition ? __transition_duration : 0; durationForExit = withTransitionForExit ? duration : 0; durationForAxis = withTransitionForAxis ? duration : 0; - xaxis = main.select('.' + CLASS.axisX); - yaxis = main.select('.' + CLASS.axisY); - y2axis = main.select('.' + CLASS.axisY2); - subxaxis = context.select('.' + CLASS.axisX); + xaxis = main.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1); + yaxis = main.select('.' + CLASS.axisY).style("opacity", hideAxis ? 0 : 1); + y2axis = main.select('.' + CLASS.axisY2).style("opacity", hideAxis ? 0 : 1); + subxaxis = context.select('.' + CLASS.axisX).style("opacity", hideAxis ? 0 : 1); transitions = { axisX: xaxis.transition().duration(durationForAxis), @@ -3135,6 +3134,13 @@ updateLegend(mapToIds(c3.data.targets), options, transitions); } + if (isCategorized) { + // ATTENTION: need to update domain with current domain when categoryAxis + if (targetsToShow.length === 0 || !withUpdateOrgXDomain || withUpdateXDomain) { + x.domain([0, xaxis.selectAll('.tick').size()]); + } + } + if (targetsToShow.length) { if (withUpdateOrgXDomain) { x.domain(d3.extent(getXDomain(targetsToShow))); @@ -3148,11 +3154,6 @@ x.domain(brush.empty() ? orgXDomain : brush.extent()); if (__zoom_enabled) { zoom.scale(x).updateScaleExtent(); } } - } else { - // ticks increase without this when no data shown - if (isCategorized) { - x.domain([0, xaxis.selectAll('.tick').size()]); - } } y.domain(getYDomain(targetsToShow, 'y')); @@ -3165,33 +3166,11 @@ subXAxis.tickValues(tickValues); } - // x axis - xaxis.style("opacity", hideAxis ? 0 : 1); - if (__axis_rotated || withTransitionForHorizontalAxis) { - xaxis = transitions.axisX; - } - xaxis.call(xAxis); - - // y axis - yaxis.style("opacity", hideAxis ? 0 : 1); - if (!__axis_rotated || withTransitionForHorizontalAxis) { - yaxis = transitions.axisY; - } - yaxis.call(yAxis); - - // y2 axis - y2axis.style("opacity", hideAxis ? 0 : 1); - if (!__axis_rotated || withTransitionForHorizontalAxis) { - y2axis = transitions.axisY2; - } - y2axis.call(y2Axis); - - // sub x axis - subxaxis.style("opacity", hideAxis ? 0 : 1); - if (__axis_rotated || withTransitionForHorizontalAxis) { - subxaxis = transitions.axisSubX; - } - subxaxis.call(subXAxis); + // axes + transitions.axisX.call(xAxis); + transitions.axisY.call(yAxis); + transitions.axisY2.call(y2Axis); + transitions.axisSubX.call(subXAxis); // show/hide if manual culling needed if (withUpdateXDomain) { @@ -3907,14 +3886,12 @@ .style('visibility', 'visible') .transition() .style('opacity', opacityForLegend); - updateLegend(mapToIds(c3.data.targets)); } function hideLegend(targetIds) { addHiddenLegendIds(targetIds); legend.selectAll(selectorLegends(targetIds)) .style('opacity', 0) .style('visibility', 'hidden'); - updateLegend(mapToIds(c3.data.targets)); } function updateLegend(targetIds, options, transitions) { @@ -4163,7 +4140,7 @@ .style('opacity', 1); } - redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); + redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); }; c3.hide = function (targetIds, options) { @@ -4184,7 +4161,7 @@ .style('opacity', legendOpacityForHidden); } - redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); + redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); }; c3.toggle = function (targetId) { @@ -4454,15 +4431,15 @@ legend.style('visibility', 'visible'); } showLegend(mapToTargetIds(targetIds)); - redraw({withTransitionForHorizontalAxis: false}); + redraw({withLegend: true}); }; c3.legend.hide = function (targetIds) { + hideLegend(mapToTargetIds(targetIds)); + redraw({withLegend: true}); if (__legend_show && isEmpty(targetIds)) { __legend_show = false; legend.style('visibility', 'hidden'); } - hideLegend(mapToTargetIds(targetIds)); - redraw({withTransitionForHorizontalAxis: false}); }; c3.resize = function (size) { diff --git a/c3.min.js b/c3.min.js index 989807c..660a1d4 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.32"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cMf&&(Mf=0),0>Of&&(Of=0),Nf=Yg?Jf.left-Si-Ti:Mf,Pf=Yg?Of:Rf-Kf.top-Kf.bottom,0>Nf&&(Nf=0),0>Pf&&(Pf=0),p(),Ni&&be(uf.data.targets)&&(Lf.left=Mf/2+Tf)}function o(){aj.select("line."+f.xgridFocus).attr("x1",Yg?0:-10).attr("x2",Yg?Mf:-10).attr("y1",Yg?-10:Jf.top).attr("y2",Yg?-10:Of)}function p(){Tf=Of/2,Sf=.95*Tf,Uf=ae(uf.data.targets)?.6*Sf:0}function q(){var a=Yg?f.axisX:f.axisY,b=tf.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=tf.select(wf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return xf?xf:x()}function s(){var a=yf?yf:y();return a>0?a:320}function t(){return be(uf.data.targets)?0:zf?zf:Yg?Zg?v("x"):1:!ph||uh?1:v("y")}function u(){var a=1;return be(uf.data.targets)?0:Af?Af:Ni?P()+(yh&&!Yg?v("y2"):a):yh?Dh||Yg?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||Zg?"x"===a&&mh?mh:"y"!==a||ph?"y2"!==a||yh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Ui:Sg&&!Ni?10:1:0}function x(){return+tf.select(wf).style("width").replace("px","")}function y(){return+tf.select(wf).style("height").replace("px","")}function z(a){return a?-5:-(Jf.left-1)}function A(a){return a?-20:-4}function B(){return z(!Yg)}function C(){return A(!Yg)}function D(){return z(Yg)}function E(){return A(Yg)}function F(a){return a?Mf+2+4:Jf.left+20}function G(a){return a?(mh?mh:0)+80:Of+8}function H(){return F(!Yg)}function I(){return G(!Yg)}function J(){return F(Yg)}function K(){return G(Yg)}function L(){var a=Ac(uf.data.targets),b=a.values[0],c=a.values[a.values.length-1],d=fg(c.x)-fg(b.x),e=zc(),f=Zd(uf.data.targets)?(e-(wi?.25:1))/e:1;return e>1?d*f/(e-1):d}function M(a){Oi=a}function N(a){Pi=a}function O(a){Qi=a}function P(){return Sg?Ni?Pi*(Oi+1):Qf:0}function Q(){return Sg?Ni?Rf:Qi*(Oi+1):0}function R(){var a,b=!fg;Zf=Yg?1:0,$f=Yg?Of:Mf,_f=Yg?0:Of,ag=Yg?Mf:1,bg=Zf,cg=$f,dg=Yg?0:Pf,eg=Yg?Nf:1,fg=T(Zf,$f,b?void 0:fg.domain(),function(){return lg.tickOffset()}),gg=U(_f,ag,b?void 0:gg.domain()),hg=U(_f,ag,b?void 0:hg.domain()),ig=T(Zf,$f,fj,function(a){return a%1?0:og.tickOffset()}),jg=U(dg,eg,b?void 0:jg.domain()),kg=U(dg,eg,b?void 0:kg.domain()),a=$(),lg=X(fg,Ii,a),og=X(ig,Li,a),mg=Y(gg,Ji,vh,xh),ng=Y(hg,Ki,Eh,Gh),b||(Vi.scale(ig),Bf&&Zi.scale(fg)),S()}function S(){Vf=Gb(),Wf=Hb(),Xf=Hb(.98)}function T(a,b,d,e){var f=(vi?tf.time.scale():tf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),wi){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=tf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?hg:gg}function W(a){return"y2"===Z(a)?kg:jg}function X(a,b,c){var d=(wi?Eb():tf.svg.axis()).scale(a).orient(b);return d.tickFormat(c),wi?(d.tickCentered(bh),se(dh)&&(dh=!1)):d.tickOffset=function(){var a=Bc(uf.data.targets),b=fg(a[1])-fg(a[0]);return b/zc()/2},wi&&d.categories(ah),d}function Y(a,b,c,d){return tf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wg?wg[a]:"y"}function $(){var a=vi?Fi:wi?Tc:function(a){return 0>a?a.toFixed(0):a};return ch&&("function"==typeof ch?a=ch:vi&&(a=function(a){return a?Ei(ch)(a):""})),a}function _(a){var b;return"y"===a?b=th:"y2"===a?b=Ch:"x"===a&&(b=oh),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?th=b:"y2"===a?Ch=b:"x"===a&&(oh=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a){a.selectAll(".tick text").attr("y",db(ih)).attr("x",cb(ih)).attr("transform","rotate("+ih+")").style("text-anchor","start")}function fb(a,b){var c=_(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function gb(){return fb("x",Yg?"inner-top":"inner-right")}function hb(){return fb("y",Yg?"inner-right":"inner-top")}function ib(){return fb("y2",Yg?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Mf/2:Mf:b.isBottom?-Of:b.isMiddle?-Of/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!Yg,gb())}function rb(){return nb(Yg,hb())}function sb(){return nb(Yg,ib())}function tb(){return ob(!Yg,gb())}function ub(){return ob(Yg,hb())}function vb(){return ob(Yg,ib())}function wb(){var a=gb();return Yg?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":mh?mh-10:"3em"}function xb(){var a=hb();return Yg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return Yg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!Yg,gb())}function Ab(){return pb(Yg,hb())}function Bb(){return pb(Yg,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return tf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){aj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),aj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),aj.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return tf.min(Object.keys(i).map(function(a){return tf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(vg.length>0)for(g=Sc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return tf.max(Object.keys(i).map(function(a){return tf.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Ah:rh,n="y2"===c?zh:qh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Bh:sh,r=ud()&&Yg;return 0===l.length?"y2"===c?hg.domain():gg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=vd(o,p),j=ac(gg.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&&wh&&(f=b(wh.top)?wh.top:e,g=b(wh.bottom)?wh.bottom:e),"y2"===c&&Fh&&(f=b(Fh.top)?Fh.top:e,g=b(Fh.bottom)?Fh.bottom:e),Zd(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return kh?vi?oe(kh):kh:tf.min(a,function(a){return tf.min(a.values,function(a){return a.x})})}function Zb(a){return jh?vi?oe(jh):jh:tf.max(a,function(a){return tf.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return wi?d=0:Zd(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof lh&&te(lh)?(e=b(lh.left)?lh.left:d,f=b(lh.right)?lh.right:d):e=f="number"==typeof lh?lh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return(c||0===c)&&(f=vi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=vi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?gg:hg;return b="y"===a.axis||"y2"===a.axis?Yg?Of:"start"in a?d(a.start):Of:Yg?"end"in a?fg(vi?oe(a.end):a.end):Of:Of,c>b?0:b-c}function ic(a){return pg&&a===pg||te(qg)&&ue(qg,a)}function jc(a){return!ic(a)}function kc(a){return pg?pg:te(qg)?qg[a]:null}function lc(a,b){var c,d=b&&te(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=uf.data.xs[b])}),c}function mc(a,b){return a in uf.data.xs&&uf.data.xs[a]&&uf.data.xs[a][b]?uf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){qg[b]=a[b]})}function oc(a){return 1===tf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=tg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),uf.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=vi?a?a instanceof Date?a:oe(a):oe(mc(c,d)):xi&&!wi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?uf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):pg?(d=Object.keys(uf.data.xs),uf.data.xs[c]=d.length>0?uf.data.xs[d[0]]:void 0):te(qg)&&(uf.data.xs[c]=lc(f,uf.data.targets)):uf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!uf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=sg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return xi&&wi&&0===c&&g&&(0===e&&(ah=[]),ah.push(g)),("undefined"==typeof a[b]||uf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),xg&&Xd(Cc(c).filter(function(a){return!(a in yg)}),xg),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function xc(a){return a>0&&uf.data.targets[0].values[a-1]?uf.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(uf.data.targets)}function Ec(a,b){var c,d=Cc(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(vi?new Date(h):h);i.push(d)}return vi||(i=i.sort(function(a,b){return a-b})),i}function Lc(a){Gi=Gi.concat(a)}function Mc(a){Gi=Gi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Hi=Hi.concat(a)}function Oc(a){Hi=Hi.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Dd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Dd(a,g))),Gd(e,b)):Ed(a,b,f,g)}function Fd(a,b){var c;return c=a.map(function(a){return Ed(a.values,b)}),Gd(c,b)}function Gd(a,b){var c,d;return a.forEach(function(a){var e=ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Hd(a,b){return tf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Id(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Jd(){return Ag&&"desc"===Ag.toLowerCase()}function Kd(){return Ag&&"asc"===Ag.toLowerCase()}function Ld(a){var b=Kd(),c=Jd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Ag&&a.sort(Ag),a}function Md(a,c){var d,e,f,g,h,i,j,k=be(uf.data.targets),l=k?xd:wd,m=a.filter(function(a){return a&&b(a.value)});ii&&0!==m.length&&(dj.html(li(a,$(),l,Di)).style("display","block"),d=dj.property("offsetWidth"),e=dj.property("offsetHeight"),k?(g=Mf/2+c[0],i=Of/2+c[1]+20):(Yg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=fg(m[0].x)+20):(f=q(),g=f+t()+fg(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)),dj.style("top",i+"px").style("left",g+"px"))}function Nd(){dj.style("display","none")}function Od(a){var c=a.filter(function(a){return a&&b(a.value)});ii&&($d(uf.data.targets)||be(uf.data.targets)||aj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Yg?"y1":"x1",zd).attr(Yg?"y2":"x2",zd))}function Pd(){aj.select("line."+f.xgridFocus).style("visibility","hidden")}function Qd(a){return a.x||0===a.x?fg(a.x):null}function Rd(a){return V(a.id)(a.value)}function Sd(){var a,b,d={},e=0;return Ic(Fc(ee)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Wd(a,b){return Uh?Uh:b?2*a.tickOffset()*Vh/b:0}function Xd(a,b){Dc(a).forEach(function(a){hj[a]=b===yg[a],yg[a]=b})}function Yd(a,b){var c=!1;return a.forEach(function(a){yg[a.id]===b&&(c=!0),a.id in yg||"line"!==b||(c=!0)}),c}function Zd(a){return Yd(a,"bar")}function $d(a){return Yd(a,"scatter")}function _d(a){return Yd(a,"pie")}function ae(a){return Yd(a,"donut")}function be(a){return _d(a)||ae(a)}function ce(a){var b="string"==typeof a?a:a.id;return!(b in yg)||"line"===yg[b]||"spline"===yg[b]||"area"===yg[b]||"area-spline"===yg[b]}function de(a){var b="string"==typeof a?a:a.id;return"spline"===yg[b]||"area-spline"===yg[b]}function ee(a){var b="string"==typeof a?a:a.id;return"bar"===yg[b]}function fe(a){var b="string"==typeof a?a:a.id;return"scatter"===yg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"pie"===yg[b]}function he(a){var b="string"==typeof a?a:a.id;return"donut"===yg[b]}function ie(a){return ge(a)||he(a)}function je(a){return ee(a)?a.values:[]}function ke(a){return ce(a)||fe(a)?a.values:[]}function le(a){return ee(a)||ce(a)?a.values:[]}function me(a){return he(a)&&ci||ge(a)&&Yh}function ne(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 oe(b){var c;try{c=rg?tf.time.format(rg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+rg)}return c}function pe(a,b){var c=tf.mouse(a),d=tf.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 ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ve(a,b){var c="y"===Z(a.id)?gg:hg,d=Yg?1:0,e=Yg?0:1;return Math.pow(fg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function we(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function xe(a,b,c){Lg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd).attr("stroke",function(){return Di(b)}).attr("r",1.4*Sh).transition().duration(100).attr("r",Sh)}function ye(a,b,c){Mg(b,a.node()),aj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function ze(a,b,c,d){a?xe(b,c,d):ye(b,c,d)}function Ae(a,b){Lg(b,a.node()),a.transition().duration(100).style("fill",function(){return tf.rgb(Di(b)).darker(1)})}function Be(a,b){Mg(b,a.node()),a.transition().duration(100).style("fill",function(){return Di(b)})}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a){return a.filter(function(a){return b(a.value)})}function Ee(a,c){return(c?aj.selectAll("."+f.circles+ld(c)):aj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Fe(a,b){Ee(a,b).classed(f.EXPANDED,!0).attr("r",Rh)}function Ge(a){Ee(a).filter(function(){return tf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oh)}function He(a){return aj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ie(a){He(a).classed(f.EXPANDED,!0)}function Je(a){He(a).classed(f.EXPANDED,!1)}function Ke(a,b){var c=Oe(a,b);return function(a,b){var d=c(a,b),e=Yg?1:0,f=Yg?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 Le(a,b){var c=Oe(a,!1),d=b?Me:Ne;return function(a,b){return d(c(a,b),a,this)}}function Me(a,b){var c;return Yg?(c=ee(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ne(a,b,c){var d=c.getBoundingClientRect();return Yg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ee(b)?-3:-6)}function Oe(a,b){var c=a.__max__+1,d=Wd(lg,c),e=Td(d,c,a,!!b),f=Ud(!!b),g=Vd(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 Yg&&(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 Pe(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 Qe(b){var c,d,e;if(ej=tf.select(wf),ej.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ej.html(""),ej.classed("c3",!0),uf.data.xs={},uf.data.targets=vc(b),n(),R(),fg.domain(tf.extent(_b(uf.data.targets))),gg.domain(Xb(uf.data.targets,"y")),hg.domain(Xb(uf.data.targets,"y2")),ig.domain(fg.domain()),jg.domain(gg.domain()),kg.domain(hg.domain()),fj=fg.domain(),Vi.scale(ig),Bf&&Zi.scale(fg),$i=ej.append("svg").attr("width",Mf+Jf.left+Jf.right).attr("height",Of+Jf.top+Jf.bottom).on("mouseenter",Ef).on("mouseleave",Ff),_i=$i.append("defs"),_i.append("clipPath").attr("id",pi).append("rect").attr("width",Mf).attr("height",Of),_i.append("clipPath").attr("id",qi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),_i.append("clipPath").attr("id",ri).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),aj=$i.append("g").attr("transform",Mi.main),bj=$i.append("g").attr("transform",Mi.context),cj=$i.append("g").attr("transform",Mi.legend),Pg||bj.style("visibility","hidden"),Sg||(cj.style("visibility","hidden"),Hi=Cc(uf.data.targets)),dj=tf.select(wf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),of(Cc(uf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),Zg&&aj.append("g").attr("class",f.axisX).attr("clip-path",ti).attr("transform",Mi.x).append("text").attr("class",f.axisXLabel).attr("transform",Yg?"rotate(-90)":"").style("text-anchor",zb),ph&&aj.append("g").attr("class",f.axisY).attr("clip-path",ui).attr("transform",Mi.y).append("text").attr("class",f.axisYLabel).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Ab),yh&&aj.append("g").attr("class",f.axisY2).attr("transform",Mi.y2).append("text").attr("class",f.axisY2Label).attr("transform",Yg?"":"rotate(-90)").style("text-anchor",Bb),d=aj.append("g").attr("clip-path",si).attr("class",f.grid),Hh&&d.append("g").attr("class",f.xgrids),te(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),te(Lh)&&d.append("g").attr("class",f.ygridLines),aj.append("g").attr("clip-path",si).attr("class",f.regions),aj.append("g").attr("clip-path",si).attr("class",f.chart),c=aj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Bf?Yg?"ns-resize":"ew-resize":null),aj.select("."+f.chart).append("g").attr("class",f.chartBars),aj.select("."+f.chart).append("g").attr("class",f.chartLines),aj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Mi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),aj.select("."+f.chart).append("g").attr("class",f.chartTexts),Bf&&aj.insert("rect",Df?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Mf).attr("height",Of).style("opacity",0).style("cursor",Yg?"ns-resize":"ew-resize").call(Zi).on("dblclick.zoom",null),nh&&Vi.extent("function"!=typeof nh?nh:nh(_b())),bj.append("g").attr("clip-path",si).attr("class",f.chart).attr("display","none"),bj.select("."+f.chart).append("g").attr("class",f.chartBars),bj.select("."+f.chart).append("g").attr("class",f.chartLines),bj.append("g").attr("clip-path",si).attr("class",f.brush).call(Vi).selectAll("rect").attr(Yg?"width":"height",Yg?Nf:Pf),bj.append("g").attr("class",f.axisX).attr("transform",Mi.subx).attr("clip-path",Yg?"":ti),bf(uf.data.targets),Yg?aj.select("."+f.axisX).style("opacity",0).call(lg):(aj.select("."+f.axisY).style("opacity",0).call(mg),aj.select("."+f.axisY2).style("opacity",0).call(ng)),n(),R(),_e(),m(!1),Xe({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),mi){if(vi&&"string"==typeof ni){for(ni=oe(ni),e=0;e0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W=Sd(),X=be(uf.data.targets),Y=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,G=d(a.withTransform)?a.withTransform:!1,H=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,I=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,J=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,F=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:C,Q=C?If:0,R=D?Q:0,S=E?Q:0,c=aj.select("."+f.axisX),g=aj.select("."+f.axisY),h=aj.select("."+f.axisY2),e=bj.select("."+f.axisX),P={axisX:c.transition().duration(S),axisY:g.transition().duration(S),axisY2:h.transition().duration(S),axisSubX:e.transition().duration(S)},J&&Sg&&of(Cc(uf.data.targets),a,P),Y.length?(I&&(fg.domain(tf.extent(_b(Y))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),H&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent())):wi&&fg.domain([0,c.selectAll(".tick").size()]),gg.domain(Xb(Y,"y")),hg.domain(Xb(Y,"y2")),(gh||fh)&&(T=hh?hh:Kc(Jc(Y)),lg.tickValues(T),og.tickValues(T)),c.style("opacity",X?0:1),(Yg||F)&&(c=P.axisX),c.call(lg),g.style("opacity",X?0:1),(!Yg||F)&&(g=P.axisY),g.call(mg),h.style("opacity",X?0:1),(!Yg||F)&&(h=P.axisY2),h.call(ng),e.style("opacity",X?0:1),(Yg||F)&&(e=P.axisSubX),e.call(og),H)if(dh&&T){for(U=1;U=0&&tf.select(this).style("display",b%V?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),K=Ke(W),N=Le(W,!0),O=Le(W,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Z=_b(),$=Z[0].getFullYear(),_=Z[1].getFullYear(),ab=$;_>=ab;ab++)j.push(new Date(ab+"-01-01 00:00:00"))}else j=fg.ticks(10);i=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(Q).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),A&&Kh&&(m=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(Q).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(Q).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(Q).style("opacity",0).remove()),s=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(Q).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("fill-opacity",0).remove(),r=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",K).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(Q).attr("d",K).style("opacity",1),r.exit().transition().duration(R).style("opacity",0).remove(),t=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(Q).attr("x",N).attr("y",O).style("fill-opacity",td),t.exit().transition().duration(R).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(Q).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(Q).attr("d",Xi).style("opacity",gj),q=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(Q).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",G?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(Q).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",G?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(Q).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),M=Ke(W,!0),u=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",M).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(Q).attr("d",M).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(Q).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(Q).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(x?x.values:[]),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(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(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ni?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(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=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?h:-200).attr("y",Ni?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?i:-200).attr("y",Ni?-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 Di(a)}).attr("x",Ni?h:-200).attr("y",Ni?-200:j).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),cj.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(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=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(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0 -},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.legend.hide=function(a){Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden")),nf(Dc(a)),Xe({withTransitionForHorizontalAxis:!1})},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}dj.html(li(uf.data.targets.map(function(a){return pc(a.values[ni])}),$(),wd,Di)),dj.style("top",oi.top).style("left",oi.left).style("display","block")}null==a.onresize&&(a.onresize=$e()),a.onresize.add&&(a.onresize.add(Gf),a.onresize.add(function(){af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Hf))}function Re(a){a.append("rect").attr("class",fd).style("cursor",Eg&&Fg?"pointer":null).on("mouseover",function(a,b){if(!zi&&!be(uf.data.targets)){var c,d,e=uf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(tg).length>0){d=[];for(var g in tg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Id(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ce,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 Ve(a){be(uf.data.targets)||Eg&&(yi=a,aj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),zi=!0,Ng())}function We(){be(uf.data.targets)||Eg&&(aj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),aj.selectAll("."+f.shape).classed(f.INCLUDED,!1),zi=!1,Og())}function Xe(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V=Sd(),W=be(uf.data.targets),X=Ic(uf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?If:0,Q=D?P:0,R=E?P:0,c=aj.select("."+f.axisX).style("opacity",W?0:1),g=aj.select("."+f.axisY).style("opacity",W?0:1),h=aj.select("."+f.axisY2).style("opacity",W?0:1),e=bj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Sg&&of(Cc(uf.data.targets),a,O),wi&&(0===X.length||!H||G)&&fg.domain([0,c.selectAll(".tick").size()]),X.length&&(H&&(fg.domain(tf.extent(_b(X))),fj=fg.domain(),Bf&&Zi.scale(fg).updateScaleExtent(),ig.domain(fg.domain()),Vi.scale(ig)),G&&(fg.domain(Vi.empty()?fj:Vi.extent()),Bf&&Zi.scale(fg).updateScaleExtent())),gg.domain(Xb(X,"y")),hg.domain(Xb(X,"y2")),(gh||fh)&&(S=hh?hh:Kc(Jc(X)),lg.tickValues(S),og.tickValues(S)),O.axisX.call(lg),O.axisY.call(mg),O.axisY2.call(ng),O.axisSubX.call(og),G)if(dh&&S){for(T=1;T=0&&tf.select(this).style("display",b%U?"none":"block")})}else tf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!Yg&&ih&&eb(c),J=Ke(V),M=Le(V,!0),N=Le(V,!1),Db(),jg.domain(gg.domain()),kg.domain(hg.domain()),dj.style("display","none"),o(),aj.select("line."+f.xgridFocus).style("visibility","hidden"),Hh){if("year"===Ih){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=fg.ticks(10);i=aj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",Yg?0:function(a){return fg(a)-lg.tickOffset()}).attr("x2",Yg?Mf:function(a){return fg(a)-lg.tickOffset()}).attr("y1",Yg?function(a){return fg(a)-lg.tickOffset()}:Jf.top).attr("y2",Yg?function(a){return fg(a)-lg.tickOffset()}:Of).style("opacity",function(){return+tf.select(this).attr(Yg?"y1":"x1")===(Yg?Of:0)?0:1}),i.exit().remove()}te(Jh)&&(k=aj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Jh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Yg?"":"rotate(-90)").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",Yg?0:Ad).attr("x2",Yg?Mf:Ad).attr("y1",Yg?Ad:Jf.top).attr("y2",Yg?Ad:Of).style("opacity",1),k.select("text").transition().duration(P).attr("x",Yg?Mf:0).attr("y",Ad).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Kh&&(m=aj.select("."+f.ygrids).selectAll("."+f.ygrid).data(gg.ticks(Mh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",Yg?gg:0).attr("x2",Yg?gg:Mf).attr("y1",Yg?0:gg).attr("y2",Yg?Of:gg),m.exit().remove()),A&&te(Lh)&&(n=aj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Lh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",Yg?"rotate(-90)":"").attr("dx",Yg?0:-Jf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",Yg?Bd:0).attr("x2",Yg?Bd:Mf).attr("y1",Yg?0:Bd).attr("y2",Yg?Of:Bd).style("opacity",1),n.select("text").transition().duration(P).attr("x",Yg?0:Mf).attr("y",Bd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=aj.select("."+f.regions).selectAll("rect."+f.region).data(hi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=aj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Di(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=aj.selectAll("."+f.texts).selectAll("."+f.text).data(le),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return Yg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return yd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),aj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Wi).style("opacity",1),aj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",Xi).style("opacity",gj),q=aj.selectAll("."+f.circles).selectAll("."+f.circle).data(ke),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Oh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),q.exit().remove(),aj.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=tf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1),aj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&ie(a.data)?1:0}),aj.select("."+f.chartArcsTitle).style("opacity",ae(uf.data.targets)?1:0),Pg&&(null!==tf.event&&"zoom"===tf.event.type&&Vi.extent(fg.orgDomain()).update(),B&&(!Yg&&ih&&eb(e),Vi.empty()||Vi.extent(fg.orgDomain()).update(),K=Ke(V,!0),u=bj.selectAll("."+f.bars).selectAll("."+f.bar).data(je),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Di(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),bj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Yi).style("opacity",1))),aj.selectAll("."+f.selectedCircles).filter(function(a){return ee(a)}).selectAll("circle").remove(),aj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",Yg?Rd:Qd).attr("cy",Yg?Qd:Rd),v=aj.select("."+f.eventRects),te(qg)&&!oc(qg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Se(w.enter()),w.attr("x",0).attr("y",0).attr("width",Mf).attr("height",Of)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),xi&&!wi?(z=function(a,b){var c=xc(b),d=yc(b),e=uf.data.xs[a.id][b];return(fg(d?d:e+50)-fg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=uf.data.xs[a.id][b];return(fg(d)+fg(c?c:d-50))/2}):(z=L(),y=function(a){return fg(a.x)-z/2}),x=Ac(uf.data.targets),aj.select("."+f.eventRects).datum(x?x.values:[]),w=aj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Re(w.enter()),w.attr("class",fd).attr("x",Yg?0:y).attr("y",Yg?y:0).attr("width",Yg?Mf:z).attr("height",Yg?z:Of),w.exit().remove()),Cc(uf.data.targets).forEach(function(a){hj[a]=!0})}function Ye(){Xe({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Ze(){return"mousemove"===tf.event.sourceEvent.type&&Zi.altDomain?(fg.domain(Zi.altDomain),void Zi.scale(fg).updateScaleExtent()):(wi&&fg.orgDomain()[0]===fj[0]&&fg.domain([fj[0]-1e-10,fg.orgDomain()[1]]),Xe({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===tf.event.sourceEvent.type&&(Ai=!0)))}function $e(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function _e(){$i.attr("width",Qf).attr("height",Rf),$i.select("#"+pi).select("rect").attr("width",Mf).attr("height",Of),$i.select("#"+qi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),$i.select("#"+ri).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),$i.select("."+f.zoomRect).attr("width",Mf).attr("height",Of),ej.style("max-height",Rf+"px")}function af(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(),_e(),m(a.withTransition),Xe(a)}function bf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=aj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Di(a)}),e=aj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Di(a)}).style("stroke","none").style("cursor",function(a){return Gg(a)?"pointer":null}),c=aj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)}),b.append("path").attr("class",dd).style("opacity",function(){return gj=+tf.select(this).style("opacity"),0}).style("fill",function(a){return Di(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Di(a)}).style("cursor",function(a){return Gg(a)?"pointer":null}),a.forEach(function(a){aj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=aj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Yf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Di(a.data)}).style("cursor",function(a){return Gg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Fb(a),d=Lb(c),e=Tb();Nb(c.data.id),jf(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Fb(a),c=[Lb(b)];Md(c,tf.mouse(this))}).on("mouseout",function(a,b){var c=Fb(a),d=Lb(c),e=Ub();Ob(c.data.id),lf(),Nd(),e(d,b)}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Pg&&(n=bj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Di(a)}),l=bj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Di(a)})),$i.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function cf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Xd(a.id,b.types[a.id]):Xd(a.id,b.type)}),uf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ni?j:i,l=Ni?Q():P();return d&&(x=0,D=0,u=0,v=0),Sg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ni?v:u,void(Xg?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ni?(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=cj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Ug?Ug(a):uf.toggle(a)}).on("mouseover",function(a){uf.focus(a),"function"==typeof Vg&&Vg(a)}).on("mouseout",function(a){uf.revert(),"function"==typeof Wg&&Wg(a)}),o.append("text").text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ni?h:-200).attr("y",Ni?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ni?i:-200).attr("y",Ni?-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 Di(a)}).attr("x",Ni?h:-200).attr("y",Ni?-200:j).attr("width",10).attr("height",10),cj.selectAll("text").data(a).text(function(a){return d(tg[a])?tg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),cj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),cj.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(),_e(),r&&m(q,c)}function pf(a){return Ec(uf.data.targets,a.id)}function qf(a){return"data"in a&&Ec(uf.data.targets,a.data.id)}function rf(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 sf(a,b,c){var d=!be(uf.data.targets);Xd(a,b),af(c||{withTransitionForAxis:d})}var tf=a.d3?a.d3:a.require?a.require("d3"):void 0,uf={data:{},axis:{},legend:{}},vf={},wf=h(["bindto"],"#chart"),xf=h(["size","width"]),yf=h(["size","height"]),zf=h(["padding","left"]),Af=h(["padding","right"]),Bf=h(["zoom","enabled"],!1),Cf=h(["zoom","extent"]),Df=h(["zoom","privileged"],!1),Ef=h(["onenter"],function(){}),Ff=h(["onleave"],function(){}),Gf=h(["onresize"],function(){}),Hf=h(["onresized"],function(){}),If=h(["transition","duration"],350);g("data","data is required in config");var Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg=h(["data","x"]),qg=h(["data","xs"],{}),rg=h(["data","x_format"]),sg=h(["data","id_converter"],function(a){return a}),tg=h(["data","names"],{}),ug=h(["data","classes"],{}),vg=h(["data","groups"],[]),wg=h(["data","axes"],{}),xg=h(["data","type"]),yg=h(["data","types"],{}),zg=h(["data","labels"],{}),Ag=h(["data","order"]),Bg=h(["data","regions"],{}),Cg=h(["data","color"]),Dg=h(["data","colors"],{}),Eg=h(["data","selection","enabled"],!1),Fg=h(["data","selection","grouped"],!1),Gg=h(["data","selection","isselectable"],function(){return!0}),Hg=h(["data","selection","multiple"],!0),Ig=h(["data","onclick"],function(){}),Jg=h(["data","onenter"],function(){}),Kg=h(["data","onleave"],function(){}),Lg=h(["data","onselected"],function(){}),Mg=h(["data","onunselected"],function(){}),Ng=h(["data","ondragstart"],function(){}),Og=h(["data","ondragend"],function(){}),Pg=h(["subchart","show"],!1),Qg=h(["subchart","size","height"],60),Rg=h(["color","pattern"],[]),Sg=h(["legend","show"],!0),Tg=h(["legend","position"],"bottom"),Ug=h(["legend","item","onclick"]),Vg=h(["legend","item","onmouseover"]),Wg=h(["legend","item","onmouseout"]),Xg=h(["legend","equally"],!1),Yg=h(["axis","rotated"],!1),Zg=h(["axis","x","show"],!0),$g=h(["axis","x","type"],"indexed"),_g=h(["axis","x","localtime"],!0),ah=h(["axis","x","categories"],[]),bh=h(["axis","x","tick","centered"],!1),ch=h(["axis","x","tick","format"]),dh=h(["axis","x","tick","culling"],{}),eh=h(["axis","x","tick","culling","max"],10),fh=h(["axis","x","tick","count"]),gh=h(["axis","x","tick","fit"],!0),hh=h(["axis","x","tick","values"],null),ih=h(["axis","x","tick","rotate"]),jh=h(["axis","x","max"],null),kh=h(["axis","x","min"],null),lh=h(["axis","x","padding"],{}),mh=h(["axis","x","height"]),nh=h(["axis","x","default"]),oh=h(["axis","x","label"],{}),ph=h(["axis","y","show"],!0),qh=h(["axis","y","max"]),rh=h(["axis","y","min"]),sh=h(["axis","y","center"]),th=h(["axis","y","label"],{}),uh=h(["axis","y","inner"],!1),vh=h(["axis","y","tick","format"]),wh=h(["axis","y","padding"],{}),xh=h(["axis","y","ticks"],10),yh=h(["axis","y2","show"],!1),zh=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(["line","connect_null"],!1),Uh=h(["bar","width"]),Vh=h(["bar","width","ratio"],.6),Wh=h(["pie","label","show"],!0),Xh=h(["pie","label","format"]),Yh=h(["pie","expand"],!0),Zh=h(["pie","onclick"],function(){}),$h=h(["pie","onmouseover"],function(){}),_h=h(["pie","onmouseout"],function(){}),ai=h(["donut","label","show"],!0),bi=h(["donut","label","format"]),ci=h(["donut","expand"],!0),di=h(["donut","title"],""),ei=h(["donut","onclick"],function(){}),fi=h(["donut","onmouseover"],function(){}),gi=h(["donut","onmouseout"],function(){}),hi=h(["regions"],[]),ii=h(["tooltip","show"],!0),ji=h(["tooltip","format","title"]),ki=h(["tooltip","format","value"]),li=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ji?ji:b,l=ki?ki: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+""}),mi=h(["tooltip","init","show"],!1),ni=h(["tooltip","init","x"],0),oi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),pi=("string"==typeof wf?wf.replace("#",""):wf.id)+"-clip",qi=pi+"-xaxis",ri=pi+"-yaxis",si=i(pi),ti=i(qi),ui=i(ri),vi="timeseries"===$g,wi="categorized"===$g,xi=!vi&&(pg||te(qg)),yi=null,zi=!1,Ai=!1,Bi=!1,Ci=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Di=ne(Dg,te(Rg)?Rg:Ci,Cg),Ei=_g?tf.time.format:tf.time.format.utc,Fi=function(){var a=[[Ei("%Y/%-m/%-d"),function(){return!0}],[Ei("%-m/%-d"),function(a){return a.getMonth()}],[Ei("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ei("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ei("%I %p"),function(a){return a.getHours()}],[Ei("%I:%M"),function(a){return a.getMinutes()}],[Ei(":%S"),function(a){return a.getSeconds()}],[Ei(".%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)}}(),Gi=[],Hi=[],Ii=Yg?"left":"bottom",Ji=Yg?uh?"top":"bottom":uh?"right":"left",Ki=Yg?Dh?"bottom":"top":Dh?"left":"right",Li=Yg?"left":"bottom",Mi={main:function(){return"translate("+Jf.left+","+Jf.top+")"},context:function(){return"translate("+Kf.left+","+Kf.top+")"},legend:function(){return"translate("+Lf.left+","+Lf.top+")"},x:function(){return"translate(0,"+(Yg?0:Of)+")"},y:function(){return"translate(0,"+(Yg?Of:0)+")"},y2:function(){return"translate("+(Yg?0:Mf)+","+(Yg?1:0)+")"},subx:function(){return"translate(0,"+(Yg?0:Pf)+")"},arc:function(){return"translate("+Mf/2+","+Of/2+")"}},Ni="right"===Tg,Oi=0,Pi=0,Qi=0,Ri=.15,Si=30,Ti=Yg&&!Zg?0:30,Ui=5;Yf=tf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Vi,Wi=function(){var a=tf.svg.line().x(Yg?function(a){return V(a.id)(a.value)}:zd).y(Yg?zd:function(a){return V(a.id)(a.value)});return Th||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Th?De(b.values):b.values;return ce(b)?(a.interpolate(de(b)?"cardinal":"linear"),Bg[b.id]?Pe(e,fg,V(b.id),Bg[b.id]):a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Xi=function(){var a;return a=Yg?tf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(zd):tf.svg.area().x(zd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=De(b.values);return Yd([b],"area")||Yd([b],"area-spline")?(a.interpolate(de(b)?"cardinal":"linear"),a(e)):(c=e[0]?fg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,Yg?"M "+d+" "+c:"M "+c+" "+d)}}(),Yi=function(){var a=tf.svg.line().x(Yg?function(a){return W(a.id)(a.value)}:Cd).y(Yg?Cd:function(a){return W(a.id)(a.value)});return function(b){var c=De(b.values);return ce(b)?a(c):"M "+ig(c[0].x)+" "+W(b.id)(c[0].value)}}(),Zi=function(){};Vi=tf.svg.brush().on("brush",Ye),Vi.update=function(){return bj&&bj.select("."+f.brush).call(this),this},Vi.scale=function(a){return Yg?this.y(a):this.x(a)},Bf&&(Zi=tf.behavior.zoom().on("zoomstart",function(){Zi.altDomain=tf.event.sourceEvent.altKey?fg.orgDomain():null}).on("zoom",Bf?Ze:null),Zi.scale=function(a){return Yg?this.y(a):this.x(a)},Zi.orgScaleExtent=function(){var a=Cf?Cf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},Zi.updateScaleExtent=function(){var a=ac(fg.orgDomain())/ac(fj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var $i,_i,aj,bj,cj,dj,ej,fj,gj,hj={};if(uf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),uf.defocus(),b(d.classed(f.focused,!0)),b(e),be(uf.data.targets)&&Nb(a,!0),jf(a)},uf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);uf.revert(),b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),kf(a)},uf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=$i.selectAll(md(a)),d=c.filter(pf),e=c.filter(qf);b(d.classed(f.focused,!1)),b(e),be(uf.data.targets)&&Ob(a),lf()},uf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),$i.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?mf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),$i.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?nf(a):cj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Ri),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},uf.toggle=function(a){Gc(a)?uf.hide(a):uf.show(a)},uf.unzoom=function(){Vi.clear().update(),Xe({withUpdateXDomain:!0})},uf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){ug[b]=a.classes[b]}),"categories"in a&&wi&&(ah=a.categories,lg.categories(ah)),"cacheIds"in a&&bc(a.cacheIds)?void cf(dc(a.cacheIds),a.done):void("unload"in a?ef(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){df(a)}):df(a))},uf.unload=function(a){ef(Dc(a),function(){Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},uf.selected=function(a){return tf.merge(aj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return tf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},uf.select=function(a,b,c){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=tf.select(this),i="circle"===this.nodeName?xe:Ae,j="circle"===this.nodeName?ye:Be,k=Fg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Gg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},uf.unselect=function(a,b){Eg&&aj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=tf.select(this),g="circle"===this.nodeName?ye:Be,h=Fg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Gg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},uf.toLine=function(a){sf(a,"line")},uf.toSpline=function(a){sf(a,"spline")},uf.toBar=function(a){sf(a,"bar")},uf.toScatter=function(a){sf(a,"scatter")},uf.toArea=function(a){sf(a,"area")},uf.toAreaSpline=function(a){sf(a,"area-spline")},uf.toPie=function(a){sf(a,"pie",{withTransform:!0})},uf.toDonut=function(a){sf(a,"donut",{withTransform:!0})},uf.groups=function(a){return c(a)?vg:(vg=a,Xe(),vg)},uf.xgrids=function(a){return a?(Jh=a,Xe(),Jh):Jh},uf.xgrids.add=function(a){return a?uf.xgrids(Jh.concat(a)):void 0},uf.xgrids.remove=function(a){var b=rf(a);return uf.xgrids(Jh.filter(b))},uf.ygrids=function(a){return a?(Lh=a,Xe(),Lh):Lh},uf.ygrids.add=function(a){return a?uf.ygrids(Lh.concat(a)):void 0 +},uf.ygrids.remove=function(a){var b=rf(a);return uf.ygrids(Lh.filter(b))},uf.regions=function(a){return c(a)?hi:(hi=a,Xe(),hi)},uf.regions.add=function(a){return c(a)?hi:(hi=hi.concat(a),Xe(),hi)},uf.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;$i.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),hi=hi.filter(function(b){return b.classes.indexOf(a)<0})}),hi},uf.data.get=function(a){var b=uf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},uf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},uf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){tg[b]=a[b]}),of(Cc(uf.data.targets),{withTransition:!0}),tg):tg},uf.x=function(a){return arguments.length&&(qc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.xs=function(a){return arguments.length&&(rc(uf.data.targets,a),Xe({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),uf.data.xs},uf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},uf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(qh=+a.y),b(a.y2)&&(zh=+a.y2)):qh=zh=+a,Xe())},uf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(rh=+a.y),b(a.y2)&&(Ah=+a.y2)):rh=Ah=+a,Xe())},uf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&uf.axis.max(a.max),"undefined"!=typeof a.min&&uf.axis.min(a.min))},uf.legend.show=function(a){Sg||(Sg=!0,cj.style("visibility","visible")),mf(Dc(a)),Xe({withLegend:!0})},uf.legend.hide=function(a){nf(Dc(a)),Xe({withLegend:!0}),Sg&&se(a)&&(Sg=!1,cj.style("visibility","hidden"))},uf.resize=function(a){xf=a?a.width:null,yf=a?a.height:null,af({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},uf.destroy=function(){uf.data.targets=void 0,uf.data.xs={},ej.html(""),a.onresize=null},"url"in e.data)tf.xhr(e.data.url,function(a,b){var c,d=tf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=tf.csv.parse(b.response),Qe(c)});else if("rows"in e.data)Qe(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Qe(uc(e.data.columns))}return uf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file