|
|
|
!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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.round(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.round(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b<c[1];b++)d.push(b);return d.length>0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&a<u.length?u[a]:a;return j?j(c):c}function i(i){i.each(function(){function i(a){var b=m(a)+s;return B[0]<b&&b<B[1]?o:0}var j,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=a.transition(x.exit()).style("opacity",1e-6).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");var E=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.round((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){var J=v,K=J.rangeBand()/2;u=v=function(a){return J(a)+K}}else u.rangeBand?u=v:z.call(j,v);y.call(j,u),A.call(j,v)})}var j,k,l,m=a.scale.linear(),n="bottom",o=6,p=6,q=3,r=null,s=0,t=!0,u=[];return i.scale=function(a){return arguments.length?(m=a,i):m},i.orient=function(a){return arguments.length?(n=a in{top:1,right:1,bottom:1,left:1}?a+"":"bottom",i):n},i.tickFormat=function(a){return arguments.length?(j=a,i):j},i.tickCentered=function(a){return arguments.length?(l=a,i):l},i.tickOffset=function(){return s},i.ticks=function(){return arguments.length?(k=arguments,i):k},i.tickCulling=function(a){return arguments.length?(t=a,i):t},i.tickValues=function(a){return arguments.length?(r=a,i):r},i.categories=function(a){return arguments.length?(u=a,i):u},i}var f={version:"0.1.37"},g={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",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLi
|
|
|
|
for(q=wh?function(a){return e(a.value)}:function(a){return b(a.x)},r=wh?function(a){return b(a.x)}:function(a){return e(a.value)},i=Vi?function(a,c,d,f){var g=a.x.getTime(),h=c.x-a.x,i=new Date(g+h*d),j=new Date(g+h*(d+f));return"M"+b(i)+" "+e(k(d))+" "+b(j)+" "+e(k(d+f))}:function(a,c,d,f){return"M"+b(j(d),!0)+" "+e(k(d))+" "+b(j(d+f),!0)+" "+e(k(d+f))},g=0;g<a.length;g++){if(c(u)||!De(a[g].x,u))t+=" "+q(a[g])+" "+r(a[g]);else for(j=X(a[g-1].x,a[g].x,Vi),k=X(a[g-1].value,a[g].value),l=b(a[g].x)-b(a[g-1].x),m=e(a[g].value)-e(a[g-1].value),n=Math.sqrt(Math.pow(l,2)+Math.pow(m,2)),o=2/n,p=2*o,h=o;1>=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function hf(b){var c,d,e;if(Gj=Mf.select(Pf),Gj.empty())throw new Error("Element to bind not found");if(Gj.html("").classed("c3",!0),Nf.data.xs={},Nf.data.targets=zc(b),bh&&(Nf.data.targets=Nf.data.targets.filter(bh)),ah&&Oc(ah===!0?Gc(Nf.data.targets):ah),p(),V(),Dg.domain(Mf.extent(dc(Nf.data.targets))),Eg.domain(_b(Nf.data.targets,"y")),Fg.domain(_b(Nf.data.targets,"y2")),Gg.domain(Dg.domain()),Hg.domain(Eg.domain()),Ig.domain(Fg.domain()),Hj=Dg.domain(),vj.scale(Gg),Wf&&zj.scale(Dg),Aj=Gj.append("svg").style("overflow","hidden").on("mouseenter",$f).on("mouseleave",_f),Bj=Aj.append("defs"),Bj.append("clipPath").attr("id",Pi).append("rect"),Bj.append("clipPath").attr("id",Qi).append("rect"),Bj.append("clipPath").attr("id",Ri).append("rect"),uf(),Cj=Aj.append("g").attr("transform",mj.main),Dj=Aj.append("g").attr("transform",mj.context),Ej=Aj.append("g").attr("transform",mj.legend),nh||Dj.style("visibility","hidden"),qh||(Ej.style("visibility","hidden"),gj=Gc(Nf.data.targets)),Fj=Gj.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Hf(Gc(Nf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=Cj.append("g").attr("clip-path",Si).attr("class",g.grid),fi&&d.append("g").attr("class",g.xgrids),Fe(hi)&&d.append("g").attr("class",g.xgridLines),ni&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ii&&d.append("g").attr("class",g.ygrids),Fe(ji)&&d.append("g").attr("class",g.ygridLines),Cj.append("g").attr("clip-path",Si).attr("class",g.regions),Cj.append("g").attr("clip-path",Si).attr("class",g.chart),c=Cj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Wf?wh?"ns-resize":"ew-resize":null),Cj.select("."+g.chart).append("g").attr("class",g.chartBars),Cj.select("."+g.chart).append("g").attr("class",g.chartLines),Cj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",mj.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Vb()),Cj.select("."+g.chart).append("g").attr("class",g.chartTexts),Wf&&Cj.insert("rect",Yf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",gg).attr("height",ig).style("opacity",0).style("cursor",wh?"ns-resize":"ew-resize").call(zj).on("dblclick.zoom",null),Nh&&vj.extent("function"!=typeof Nh?Nh:Nh(dc())),hj.x=Cj.append("g").attr("class",g.axisX).attr("clip-path",Ti).attr("transform",mj.x).style("visibility",xh?"visible":"hidden"),hj.x.append("text").attr("class",g.axisXLabel).attr("transform",wh?"rotate(-90)":"").style("text-anchor",Eb),hj.y=Cj.append("g").attr("class",g.axisY).attr("clip-path",Ui).attr("transform",mj.y).style("visibility",Ph?"visible":"hidden"),hj.y.append("text").attr("class",g.axisYLabel).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Fb),hj.y2=Cj.append("g").attr("class",g.axisY2).attr("transform",mj.y2).style("visibility",Yh?"visible":"hidden"),hj.y2.append("text").attr("class",g.axisY2Label).attr("transform",wh?"":"rotate(-90)").style("text-anchor",Gb),Dj.append("g").attr("clip-path",Si).attr("class",g.chart),Dj.select("."+g.chart).append("g").attr("class",g.chartBars),Dj.select("."+g.chart).append("g").attr("class",g.chartLines),Dj.append("g").attr("clip-path",Si).attr("class",g.brush).call(vj).selectAll("rect").attr(wh?"width":"height",wh?hg:jg),hj.subx=Dj.append("g").attr("class",g.a
|
|
|
|
},x:function(){return"translate(0,"+(wh?0:ig)+")"},y:function(){return"translate(0,"+(wh?ig:0)+")"},y2:function(){return"translate("+(wh?0:gg)+","+(wh?1:0)+")"},subx:function(){return"translate(0,"+(wh?0:jg)+")"},arc:function(){return"translate("+pg/2+","+qg/2+")"}},nj="right"===rh,oj=0,pj=0,qj=0,rj=.15,sj=30,tj=wh&&!xh?0:30,uj=5;ug=Mf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var vj,wj=function(){var a=Mf.svg.line().x(wh?function(a){return $(a.id)(a.value)}:Id).y(wh?Id:function(a){return $(a.id)(a.value)});return ri||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ri?Te(b.values):b.values;return me(b)?(a.interpolate(ne(b)?"cardinal":"linear"),Zg[b.id]?gf(e,Dg,$(b.id),Zg[b.id]):a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),xj=function(){var a;return a=wh?Mf.svg.area().x0(function(a){return $(a.id)(0)}).x1(function(a){return $(a.id)(a.value)}).y(Id):Mf.svg.area().x(Id).y0(function(a){return $(a.id)(0)}).y1(function(a){return $(a.id)(a.value)}),function(b){var c,d,e=Te(b.values);return ge([b],"area")||ge([b],"area-spline")?(a.interpolate(ne(b)?"cardinal":"linear"),a(e)):(c=e[0]?Dg(e[0].x):0,d=e[0]?$(b.id)(e[0].value):0,wh?"M "+d+" "+c:"M "+c+" "+d)}}(),yj=function(){var a=Mf.svg.line().x(wh?function(a){return _(a.id)(a.value)}:Ld).y(wh?Ld:function(a){return _(a.id)(a.value)});return function(b){var c=Te(b.values);return me(b)?a(c):"M "+Gg(c[0].x)+" "+_(b.id)(c[0].value)}}(),zj=function(){};vj=Mf.svg.brush().on("brush",rf),vj.update=function(){return Dj&&Dj.select("."+g.brush).call(this),this},vj.scale=function(a){return wh?this.y(a):this.x(a)},Wf&&(zj=Mf.behavior.zoom().on("zoomstart",function(){zj.altDomain=Mf.event.sourceEvent.altKey?Dg.orgDomain():null}).on("zoom",Wf?sf:null),zj.scale=function(a){return wh?this.y(a):this.x(a)},zj.orgScaleExtent=function(){var a=Xf?Xf:[1,10];return[a[0],Math.max(Dc()/a[1],a[1])]},zj.updateScaleExtent=function(){var a=ec(Dg.orgDomain())/ec(Hj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var Aj,Bj,Cj,Dj,Ej,Fj,Gj,Hj,Ij,Jj={};if(Nf.focus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),Nf.defocus(),b(d.classed(g.focused,!0)),b(e),le(Nf.data.targets)&&Rb(a,!0),Df(a,!0)},Nf.defocus=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",.3)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);Nf.revert(),b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Df(a,!1)},Nf.revert=function(a){function b(a){Lc(a).transition().duration(100).style("opacity",1)}var c=Aj.selectAll(sd(a)),d=c.filter(If),e=c.filter(Jf);b(d.classed(g.focused,!1)),b(e),le(Nf.data.targets)&&Sb(a),Ef()},Nf.show=function(a,b){a=Hc(a),b=b||{},Pc(a),Aj.selectAll(td(a)).transition().style("opacity",1),b.withLegend&&Ff(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.hide=function(a,b){a=Hc(a),b=b||{},Oc(a),Aj.selectAll(td(a)).transition().style("opacity",0),b.withLegend&&Gf(a),qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Nf.toggle=function(a){Jc(a)?Nf.hide(a):Nf.show(a)},Nf.unzoom=function(){vj.clear().update(),qf({withUpdateXDomain:!0})},Nf.load=function(a){return a.xs&&rc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Sg[b]=a.classes[b]}),"categories"in a&&Wi&&(Ah=a.categories,Jg.categories(Ah)),"cacheIds"in a&&fc(a.cacheIds)?void yf(hc(a.cacheIds),a.done):void("unload"in a?Af(Hc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){zf(a)}):zf(a))},Nf.unload=function(a,b){Af(Hc(a),function(){qf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Nf.selected=function(a){return Mf.merge(Cj.selectAll("."+g.shapes+rd(a)).selectAll("."+g.shape).filter(function(){return Mf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Nf.select=function(a,b,c){ch&&Cj.selectAll("."+g.shapes).selectAll("."
|