!function(a){"use strict";functionb(a){varb=this.internal=newc(this);b.loadConfig(a),b.init(),functiond(a,b,c){for(vareina)b[e]=a[e].bind(c),Object.keys(a[e]).length>0&&d(a[e],b[e],c)}(e,this,this)}functionc(b){varc=this;c.d3=a.d3?a.d3:"undefined"!=typeofrequire?require("d3"):void0,c.api=b,c.config=c.getDefaultConfig(),c.data={},c.cache={},c.axes={}}functiond(a,b){functionc(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}functiond(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}functione(a){varb=a[0],c=a[a.length-1];returnc>b?[b,c]:[c,b]}functionf(a){varb,c,d=[];if(a.ticks)returna.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b<c[1];b++)d.push(b);returnd.length>0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}functiong(){vara,c=m.copy();returnb&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}functionh(a){returnj?j(a):a}functioni(i){i.each(function(){functioni(a){varb=m(a)+s;returnB[0]<b&&b<B[1]?o:0}varj,k,t=a.select(this),u=this.__chart__||m,v=this.__chart__=g(),w=r?r:f(v),x=t.selectAll(".tick").data(w,v),y=x.enter().insert("g",".domain").attr("class","tick").style("opacity",1e-6),z=x.exit().remove(),A=a.transition(x).style("opacity",1),B=m.rangeExtent?m.rangeExtent():e(m.range()),C=t.selectAll(".domain").data([0]),D=(C.enter().append("path").attr("class","domain"),a.transition(C));y.append("line"),y.append("text");varE=y.select("line"),F=A.select("line"),G=x.select("text").text(h),H=y.select("text"),I=A.select("text");switch(b?(s=Math.ceil((v(1)-v(0))/2),k=l?0:s):s=k=0,n){case"bottom":j=c,E.attr("y2",o),H.attr("y",Math.max(o,0)+q),F.attr("x1",k).attr("x2",k).attr("y2",i),I.attr("x",0).attr("y",Math.max(o,0)+q),G.attr("dy",".71em").style("text-anchor","middle"),D.attr("d","M"+B[0]+","+p+"V0H"+B[1]+"V"+p);break;case"top":j=c,E.attr("y2",-o),H.attr("y",-(Math.max(o,0)+q)),F.attr("x2",0).attr("y2",-o),I.attr("x",0).attr("y",-(Math.max(o,0)+q)),G.attr("dy","0em").style("text-anchor","middle"),D.attr("d","M"+B[0]+","+-p+"V0H"+B[1]+"V"+-p);break;case"left":j=d,E.attr("x2",-o),H.attr("x",-(Math.max(o,0)+q)),F.attr("x2",-o).attr("y2",0),I.attr("x",-(Math.max(o,0)+q)).attr("y",s),G.attr("dy",".32em").style("text-anchor","end"),D.attr("d","M"+-p+","+B[0]+"H0V"+B[1]+"H"+-p);break;case"right":j=d,E.attr("x2",o),H.attr("x",Math.max(o,0)+q),F.attr("x2",o).attr("y2",0),I.attr("x",Math.max(o,0)+q).attr("y",0),G.attr("dy",".32em").style("text-anchor","start"),D.attr("d","M"+p+","+B[0]+"H0V"+B[1]+"H"+p)}if(v.rangeBand){varJ=v,K=J.rangeBand()/2;u=v=function(a){returnJ(a)+K}}elseu.rangeBand?u=v:z.call(j,v);y.call(j,u),A.call(j,v)})}varj,k,l,m=a.scale.linear(),n="bottom",o=6,p=6,q=3,r=null,s=0,t=!0;returni.scale=function(a){returnarguments.length?(m=a,i):m},i.orient=function(a){returnarguments.length?(n=ain{top:1,right:1,bottom:1,left:1}?a+"":"bottom",i):n},i.tickFormat=function(a){returnarguments.length?(j=a,i):j},i.tickCentered=function(a){returnarguments.length?(l=a,i):l},i.tickOffset=function(){returns},i.ticks=function(){returnarguments.length?(k=arguments,i):k},i.tickCulling=function(a){returnarguments.length?(t=a,i):t},i.tickValues=function(a){if("function"==typeofa)r=function(){returna(m.domain())};else{if(!arguments.length)returnr;r=a}returni},i}vare,f,g={version:"0.3.0"};g.generate=function(a){returnnewb(a)},g.chart={fn:b.prototype,internal:{fn:c.prototype}},e=g.chart.fn,f=g.chart.internal.fn,f.init=function(){vara=this,b=a.config;if(a.initParams(),b.data_url)a.convertUrlToData(b.data_url,b.data_mimeType,b.data_keys,a.initWithData);elseif(b.data_json)a.initWithData(a.convertJsonToData(b.data_json,b.data_keys));elseif(b.data_rows)a.initWithData(a.convertRowsToData(b.data_rows));else{if(!b.data_columns)throwError("url or json or rows or columns is required.");a.initWithData(a.convertColumnsToData(b.data_columns))}},f.initParams=function(){vara=this,b=a.d3,c=a.config;a.clipId="c3-"++newDate+"-clip",a.clipIdForXAxis=a.clipId+"-xaxis",a.clipIdForYAxis=a.clipId+"-yaxis",a.clipPath=a.getClipPath(a.clipId),a.clipPathForXAxis
})).filter(function(a){returna.x-b===0})},f.filterRemoveNull=function(a){returna.filter(function(a){returnzb(a.value)})},f.hasDataLabel=function(){vara=this.config;return"boolean"==typeofa.data_labels&&a.data_labels?!0:"object"==typeofa.data_labels&&Ib(a.data_labels)?!0:!1},f.getDataLabelLength=function(a,b,c,d){vare=this,f=[0,0],g=1.3;returne.selectChart.select("svg").selectAll(".dummy").data([a,b]).enter().append("text").text(function(a){returne.formatByAxisId(c)(a)}).each(function(a,b){f[b]=this.getBoundingClientRect()[d]*g}).remove(),f},f.isNoneArc=function(a){returnthis.hasTarget(this.data.targets,a.id)},f.isArc=function(a){return"data"ina&&this.hasTarget(this.data.targets,a.data.id)},f.findSameXOfValues=function(a,b){varc,d=a[b].x,e=[];for(c=b-1;c>=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c<a.length&&d===a[c].x;c++)e.push(a[c]);returne},f.findClosestOfValues=function(a,b,c,d){vare,f=this,g=c?c:0,h=d?d:a.length-1,i=Math.floor((h-g)/2)+g,j=a[i],k=f.x(j.x)-b[f.config.axis_rotated?1:0];returnk>0?h=i:g=i,h-g===1||0===g&&0===h?(e=[],(a[g].x||0===a[g].x)&&(e=e.concat(f.findSameXOfValues(a,g))),(a[h].x||0===a[h].x)&&(e=e.concat(f.findSameXOfValues(a,h))),f.findClosest(e,b)):f.findClosestOfValues(a,b,g,h)},f.findClosestFromTargets=function(a,b){varc,d=this;returnc=a.map(function(a){returnd.findClosestOfValues(a.values,b)}),d.findClosest(c,b)},f.findClosest=function(a,b){varc,d,e=this;returna.forEach(function(a){varf=e.dist(a,b);(c>f||!c)&&(c=f,d=a)}),d},f.dist=function(a,b){varc=this,d=c.config,e="y"===c.getAxisId(a.id)?c.y:c.y2,f=d.axis_rotated?1:0,g=d.axis_rotated?0:1;returnMath.pow(c.x(a.x)-b[f],2)+Math.pow(e(a.value)-b[g],2)},f.convertUrlToData=function(a,b,c,d){vare=this,f=b?b:"csv";e.d3.xhr(a,function(a,b){varg;g="json"===f?e.convertJsonToData(JSON.parse(b.response),c):e.convertCsvToData(b.response),d.call(e,g)})},f.convertCsvToData=function(a){varb,c=this.d3,d=c.csv.parseRows(a);return1===d.length?(b=[{}],d[0].forEach(function(a){b[0][a]=null})):b=c.csv.parse(a),b},f.convertJsonToData=function(a,b){varc,d,e=this,f=[];returnb?(c=b.value,b.x&&(c.push(b.x),e.config.data_x=b.x),f.push(c),a.forEach(function(a){varb=[];c.forEach(function(c){vard=Cb(a[c])?null:a[c];b.push(d)}),f.push(b)}),d=e.convertRowsToData(f)):(Object.keys(a).forEach(function(b){f.push([b].concat(a[b]))}),d=e.convertColumnsToData(f)),d},f.convertRowsToData=function(a){varb,c,d=a[0],e={},f=[];for(b=1;b<a.length;b++){for(e={},c=0;c<a[b].length;c++){if(Cb(a[b][c]))thrownewError("Source data is missing a component at ("+b+","+c+")!");e[d[c]]=a[b][c]}f.push(e)}returnf},f.convertColumnsToData=function(a){varb,c,d,e=[];for(b=0;b<a.length;b++)for(d=a[b][0],c=1;c<a[b].length;c++){if(Cb(e[c-1])&&(e[c-1]={}),Cb(a[b][c]))thrownewError("Source data is missing a component at ("+b+","+c+")!");e[c-1][d]=a[b][c]}returne},f.convertDataToTargets=function(a,b){varc,d=this,e=d.config,f=d.d3.keys(a[0]).filter(d.isNotX,d),g=d.d3.keys(a[0]).filter(d.isX,d);returnf.forEach(function(c){varf=d.getXKey(c);d.isCustomX()||d.isTimeSeries()?g.indexOf(f)>=0?d.data.xs[c]=(b&&d.data.xs[c]?d.data.xs[c]:[]).concat(a.map(function(a){returna[f]}).filter(zb).map(function(a,b){returnd.generateTargetX(a,c,b)})):e.data_x?d.data.xs[c]=d.getOtherTargetXs():Ib(e.data_xs)&&(d.data.xs[c]=d.getXValuesOfXKey(f,d.data.targets)):d.data.xs[c]=a.map(function(a,b){returnb})}),f.forEach(function(a){if(!d.data.xs[a])thrownewError('x is not defined for id = "'+a+'".')}),c=f.map(function(b,c){varf=e.data_idConverter(b);return{id:f,id_org:b,values:a.map(function(a,g){varh=d.getXKey(b),i=a[h],j=d.generateTargetX(i,b,g);returnd.isCustomX()&&d.isCategorized()&&0===c&&i&&(0===g&&(e.axis_x_categories=[]),e.axis_x_categories.push(i)),(Cb(a[b])||d.data.xs[b].length<=g)&&(j=void0),{x:j,value:null===a[b]||isNaN(a[b])?null:+a[b],id:f}}).filter(function(a){returnDb(a.x)})}}),c.forEach(function(a){varb;a.values=a.values.sort(function(a,b){varc=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;returnc-d}),b=0,a.values.forEach(function(a){a.index=b++}),d.data.xs[a.id].sort(funct