mirror of https://github.com/masayuki0812/c3.git
Quite good looking graph derived from d3.js
http://c3js.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3 lines
78 KiB
3 lines
78 KiB
!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.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(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){return j?j(a):a}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.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){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;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}var f={version:"0.1.42"},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",chartArcsBackground:"c3-chart-arcs-background",chartArcsGaugeUnit:"c3-chart-arcs-gauge-unit",chartArcsGaugeMax:"c3-chart-arcs-gauge-max",chartArcsGaugeMin:"c3-chart-arcs-gauge-min",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",gaugeValue:"c3-gauge-value",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",axis:"c3-axis",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",legendItemFocused:"c3-legend-item-focused",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};f.generate=function(f){function h(a,b){if(!(a in f))throw Error(b)}function i(a,b){var c,d,e,g=f;for(c=0;c<a.length;c++){if("object"==typeof g&&!(a[c]in g))return b;if(d=c===a.length-1,e=g[a[c]],!d&&"object"!=typeof e)return b;g=e}return g}function j(b){var c=a.navigator.appVersion.toLowerCase().indexOf("msie 9.")>=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=fk.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=fk.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=fk.select("."+g.axisY2),a&&(e=e.transition())),fk.attr("transform",Uj.main),c.attr("transform",Uj.x),d.attr("transform",Uj.y),e.attr("transform",Uj.y2),fk.select("."+g.chartArcs).attr("transform",Uj.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=gk.select("."+g.axisX),a&&(c=c.transition())),gk.attr("transform",Uj.context),c.attr("transform",Uj.subx)}function n(a){(a?hk.transition():hk).attr("transform",Uj.legend)}function o(a,b){l(a,b),Hh&&m(a,b),n(a)}function p(){var a=V(),b=U(),c=Vj?0:a,d=te(fg.data.targets),e=Rh||d?0:A("x"),f=Hh&&!d?Ih+e:0;Eg=t(),Fg=u(),Rh?(xg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},yg={top:xg.top,right:0/0,bottom:20+c,left:$j}):(xg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},yg={top:Fg-f-c,right:0/0,bottom:e+c,left:xg.left}),zg={top:Vj?0:Fg-a,right:0/0,bottom:0,left:Vj?Eg-b:0},Ag=Eg-xg.left-xg.right,Cg=Fg-xg.top-xg.bottom,0>Ag&&(Ag=0),0>Cg&&(Cg=0),Bg=Rh?xg.left-$j-_j:Ag,Dg=Rh?Cg:Fg-yg.top-yg.bottom,0>Bg&&(Bg=0),0>Dg&&(Dg=0),Jg=Ag-(Vj?b+10:0),Kg=Cg-(Vj?0:10),r(),Vj&&d&&(zg.left=Jg/2+1.1*Hg)}function q(){fk.select("line."+g.xgridFocus).attr("x1",Rh?0:-10).attr("x2",Rh?Ag:-10).attr("y1",Rh?-10:xg.top).attr("y2",Rh?-10:Cg)}function r(){var a;Hg=Math.min(Jg,Kg)/2,Gg=.95*Hg,a=dj?(Gg-dj)/Gg:.6,Ig=se(fg.data.targets)||re(fg.data.targets)?Gg*a:0}function s(){var a=Rh?g.axisX:g.axisY,b=fk.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=jk.node().getBoundingClientRect(),e=te(fg.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return ig?ig:C()}function u(){var a=jg?jg:D();return a>0?a:320}function v(){return mg?mg:0}function w(){return ng?ng:0}function x(){return kg?kg:Rh?Sh?Math.max(Xe(z("x")),40):1:!ii||ni?1:Xe(z("y"))}function y(){var a=10,b=Vj?U()+20:0;return lg?lg:Rh?a+b:(!ri||wi?a:Xe(z("y2")))+b}function z(a){var b=pb(a);return b.isInner?20+Ib(a):40+Ib(a)}function A(a){return"x"!==a||Sh?"x"===a&&fi?fi:"y"!==a||ii?"y2"!==a||ri?(pb(a).isInner?30:40)+("y2"===a?-10:0):ak:Lh&&!Vj?10:1:0}function B(a){for(var b,c=jk.node();c&&"BODY"!==c.tagName&&!(b=c.getBoundingClientRect()[a]);)c=c.parentNode;return b}function C(){return B("width")}function D(){var a=jk.style("height");return a.indexOf("px")>0?+a.replace("px",""):0}function E(a){return a?-31:-(xg.left-1)}function F(a){return a?-20:-4}function G(){return E(!Rh)}function H(){return F(!Rh)}function I(){return E(Rh)}function J(){return F(Rh)}function K(a){return a?Ag+2+30+30:xg.left+20}function L(a){return a?(fi?fi:0)+80:Cg+8}function M(){return K(!Rh)}function N(){return L(!Rh)}function O(){return K(Rh)}function P(){return L(Rh)}function Q(){var a,b,c,d,e,f,g=Lc(fg.data.targets);return g?(a=g.values[0],b=g.values[g.values.length-1],c=Xg(b.x)-Xg(a.x),0===c?Rh?Cg:Ag:(d=Kc(),e=oe(fg.data.targets)?(d-(Bj?.25:1))/d:1,f=d>1?c*e/(d-1):c,1>f?1:f)):0}function R(a){Wj=a}function S(a){Xj=a}function T(a){Yj=a}function U(){return Lh?Vj?Xj*(Wj+1):Eg:0}function V(){return Lh?Vj?Fg:Yj*(Wj+1):0}function W(){var a,b,c=!Xg;Pg=Rh?1:0,Qg=Rh?Cg:Ag,Rg=Rh?0:Cg,Sg=Rh?Ag:1,Tg=Pg,Ug=Qg,Vg=Rh?0:Dg,Wg=Rh?Bg:1,Xg=Z(Pg,Qg,c?void 0:Xg.domain(),function(){return bh.tickOffset()}),Yg=$(Rg,Sg,c?void 0:Yg.domain()),Zg=$(Rg,Sg,c?void 0:Zg.domain()),$g=Z(Pg,Qg,kk,function(a){return a%1?0:eh.tickOffset()}),_g=$(Vg,Wg,c?void 0:_g.domain()),ah=$(Vg,Wg,c?void 0:ah.domain()),a=eb(),b=ai?ai:c?void 0:bh.tickValues(),bh=bb(Xg,Qj,a,b),eh=bb($g,Tj,a,b),ch=cb(Yg,Rj,oi,qi),dh=cb(Zg,Sj,xi,zi),c||(bk.scale($g),og&&ck.scale(Xg)),X()}function X(){Lg=Lb(),Mg=Mb(),Ng=Mb(.98)}function Y(a,b,c){return(c?eg.time.scale():eg.scale.linear()).range([a,b])}function Z(a,b,c,d){var e,f=Y(a,b,Aj),g=c?f.domain(c):f;Bj?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return kk&&kk[0]===a[0]&&kk[1]<a[1]&&(a[1]=kk[1]),a},Bj&&(f.domain=function(a){return arguments.length?(kk=a,g.domain(a),f):(a=this.orgDomain(),[a[0],a[1]+1])}),f}function $(a,b,c){var d=Y(a,b);return c&&d.domain(c),d}function _(a){return"y2"===db(a)?Zg:Yg}function ab(a){return"y2"===db(a)?ah:_g}function bb(a,b,c,d){var f=e(eg,Bj).scale(a).orient(b);return f.tickFormat(c).tickValues(d),Bj?(f.tickCentered(Wh),Qe(Yh)&&(Yh=!1)):f.tickOffset=function(){var a=Mc(fg.data.targets),b=Xg(a[1])-Xg(a[0]),c=b?b:Rh?Cg:Ag;return c/Kc()/2},f}function cb(a,b,c,d){return e(eg).scale(a).orient(b).tickFormat(c).ticks(d)}function db(a){return a in mh?mh[a]:"y"}function eb(){var a=Aj?Mj:Bj?bd:function(a){return 0>a?a.toFixed(0):a};return Xh&&("function"==typeof Xh?a=Xh:Aj&&(a=function(a){return a?Lj(Xh)(a):""})),a}function fb(a){var b;return"y"===a?b=mi:"y2"===a?b=vi:"x"===a&&(b=hi),b}function gb(a){var b=fb(a);return"string"==typeof b?b:b?b.text:null}function hb(a,b){var c=fb(a);"string"==typeof c?"y"===a?mi=b:"y2"===a?vi=b:"x"===a&&(hi=b):c&&(c.text=b)}function ib(a){return 10*Math.sin(Math.PI*(a/180))}function jb(a){return 11.5-2.5*(a/15)}function kb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",jb(c)).attr("x",ib(c)).attr("transform","rotate("+c+")")}function lb(a,b){var c=fb(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 mb(){return lb("x",Rh?"inner-top":"inner-right")}function nb(){return lb("y",Rh?"inner-right":"inner-top")}function ob(){return lb("y2",Rh?"inner-right":"inner-top")}function pb(a){return"y2"===a?ob():"y"===a?nb():mb()}function qb(){return gb("x")}function rb(){return gb("y")}function sb(){return gb("y2")}function tb(a,b){return a?b.isLeft?0:b.isCenter?Ag/2:Ag:b.isBottom?-Cg:b.isMiddle?-Cg/2:0}function ub(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function vb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function wb(){return tb(!Rh,mb())}function xb(){return tb(Rh,nb())}function yb(){return tb(Rh,ob())}function zb(){return ub(!Rh,mb())}function Ab(){return ub(Rh,nb())}function Bb(){return ub(Rh,ob())}function Cb(){var a=mb();return Rh?a.isInner?"1.2em":-25-Ib("x"):a.isInner?"-0.5em":fi?fi-10:"3em"}function Db(){var a=nb();return Rh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Ib("y")}function Eb(){var a=ob();return Rh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Ib("y2")}function Fb(){return vb(!Rh,mb())}function Gb(){return vb(Rh,nb())}function Hb(){return vb(Rh,ob())}function Ib(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return eg.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();b<a.width&&(b=a.width)}),0>b?0:b}function Jb(a){var b=fk.select("."+g.axisX+" ."+g.axisXLabel),c=fk.select("."+g.axisY+" ."+g.axisYLabel),d=fk.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",wb).attr("dx",zb).attr("dy",Cb).text(qb),(a?c.transition():c).attr("x",xb).attr("dx",Ab).attr("dy",Db).attr("dy",Db).text(rb),(a?d.transition():d).attr("x",yb).attr("dx",Bb).attr("dy",Eb).text(sb)}function Kb(a){var b=!1;if(Og(Sc(fg.data.targets)).forEach(function(c){b||c.data.id!==a.data.id||(b=!0,a=c)}),isNaN(a.endAngle)&&(a.endAngle=a.startAngle),Be(a.data)){var c=Zi,d=$i,e=Math.abs(c)+d,f=Math.PI/e;a.startAngle=-1*(Math.PI/2)+f*Math.abs(c),a.endAngle=a.startAngle+f*(a.value>d?d:a.value)}return b?a:null}function Lb(){var a=eg.svg.arc().outerRadius(Gg).innerRadius(Ig),b=function(b,c){var d;return c?a(b):(d=Kb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Mb(a){var b=eg.svg.arc().outerRadius(Hg*(a?a:1)).innerRadius(Ig);return function(a){var c=Kb(a);return c?b(c):"M 0 0"}}function Nb(a,b,c){return c||De(a.data)?Lg(a,b):"M 0 0"}function Ob(a){var b,c,d,e,f,g=Kb(a),h="";return g&&!re(fg.data.targets)&&(b=Lg.centroid(g),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),f=(36/Gg>.375?1.175-36/Gg:.8)*Gg/e,h="translate("+c*f+","+d*f+")"),h}function Pb(a){var b=re(fg.data.targets)?Math.PI:2*Math.PI;return a?(a.endAngle-a.startAngle)/b:null}function Qb(a){return zc({id:a.data.id,value:a.value,ratio:Pb(a)})}function Rb(a){var b,c,d,e;return Ub()?(b=Kb(a),c=b?b.value:null,d=Pb(b),Vb(d)?(e=Wb(),e?e(c,d):Nd(c,d)):""):""}function Sb(a,b){var c=dk.selectAll("."+g.chartArc+zd(a)),d=dk.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});Je(a)&&c.selectAll("path").transition().duration(50).attr("d",Mg).transition().duration(100).attr("d",Ng).each(function(a){Ce(a.data)}),b||d.style("opacity",.3)}function Tb(a){var b=dk.selectAll("."+g.chartArc+zd(a));b.selectAll("path."+g.arc).transition().duration(50).attr("d",Lg),dk.selectAll("."+g.arc).style("opacity",1)}function Ub(){var a=!0;return se(fg.data.targets)?a=ej:qe(fg.data.targets)&&(a=Pi),a}function Vb(a){var b=se(fg.data.targets)?gj:Ri;return a>=b}function Wb(){var a=Qi;return re(fg.data.targets)?a=Xi:se(fg.data.targets)&&(a=fj),a}function Xb(){return se(fg.data.targets)?ij:""}function Yb(){var a=Ti;return re(fg.data.targets)?a=_i:se(fg.data.targets)&&(a=jj),"function"==typeof a?a:function(){}}function Zb(){var a=Ui;return re(fg.data.targets)?a=aj:se(fg.data.targets)&&(a=kj),"function"==typeof a?a:function(){}}function $b(){var a=Vi;return re(fg.data.targets)?a=bj:se(fg.data.targets)&&(a=lj),"function"==typeof a?a:function(){}}function _b(a,c,d,e){var f="ratio"===a.unit?e:1;return b(a[c])?a[c]*f:d}function ac(a){var b,c,d,e,f,g,h=Nc(a),i=Zc(a);if(lh.length>0)for(g=_c(a),b=0;b<lh.length;b++)if(e=lh[b].filter(function(a){return h.indexOf(a)>=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;c<e.length;c++)f=e[c],i[f]&&i[f].forEach(function(a,b){db(f)!==db(d)||!i[d]||g&&+a>0||(i[d][b]+=+a)});return eg.min(Object.keys(i).map(function(a){return eg.min(i[a])}))}function bc(a){var b,c,d,e,f,g,h=Nc(a),i=Zc(a);if(lh.length>0)for(g=ad(a),b=0;b<lh.length;b++)if(e=lh[b].filter(function(a){return h.indexOf(a)>=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<e.length;c++)f=e[c],i[f]&&i[f].forEach(function(a,b){db(f)!==db(d)||!i[d]||g&&0>+a||(i[d][b]+=+a)});return eg.max(Object.keys(i).map(function(a){return eg.max(i[a])}))}function cc(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return db(a.id)===c}),m="y2"===c?ti:ki,n="y2"===c?si:ji,o=b(m)?m:ac(l),p=b(n)?n:bc(l),q="y2"===c?ui:li,r=Hd()&&Rh;return 0===l.length?"y2"===c?Zg.domain():Yg.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=Id(o,p),j=ic(Yg.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&&pi&&(f=_b(pi,"top",e,d),g=_b(pi,"bottom",e,d)),"y2"===c&&yi&&(f=_b(yi,"top",e,d),g=_b(yi,"bottom",e,d)),oe(l)&&!_c(l)&&(g=o),[o-g,p+f])}function dc(a){return di?Aj?Me(di):di:eg.min(a,function(a){return eg.min(a.values,function(a){return a.x})})}function ec(a){return ci?Aj?Me(ci):ci:eg.max(a,function(a){return eg.max(a.values,function(a){return a.x})})}function fc(a){var c,d,e,f,g=Mc(a),h=g[1]-g[0];return Bj?d=0:oe(a)?(c=Kc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ei&&Re(ei)?(e=b(ei.left)?ei.left:d,f=b(ei.right)?ei.right:d):e=f="number"==typeof ei?ei:d,{left:e,right:f}}function gc(a){var b=[dc(a),ec(a)],c=b[0],d=b[1],e=fc(a),f=0,g=0;return c-d!==0||Bj||(c=Aj?new Date(.5*c.getTime()):-.5,d=Aj?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Aj?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Aj?new Date(d.getTime()+e.right):d+e.right),[f,g]}function hc(a,b,c){c&&(Xg.domain(eg.extent(gc(a))),kk=Xg.domain(),og&&ck.scale(Xg).updateScaleExtent(),$g.domain(Xg.domain()),bk.scale($g)),b&&(Xg.domain(bk.empty()?kk:bk.extent()),og&&ck.scale(Xg).updateScaleExtent())}function ic(a){return a[1]-a[0]}function jc(a){for(var b=0;b<a.length;b++)if(!(a[b]in gg))return!1;return!0}function kc(a,b){gg[a]=Hc(b)}function lc(a){for(var b=[],c=0;c<a.length;c++)a[c]in gg&&b.push(Hc(gg[a[c]]));return b}function mc(a){var b,c="y"===a.axis?Yg:Zg;return b="y"===a.axis||"y2"===a.axis?Rh?"start"in a?c(a.start):0:0:Rh?0:"start"in a?Xg(Aj?Me(a.start):a.start):0}function nc(a){var b,c="y"===a.axis?Yg:Zg;return b="y"===a.axis||"y2"===a.axis?Rh?0:"end"in a?c(a.end):0:Rh?"start"in a?Xg(Aj?Me(a.start):a.start):0:0}function oc(a){var b,c=mc(a),d="y"===a.axis?Yg:Zg;return b="y"===a.axis||"y2"===a.axis?Rh?"end"in a?d(a.end):Ag:Ag:Rh?Ag:"end"in a?Xg(Aj?Me(a.end):a.end):Ag,c>b?0:b-c}function pc(a){var b,c=nc(a),d="y"===a.axis?Yg:Zg;return b="y"===a.axis||"y2"===a.axis?Rh?Cg:"start"in a?d(a.start):Cg:Rh?"end"in a?Xg(Aj?Me(a.end):a.end):Cg:Cg,c>b?0:b-c}function qc(a){return fh&&a===fh||Re(gh)&&Se(gh,a)}function rc(a){return!qc(a)}function sc(a){return fh?fh:Re(gh)?gh[a]:null}function tc(a,b){var c,d=b&&Re(b)?Nc(b):[];return d.forEach(function(b){sc(b)===a&&(c=fg.data.xs[b])}),c}function uc(a,b){return a in fg.data.xs&&fg.data.xs[a]&&fg.data.xs[a][b]?fg.data.xs[a][b]:b}function vc(){var a=Object.keys(fg.data.xs);return a.length?fg.data.xs[a[0]]:null}function wc(a){var b=vc();return b&&a<b.length?b[a]:null}function xc(a){Object.keys(a).forEach(function(b){gh[b]=a[b]})}function yc(a){return 1===eg.set(Object.keys(a).map(function(b){return a[b]})).size()}function zc(a){var b;return a&&(b=jh[a.id],a.name=b?b:a.id),a}function Ac(a,b){var c=a.filter(function(a){return a.index===b});return c.length?c[0]:null}function Bc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=Dc(b[d],a.id,d)}),fg.data.xs[a.id]=b})}function Cc(a,b){a.forEach(function(a){b[a.id]&&Bc([a],b[a.id])})}function Dc(a,c,d){var e;return e=Aj?a?a instanceof Date?a:Me(a):Me(uc(c,d)):Cj&&!Bj?b(a)?+a:uc(c,d):d}function Ec(a){var b,c,d=a[0],e={},f=[];for(b=1;b<a.length;b++){for(e={},c=0;c<a[b].length;c++)e[d[c]]=a[b][c];f.push(e)}return f}function Fc(a){var b,d,e,f=[];for(b=0;b<a.length;b++)for(e=a[b][0],d=1;d<a[b].length;d++)c(f[d-1])&&(f[d-1]={}),f[d-1][e]=a[b][d];return f}function Gc(a,c){var d,e=eg.keys(a[0]).filter(rc),f=eg.keys(a[0]).filter(qc);return e.forEach(function(d){var e=sc(d);Cj||Aj?f.indexOf(e)>=0?fg.data.xs[d]=(c&&fg.data.xs[d]?fg.data.xs[d]:[]).concat(a.map(function(a){return a[e]}).filter(b).map(function(a,b){return Dc(a,d,b)})):fh?fg.data.xs[d]=vc():Re(gh)&&(fg.data.xs[d]=tc(e,fg.data.targets)):fg.data.xs[d]=a.map(function(a,b){return b})}),e.forEach(function(a){if(!fg.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),d=e.map(function(b,c){var d=ih(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=sc(b),g=a[f],h=Dc(g,b,e);return Cj&&Bj&&0===c&&g&&(0===e&&(Vh=[]),Vh.push(g)),("undefined"==typeof a[b]||fg.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})}}),d.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++})}),nh&&me(Nc(d).filter(function(a){return!(a in oh)}),nh),d.forEach(function(a){kc(a.id_org,a)}),d}function Hc(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 Ic(a){var b=Ac(fg.data.targets[0].values,a-1);return b?b.x:null}function Jc(a){var b=Ac(fg.data.targets[0].values,a+1);return b?b.x:null}function Kc(){return eg.max(fg.data.targets,function(a){return a.values.length})}function Lc(a){var b,c=a.length,d=0;return c>1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Mc(a){var b,c,d=Lc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Nc(a){return a.map(function(a){return a.id})}function Oc(a){return a?"string"==typeof a?[a]:a:Nc(fg.data.targets)}function Pc(a,b){var c,d=Nc(a);for(c=0;c<d.length;c++)if(d[c]===b)return!0;return!1}function Qc(a){return Nj.indexOf(a)<0}function Rc(a){return Oj.indexOf(a)<0}function Sc(a){return a.filter(function(a){return Qc(a.id)})}function Tc(a){var b=eg.set(eg.merge(a.map(function(a){return a.values.map(function(a){return a.x})}))).values();return b.map(Aj?function(a){return new Date(a)}:function(a){return+a})}function Uc(a,b){var c,d,e,f,g,h,i,j=a;if(b)if(c="function"==typeof b?b():b,1===c)j=[a[0]];else if(2===c)j=[a[0],a[a.length-1]];else if(c>2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Aj?new Date(i):i);j.push(e)}return Aj||(j=j.sort(function(a,b){return a-b})),j}function Vc(a){Nj=Nj.concat(a)}function Wc(a){Nj=Nj.filter(function(b){return a.indexOf(b)<0})}function Xc(a){Oj=Oj.concat(a)}function Yc(a){Oj=Oj.filter(function(b){return a.indexOf(b)<0})}function Zc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function $c(a,b){var c,d,e,f=Object.keys(a);for(c=0;c<f.length;c++)for(e=a[f[c]].values,d=0;d<e.length;d++)if(b(e[d].value))return!0;return!1}function _c(a){return $c(a,function(a){return 0>a})}function ad(a){return $c(a,function(a){return a>0})}function bd(a){return a<Vh.length?Vh[a]:a}function cd(a,b){return" "+a+" "+a+yd(b)}function dd(a){return cd(g.text,a.id)}function ed(a){return cd(g.texts,a.id)}function fd(a){return cd(g.shape,a.index)}function gd(a){return cd(g.shapes,a.id)}function hd(a){return fd(a)+cd(g.line,a.id)}function id(a){return gd(a)+cd(g.lines,a.id)}function jd(a){return fd(a)+cd(g.circle,a.index)}function kd(a){return gd(a)+cd(g.circles,a.id)}function ld(a){return fd(a)+cd(g.bar,a.index)}function md(a){return gd(a)+cd(g.bars,a.id)}function nd(a){return fd(a.data)+cd(g.arc,a.data.id)}function od(a){return gd(a.data)+cd(g.arcs,a.data.id)}function pd(a){return fd(a)+cd(g.area,a.id)}function qd(a){return gd(a)+cd(g.areas,a.id)}function rd(a,b){return cd(g.region,b)+" "+("class"in a?a.class:"")}function sd(a){return cd(g.eventRect,a.index)}function td(a){var b=kh[a],c="";return b&&(c=" "+g.target+"-"+b),cd(g.target,a)+c}function ud(a){return g.chartText+td(a.id)}function vd(a){return g.chartLine+td(a.id)}function wd(a){return g.chartBar+td(a.id)}function xd(a){return g.chartArc+td(a.data.id)}function yd(a){return a||0===a?"-"+(a.replace?a.replace(/([^a-zA-Z0-9-_])/g,"-"):a):""}function zd(a){return"."+g.target+yd(a)}function Ad(a){return a.length?a.map(function(a){return zd(a)}):null}function Bd(a){return"."+g.legendItem+yd(a)}function Cd(a){return a.length?a.map(function(a){return Bd(a)}):null}function Dd(a){return null!==a.value&&mk[a.id]?1:0}function Ed(a){var b=Gd(a);return Dd(a)*b}function Fd(a){return b(a.value)?ze(a)?.5:1:0}function Gd(){return Hd()?1:0}function Hd(){return"boolean"==typeof ph&&ph?!0:"object"==typeof ph&&Re(ph)?!0:!1}function Id(a,b){var c=[],d=1.3;return jk.select("svg").selectAll(".dummy").data([a,b]).enter().append("text").text(function(a){return Od(a.id)(a.value,a.id)}).each(function(a,b){c[b]=this.getBoundingClientRect().width*d}).remove(),c}function Jd(a){var b=a&&!re(fg.data.targets)?Nd:Kd,c=a&&!re(fg.data.targets)?Nd:Ld;return function(a,d,e){var f="y2"===db(e)?c:b;return f(a,d)}}function Kd(a){var b=oi?oi:Md;return b(a)}function Ld(a){var b=xi?xi:Md;return b(a)}function Md(a){return b(a)?+a:""}function Nd(a,b){return(100*b).toFixed(1)+"%"}function Od(a){var c=function(a){return b(a)?+a:""},d=db(a),e=c;return"function"==typeof ph.format?e=ph.format:"object"==typeof ph.format&&"function"==typeof ph.format[d]&&(e=ph.format[d]),e}function Pd(a){return a?Xg(a.x):null}function Qd(a){return Math.ceil(Xg(Aj?Me(a.value):a.value))}function Rd(a){var b=a.axis&&"y2"===a.axis?Zg:Yg;return Math.ceil(b(a.value))}function Sd(a){return a?$g(a.x):null}function Td(a,b){var c,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]);return e}function Ud(a,b,c,d){var e,f=c?c:0,g=d?d:a.length-1,h=Math.floor((g-f)/2)+f,i=a[h],j=Xg(i.x)-b[Rh?1:0];return j>0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Td(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Td(a,g))),Wd(e,b)):Ud(a,b,f,g)}function Vd(a,b){var c;return c=a.map(function(a){return Ud(a.values,b)}),Wd(c,b)}function Wd(a,b){var c,d;return a.forEach(function(a){var e=Te(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Xd(a,b){return eg.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Yd(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 Zd(){return qh&&"desc"===qh.toLowerCase()}function $d(){return qh&&"asc"===qh.toLowerCase()}function _d(a){var b=$d(),c=Zd();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 qh&&a.sort(qh),a}function ae(a,c){var d,e,f,g,h,i,j,k=te(fg.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&nj&&(ik.html(qj(a,eb(),Jd(k),Jj)).style("display","block"),d=ik.property("offsetWidth"),e=ik.property("offsetHeight"),k?(g=Ag/2+c[0],i=Cg/2+c[1]+20):(Rh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=Xg(l[0].x)+20):(f=s(),g=f+x()+Xg(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=h-j),i+e>u()&&(i-=e+30)),ik.style("top",i+"px").style("left",g+"px"))}function be(){ik.style("display","none")}function ce(a){var c=a.filter(function(a){return a&&b(a.value)});if(nj&&!pe(fg.data.targets)&&!te(fg.data.targets)){var d=fk.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(Rh?"y1":"x1",Pd).attr(Rh?"y2":"x2",Pd),Jf(d,"grid")}}function de(){fk.select("line."+g.xgridFocus).style("visibility","hidden")}function ee(a,b){var c,d,e,f,h=[],i=fk.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=gc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10),h.length>i&&(h=h.filter(function(a){return(""+a).indexOf(".")<0}));return h}function fe(a){var b,d,e={},f=0;return Sc(fg.data.targets.filter(a)).forEach(function(a){for(b=0;b<lh.length;b++)if(!(lh[b].indexOf(a.id)<0))for(d=0;d<lh[b].length;d++)if(lh[b][d]in e){e[a.id]=e[lh[b][d]];break}c(e[a.id])&&(e[a.id]=f++)}),e.__max__=f-1,e}function ge(a,b,c,d){var e=d?$g:Xg;return function(d){var f=d.id in c?c[d.id]:0;return d.x||0===d.x?e(d.x)-a*(b/2-f):0}}function he(a){return function(b){var c=a?ab(b.id):_(b.id);return c(b.value)}}function ie(a,b,c){var d=_d(Sc(fg.data.targets.filter(a))),e=d.map(function(a){return a.id});return function(a,f){var g=c?ab(a.id):_(a.id),h=g(0),i=h;return d.forEach(function(c){c.id!==a.id&&b[c.id]===b[a.id]&&e.indexOf(c.id)<e.indexOf(a.id)&&c.values[f].value*a.value>0&&(i+=g(c.values[f].value)-h)}),i}}function je(a){return a.x||0===a.x?Xg(a.x):null}function ke(a,b){var c=fe(ue),d=zf(c);return lh.length>0?d(a,b)[0][1]:_(a.id)(a.value)}function le(a,b){return"number"==typeof Ni?Ni:b?2*a.tickOffset()*Oi/b:0}function me(a,b){Oc(a).forEach(function(a){mk[a]=b===oh[a],oh[a]=b}),a||(nh=b)}function ne(a,b){var c=!1;return a.forEach(function(a){oh[a.id]===b&&(c=!0),a.id in oh||"line"!==b||(c=!0)}),c}function oe(a){return ne(a,"bar")}function pe(a){return ne(a,"scatter")}function qe(a){return"pie"===nh||ne(a,"pie")}function re(a){return ne(a,"gauge")}function se(a){return"donut"===nh||ne(a,"donut")}function te(a){return qe(a)||se(a)||re(a)}function ue(a){var b="string"==typeof a?a:a.id;return!(b in oh)||["line","spline","area","area-spline","step","area-step"].indexOf(oh[b])>=0}function ve(a){var b="string"==typeof a?a:a.id;return["step","area-step"].indexOf(oh[b])>=0}function we(a){var b="string"==typeof a?a:a.id;return["spline","area-spline"].indexOf(oh[b])>=0}function xe(a){var b="string"==typeof a?a:a.id;return["area","area-spline","area-step"].indexOf(oh[b])>=0}function ye(a){var b="string"==typeof a?a:a.id;return"bar"===oh[b]}function ze(a){var b="string"==typeof a?a:a.id;return"scatter"===oh[b]}function Ae(a){var b="string"==typeof a?a:a.id;return"pie"===oh[b]}function Be(a){var b="string"==typeof a?a:a.id;return"gauge"===oh[b]}function Ce(a){var b="string"==typeof a?a:a.id;return"donut"===oh[b]}function De(a){return Ae(a)||Ce(a)||Be(a)}function Ee(a){return ue(a)?[a]:[]}function Fe(a){return De(a.data)?[a]:[]}function Ge(a){return ye(a)?a.values:[]}function He(a){return ue(a)||ze(a)?a.values:[]}function Ie(a){return ye(a)||ue(a)?a.values:[]}function Je(a){return Ce(a)&&hj||Be(a)&&Yi||Ae(a)&&Si}function Ke(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?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 Le(a,b){var c="value"===b.unit,d=b.values&&b.values.length?b.values:[],e=b.max||100;return function(b){var f,g,h=a[a.length-1];for(f=0;f<d.length;f++)if(g=c?b:100*b/e,g<d[f]){h=a[f];break}return h}}function Me(b){var c;try{c=b instanceof Date||!hh?new Date(b):eg.time.format(hh).parse(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+hh)}return c}function Ne(a,b){var c=eg.mouse(a),d=eg.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))<b}function Oe(a){var b=eg.mouse(a),c=a.getBoundingClientRect(),d=a.pathSegList.getItem(0),e=a.pathSegList.getItem(1),f=d.x,g=Math.min(d.y,e.y),h=c.width,i=c.height,j=2,k=f-j,l=f+h+j,m=g+i+j,n=g-j;return k<b[0]&&b[0]<l&&n<b[1]&&b[1]<m}function Pe(a,b){var c;for(c=0;c<b.length;c++)if(b[c].start<a&&a<=b[c].end)return!0;return!1}function Qe(a){return!a||"string"==typeof a&&0===a.length||"object"==typeof a&&0===Object.keys(a).length}function Re(a){return Object.keys(a).length>0}function Se(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Te(a,b){var c="y"===db(a.id)?Yg:Zg,d=Rh?1:0,e=Rh?0:1;return Math.pow(Xg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ue(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ve(){var a=[],b=function(b,c){var d=setInterval(function(){var b=0;a.forEach(function(a){if(a.empty())return void(b+=1);try{a.transition()}catch(c){b+=1}}),b===a.length&&(clearInterval(d),c&&c())},10)};return b.add=function(b){a.push(b)},b}function We(a,b,c){return d(a[b])?a[b]:c}function Xe(a){return 10*Math.ceil(a/10)}function Ye(a,b){var c;return eg.select("body").selectAll(".dummy").data([a]).enter().append("text").classed(b?b:"",!0).text(a).each(function(){c=this.getBoundingClientRect()}).remove(),c}function Ze(a){return we(a)?"cardinal":ve(a)?"step-after":"linear" |
|
}function $e(a,b,c){Dh(b,a.node()),fk.select("."+g.selectedCircles+yd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return cd(g.selectedCircle,c)}).attr("cx",Rh?ke:je).attr("cy",Rh?je:ke).attr("stroke",function(){return Jj(b)}).attr("r",1.4*kf(b)).transition().duration(100).attr("r",kf)}function _e(a,b,c){Eh(b,a.node()),fk.select("."+g.selectedCircles+yd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function af(a,b,c,d){a?$e(b,c,d):_e(b,c,d)}function bf(a,b){Dh(b,a.node()),a.transition().duration(100).style("fill",function(){return eg.rgb(Jj(b)).brighter(.75)})}function cf(a,b){Eh(b,a.node()),a.transition().duration(100).style("fill",function(){return Jj(b)})}function df(a,b,c,d){a?bf(b,c,d):cf(b,c,d)}function ef(a,b,c,d){df(a,b,c.data,d)}function ff(a){return"circle"===a.nodeName?af:eg.select(a).classed(g.bar)?df:ef}function gf(a){return a.filter(function(a){return b(a.value)})}function hf(a){return Gi&&!ve(a)?"function"==typeof Hi?Hi(a):Hi:0}function jf(a){return Ji?Ki?Ki:1.75*hf(a):hf(a)}function kf(a){return Li?Li:4*hf(a)}function lf(a,c){return(c?fk.selectAll("."+g.circles+yd(c)):fk).selectAll("."+g.circle+(b(a)?"-"+a:""))}function mf(a,b){lf(a,b).classed(g.EXPANDED,!0).attr("r",jf)}function nf(a){lf(a).filter(function(){return eg.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",hf)}function of(a){return fk.selectAll("."+g.bar+(b(a)?"-"+a:""))}function pf(a){of(a).classed(g.EXPANDED,!0)}function qf(a){of(a).classed(g.EXPANDED,!1)}function rf(a,b){var c=eg.svg.area(),d=xf(a,b),e=b?ab:_,f=function(a,b){return lh.length>0?d(a,b)[0][1]:e(a.id)(0)},g=function(a,b){return lh.length>0?d(a,b)[1][1]:e(a.id)(a.value)};return c=Rh?c.x0(f).x1(g).y(Pd):c.x(Pd).y0(f).y1(g),function(a){var b,d,e=gf(a.values);return xe(a)?c.interpolate(Ze(a))(e):(b=Xg(e[0].x),d=_(a.id)(e[0].value),Rh?"M "+d+" "+b:"M "+b+" "+d)}}function sf(a,b){var c=eg.svg.line(),d=zf(a,b),e=b?ab:_,f=b?Sd:Pd,g=function(a,b){return lh.length>0?d(a,b)[0][1]:e(a.id)(a.value)};return c=Rh?c.x(g).y(f):c.x(f).y(g),Mi||(c=c.defined(function(a){return null!=a.value})),function(a){var d=Mi?gf(a.values):a.values,f=b?f:$g,g=e(a.id),h=0,i=0;return ue(a)?rh[a.id]?Af(d,f,g,rh[a.id]):c.interpolate(Ze(a))(d):(d[0]&&(h=f(d[0].x),i=g(d[0].value)),Rh?"M "+i+" "+h:"M "+h+" "+i)}}function tf(a,b){var c=yf(a,b);return function(a,b){var d=c(a,b),e=Rh?1:0,f=Rh?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 uf(a,b){var c=yf(a,!1),d=b?vf:wf;return function(a,b){return d(c(a,b),a,this)}}function vf(a,b){var c;return Rh?(c=ye(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function wf(a,b,c){var d=c.getBoundingClientRect();return Rh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ye(b)?-3:-6)}function xf(a,b){var c=a.__max__+1,d=ge(0,c,a,!!b),e=he(!!b),f=ie(xe,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Rh&&(0<a.value&&c>j||a.value<0&&j>c)&&(j=c),[[i,h],[i,j-(c-h)]]}}function yf(a,b){var c=a.__max__+1,d=le(bh,c),e=ge(d,c,a,!!b),f=he(!!b),g=ie(ye,a,!!b),h=b?ab:_;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Rh&&(0<a.value&&c>k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function zf(a,b){var c=a.__max__+1,d=ge(0,c,a,!!b),e=he(!!b),f=ie(ue,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Rh&&(0<a.value&&c>j||a.value<0&&j>c)&&(j=c),[[i,j-(c-h)]]}}function Af(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g<f.length;g++)u[g]={},u[g].start=c(f[g].start)?a[0].x:Aj?Me(f[g].start):f[g].start,u[g].end=c(f[g].end)?a[a.length-1].x:Aj?Me(f[g].end):f[g].end;for(q=Rh?function(a){return e(a.value)}:function(a){return b(a.x)},r=Rh?function(a){return b(a.x)}:function(a){return e(a.value)},i=Aj?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)||!Pe(a[g].x,u))t+=" "+q(a[g])+" "+r(a[g]);else for(j=Y(a[g-1].x,a[g].x,Aj),k=Y(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 Bf(b){var c=new MutationObserver(function(d){d.forEach(function(d){if("childList"===d.type&&d.previousSibling){c.disconnect();var e=a.setInterval(function(){b.node().parentNode&&(a.clearInterval(e),Kf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransition:!1,withTransitionForTransform:!1,withLegend:!0}),b.transition().style("opacity",1))},10)}})});c.observe(b.node(),{attributes:!0,childList:!0,characterData:!0})}function Cf(b){var c,d,e,f,h=!0;if(jk=eg.select(hg),jk.empty()&&(jk=eg.select(document.createElement("div")).style("opacity",0),Bf(jk),h=!1),jk.html("").classed("c3",!0),fg.data.xs={},fg.data.targets=Gc(b),vh&&(fg.data.targets=fg.data.targets.filter(vh)),uh&&Vc(uh===!0?Nc(fg.data.targets):uh),re(fg.data.targets)&&(Lh=!1),p(),W(),Xg.domain(eg.extent(gc(fg.data.targets))),Yg.domain(cc(fg.data.targets,"y")),Zg.domain(cc(fg.data.targets,"y2")),$g.domain(Xg.domain()),_g.domain(Yg.domain()),ah.domain(Zg.domain()),kk=Xg.domain(),bk.scale($g),og&&ck.scale(Xg),dk=jk.append("svg").style("overflow","hidden").on("mouseenter",sg).on("mouseleave",tg),ek=dk.append("defs"),ek.append("clipPath").attr("id",uj).append("rect"),ek.append("clipPath").attr("id",vj).append("rect"),ek.append("clipPath").attr("id",wj).append("rect"),Of(),fk=dk.append("g").attr("transform",Uj.main),gk=dk.append("g").attr("transform",Uj.context),hk=dk.append("g").attr("transform",Uj.legend),Hh||gk.style("visibility","hidden"),Lh||(hk.style("visibility","hidden"),Oj=Nc(fg.data.targets)),ik=jk.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),_f(Nc(fg.data.targets),{withTransform:!1,withTransitionForTransform:!1}),e=fk.append("g").attr("clip-path",xj).attr("class",g.grid),Ai&&e.append("g").attr("class",g.xgrids),Re(Ci)&&e.append("g").attr("class",g.xgridLines),Ii&&e.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),Di&&e.append("g").attr("class",g.ygrids),Re(Ei)&&e.append("g").attr("class",g.ygridLines),fk.append("g").attr("clip-path",xj).attr("class",g.regions),fk.append("g").attr("clip-path",xj).attr("class",g.chart),d=fk.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",og?Rh?"ns-resize":"ew-resize":null),fk.select("."+g.chart).append("g").attr("class",g.chartBars),fk.select("."+g.chart).append("g").attr("class",g.chartLines),c=fk.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",Uj.arc),c.append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Xb()),re(fg.data.targets)&&(c.append("path").attr("class",g.chartArcsBackground).attr("d",function(){var a={data:[{value:$i}],startAngle:-1*(Math.PI/2),endAngle:Math.PI/2};return Nb(a,!0,!0)}),c.append("text").attr("dy",".75em").attr("class",g.chartArcsGaugeUnit).style("text-anchor","middle").style("pointer-events","none").text(Wi?cj:""),c.append("text").attr("dx",-1*(Ig+(Gg-Ig)/2)+"px").attr("dy","1.2em").attr("class",g.chartArcsGaugeMin).style("text-anchor","middle").style("pointer-events","none").text(Wi?Zi:""),c.append("text").attr("dx",Ig+(Gg-Ig)/2+"px").attr("dy","1.2em").attr("class",g.chartArcsGaugeMax).style("text-anchor","middle").style("pointer-events","none").text(Wi?$i:"")),fk.select("."+g.chart).append("g").attr("class",g.chartTexts),og&&fk.insert("rect",qg?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",Ag).attr("height",Cg).style("opacity",0).style("cursor",Rh?"ns-resize":"ew-resize").call(ck).on("dblclick.zoom",null),gi&&bk.extent("function"!=typeof gi?gi:gi(gc())),Pj.x=fk.append("g").attr("class",g.axis+" "+g.axisX).attr("clip-path",yj).attr("transform",Uj.x).style("visibility",Sh?"visible":"hidden"),Pj.x.append("text").attr("class",g.axisXLabel).attr("transform",Rh?"rotate(-90)":"").style("text-anchor",Fb),Pj.y=fk.append("g").attr("class",g.axis+" "+g.axisY).attr("clip-path",zj).attr("transform",Uj.y).style("visibility",ii?"visible":"hidden"),Pj.y.append("text").attr("class",g.axisYLabel).attr("transform",Rh?"":"rotate(-90)").style("text-anchor",Gb),Pj.y2=fk.append("g").attr("class",g.axis+" "+g.axisY2).attr("transform",Uj.y2).style("visibility",ri?"visible":"hidden"),Pj.y2.append("text").attr("class",g.axisY2Label).attr("transform",Rh?"":"rotate(-90)").style("text-anchor",Hb),gk.append("g").attr("clip-path",xj).attr("class",g.chart),gk.select("."+g.chart).append("g").attr("class",g.chartBars),gk.select("."+g.chart).append("g").attr("class",g.chartLines),gk.append("g").attr("clip-path",xj).attr("class",g.brush).call(bk).selectAll("rect").attr(Rh?"width":"height",Rh?Bg:Dg),Pj.subx=gk.append("g").attr("class",g.axisX).attr("transform",Uj.subx).attr("clip-path",Rh?"":yj),Rf(fg.data.targets),h&&Kf({withUpdateTranslate:!0,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),rj){if(Aj&&"string"==typeof sj){for(sj=Me(sj),f=0;f<fg.data.targets[0].values.length&&fg.data.targets[0].values[f].x-sj!==0;f++);sj=f}ik.html(qj(fg.data.targets.map(function(a){return zc(a.values[sj])}),eb(),Jd(te(fg.data.targets)),Jj)),ik.style("top",tj.top).style("left",tj.left).style("display","block")}null==a.onresize&&(a.onresize=Nf()),a.onresize.add&&(a.onresize.add(ug),a.onresize.add(function(){fg.flush()}),a.onresize.add(vg)),fg.element=jk.node()}function Df(a){a.append("rect").attr("class",sd).style("cursor",wh&&xh?"pointer":null).on("mouseover",function(a){var b,c,d=a.index;Ej||te(fg.data.targets)||(b=fg.data.targets.map(function(a){return zc(Ac(a.values,d))}),c=[],Object.keys(jh).forEach(function(a){for(var d=0;d<b.length;d++)if(b[d]&&b[d].id===a){c.push(b[d]),b.shift(d);break}}),b=c.concat(b),Ji&&mf(d),pf(d),fk.selectAll("."+g.shape+"-"+d).each(function(a){Bh(a)}))}).on("mouseout",function(a){var b=a.index;te(fg.data.targets)||(de(),be(),nf(b),qf(),fk.selectAll("."+g.shape+"-"+b).each(function(a){Ch(a)}))}).on("mousemove",function(a){var b,c=a.index;Ej||te(fg.data.targets)||(b=Sc(fg.data.targets).map(function(a){return zc(Ac(a.values,c))}),ae(b,eg.mouse(this)),ce(b),wh&&(xh||fk.selectAll("."+g.shape+"-"+c).filter(function(a){return yh(a)}).each(function(){var a=eg.select(this).classed(g.EXPANDED,!0);"circle"===this.nodeName&&a.attr("r",jf),dk.select("."+g.eventRect+"-"+c).style("cursor",null)}).filter(function(a){return"circle"===this.nodeName?Ne(this,kf(a)):"path"===this.nodeName?Oe(this):void 0}).each(function(){var a=eg.select(this);a.classed(g.EXPANDED)||(a.classed(g.EXPANDED,!0),"circle"===this.nodeName&&a.attr("r",kf)),dk.select("."+g.eventRect+"-"+c).style("cursor","pointer")})))}).on("click",function(a){var b=a.index;if(!te(fg.data.targets))return Fj?void(Fj=!1):void fk.selectAll("."+g.shape+"-"+b).each(function(a){Ff(this,a,b)})}).call(eg.behavior.drag().origin(Object).on("drag",function(){Gf(eg.mouse(this))}).on("dragstart",function(){Hf(eg.mouse(this))}).on("dragend",function(){If()})).call(ck).on("dblclick.zoom",null)}function Ef(a){a.append("rect").attr("x",0).attr("y",0).attr("width",Ag).attr("height",Cg).attr("class",g.eventRect).on("mouseout",function(){te(fg.data.targets)||(de(),be(),nf())}).on("mousemove",function(){var a,b,c,d,e=Sc(fg.data.targets);Ej||te(e)||(a=eg.mouse(this),b=Vd(e,a),b&&(c=ze(b)?[b]:Xd(e,b.x),d=c.map(function(a){return zc(a)}),ae(d,a),Ji&&(nf(),mf(b.index,b.id)),ce(d),Te(b,a)<100?(dk.select("."+g.eventRect).style("cursor","pointer"),Gj||(Bh(b),Gj=!0)):(dk.select("."+g.eventRect).style("cursor",null),Ch(b),Gj=!1)))}).on("click",function(){var a,b,c=Sc(fg.data.targets);te(c)||(a=eg.mouse(this),b=Vd(c,a),b&&Te(b,a)<100&&fk.select("."+g.circles+"-"+yd(b.id)).select("."+g.circle+"-"+b.index).each(function(){Ff(this,b,b.index)}))}).call(eg.behavior.drag().origin(Object).on("drag",function(){Gf(eg.mouse(this))}).on("dragstart",function(){Hf(eg.mouse(this))}).on("dragend",function(){If()})).call(ck).on("dblclick.zoom",null)}function Ff(a,b,c){var d,e,f=eg.select(a),h=f.classed(g.SELECTED);"circle"===a.nodeName?(d=Ne(a,1.5*kf(b)),e=af):"path"===a.nodeName&&(f.classed(g.bar)?(d=Oe(a),e=df):(d=!0,e=ef)),(xh||d)&&(wh&&yh(b)&&(zh||fk.selectAll("."+g.shapes+(xh?yd(b.id):"")).selectAll("."+g.shape).each(function(a,b){var c=eg.select(this);c.classed(g.SELECTED)&&e(!1,c.classed(g.SELECTED,!1),a,b)}),f.classed(g.SELECTED,!h),e(!h,f,b,c)),Ah(b,a))}function Gf(a){var b,c,d,e,f,h,i,j;te(fg.data.targets)||wh&&(!og||ck.altDomain)&&zh&&(b=Dj[0],c=Dj[1],d=a[0],e=a[1],f=Math.min(b,d),h=Math.max(b,d),i=xh?xg.top:Math.min(c,e),j=xh?Cg:Math.max(c,e),fk.select("."+g.dragarea).attr("x",f).attr("y",i).attr("width",h-f).attr("height",j-i),fk.selectAll("."+g.shapes).selectAll("."+g.shape).filter(function(a){return yh(a)}).each(function(a,b){var c,d,e,k,l,m,n=eg.select(this),o=n.classed(g.SELECTED),p=n.classed(g.INCLUDED),q=!1;if(n.classed(g.circle))c=1*n.attr("cx"),d=1*n.attr("cy"),l=af,q=c>f&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Yd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=df,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function Hf(a){te(fg.data.targets)||wh&&(Dj=a,fk.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Ej=!0,Fh())}function If(){te(fg.data.targets)||wh&&(fk.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),fk.selectAll("."+g.shape).classed(g.INCLUDED,!1),Ej=!1,Gh())}function Jf(a,b){"grid"===b&&a.each(function(){var a=eg.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function Kf(a,c){var d,e,f,h,i,j,k,l,m,n,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,T,U,V,X,Y,Z,$,_,ab,bb,cb,db=fe(xe),eb=fe(ye),fb=fe(ue),gb=te(fg.data.targets),hb=Ve(),ib=Sc(fg.data.targets);if(a=a||{},F=We(a,"withY",!0),G=We(a,"withSubchart",!0),H=We(a,"withTransition",!0),K=We(a,"withTransform",!1),L=We(a,"withUpdateXDomain",!1),M=We(a,"withUpdateOrgXDomain",!1),O=We(a,"withUpdateTranslate",!1),N=We(a,"withLegend",!1),I=We(a,"withTransitionForExit",H),J=We(a,"withTransitionForAxis",H),Z=H?wg:0,$=I?Z:0,_=J?Z:0,c=c||Pf(_),O&&(Rh?(Pj.x.call(bh),Pj.subx.call(eh)):(Pj.y.call(ch),Pj.y2.call(dh)),p(),W(),Of(),o(!1)),N&&Lh&&_f(Nc(fg.data.targets),a,c),Bj&&0===ib.length&&Xg.domain([0,Pj.x.selectAll(".tick").size()]),ib.length&&(hc(ib,L,M),ai||!_h&&!$h||(ab=Uc(Tc(ib),$h),bh.tickValues(ab),eh.tickValues(ab))),Yg.domain(cc(ib,"y")),Zg.domain(cc(ib,"y2")),Pj.x.style("opacity",gb?0:1),Pj.y.style("opacity",gb?0:1),Pj.y2.style("opacity",gb?0:1),Pj.subx.style("opacity",gb?0:1),c.axisX.call(bh),c.axisY.call(ch),c.axisY2.call(dh),c.axisSubX.call(eh),Jb(H),L&&ib.length)if(Yh&&ab){for(bb=1;bb<ab.length;bb++)if(ab.length/bb<Zh){cb=bb;break}dk.selectAll("."+g.axisX+" .tick text").each(function(a){var b=ab.indexOf(a);b>=0&&eg.select(this).style("display",b%cb?"none":"block")})}else dk.selectAll("."+g.axisX+" .tick text").style("display","block");!Rh&&bi&&kb(Pj.x,c.axisX,bi),P=rf(db,!1),S=tf(eb),U=sf(fb,!1),X=uf(eb,!0),Y=uf(eb,!1),_g.domain(Yg.domain()),ah.domain(Zg.domain()),ik.style("display","none"),q(),fk.select("line."+g.xgridFocus).style("visibility","hidden"),Ai&&(f=ee(Bi,Xg),C=Bj?bh.tickOffset():0,e=Rh?{x1:0,x2:Ag,y1:function(a){return Xg(a)-C},y2:function(a){return Xg(a)-C}}:{x1:function(a){return Xg(a)+C},x2:function(a){return Xg(a)+C},y1:xg.top,y2:Cg},d=fk.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+eg.select(this).attr(Rh?"y1":"x1")===(Rh?Cg:0)?0:1}),d.exit().remove()),Re(Ci)&&(h=fk.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(Ci),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",Rh?"":"rotate(-90)").attr("dx",Rh?0:-xg.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Z).attr("x1",Rh?0:Qd).attr("x2",Rh?Ag:Qd).attr("y1",Rh?Qd:xg.top).attr("y2",Rh?Qd:Cg).style("opacity",1),h.select("text").transition().duration(Z).attr("x",Rh?Ag:0).attr("y",Qd).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Z).style("opacity",0).remove()),F&&Di&&(j=fk.select("."+g.ygrids).selectAll("."+g.ygrid).data(Yg.ticks(Fi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",Rh?Yg:0).attr("x2",Rh?Yg:Ag).attr("y1",Rh?0:Yg).attr("y2",Rh?Cg:Yg),j.exit().remove(),Jf(j,"grid")),F&&Re(Ei)&&(k=fk.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(Ei),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",Rh?"rotate(-90)":"").attr("dx",Rh?0:-xg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Z).attr("x1",Rh?Rd:0).attr("x2",Rh?Rd:Ag).attr("y1",Rh?0:Rd).attr("y2",Rh?Cg:Rd).style("opacity",1),k.select("text").transition().duration(Z).attr("x",Rh?0:Ag).attr("y",Rd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Z).style("opacity",0).remove()),u=fk.select("."+g.regions).selectAll("."+g.region).data(mj),u.enter().append("g").attr("class",rd).append("rect").style("fill-opacity",0),u.selectAll("rect").transition().duration(Z).attr("x",mc).attr("y",nc).attr("width",oc).attr("height",pc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),u.exit().transition().duration(Z).style("opacity",0).remove(),s=fk.selectAll("."+g.bars).selectAll("."+g.bar).data(Ge),s.enter().append("path").attr("class",ld).style("stroke",function(a){return Jj(a.id)}).style("fill",function(a){return Jj(a.id)}),s.style("opacity",Dd),s.exit().transition().duration($).style("opacity",0).remove(),m=fk.selectAll("."+g.lines).selectAll("."+g.line).data(Ee),m.enter().append("path").attr("class",hd).style("stroke",Jj),m.style("opacity",Dd).attr("transform",null),m.exit().transition().duration($).style("opacity",0).remove(),n=fk.selectAll("."+g.areas).selectAll("."+g.area).data(Ee),n.enter().append("path").attr("class",pd).style("fill",Jj).style("opacity",function(){return lk=+eg.select(this).style("opacity"),0}),n.style("opacity",lk),n.exit().transition().duration($).style("opacity",0).remove(),Gi?(r=fk.selectAll("."+g.circles).selectAll("."+g.circle).data(He),r.enter().append("circle").attr("class",jd).attr("r",hf).style("fill",Jj),r.style("opacity",Dd),r.exit().remove()):r=eg.selectAll([]),Hd()&&(v=fk.selectAll("."+g.texts).selectAll("."+g.text).data(Ie),v.enter().append("text").attr("class",dd).attr("text-anchor",function(a){return Rh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Jj).style("fill-opacity",0),v.text(function(a){return Od(a.id)(a.value,a.id)}).style("fill-opacity",Ed).transition().duration(Z).attr("x",X).attr("y",Y).style("fill",Jj).style("fill-opacity",Gd),v.exit().transition().duration($).style("fill-opacity",0).remove()),t=fk.selectAll("."+g.arcs).selectAll("."+g.arc).data(Fe),t.enter().append("path").attr("class",nd).style("fill",function(a){return Jj(a.data)}).style("cursor",function(a){return yh(a)?"pointer":null}).style("opacity",0).each(function(a){Be(a.data)&&(a.startAngle=a.endAngle=-1*(Math.PI/2)),this._current=a}).on("mouseover",function(a,b){var c,d,e;Hj||(c=Kb(a),d=Qb(c),e=Zb(),Sb(c.data.id),Xf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Kb(a),c=Qb(b),d=[c];ae(d,eg.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hj||(c=Kb(a),d=Qb(c),e=$b(),Tb(c.data.id),Yf(),be(),e(d,b))}).on("click",function(a,b){var c=Kb(a),d=Qb(c),e=Yb();Ff(this,a,b),e(d,b)}),t.attr("transform",function(a){return!Be(a.data)&&K?"scale(0)":""}).style("opacity",function(a){return a===this._current?0:1}).each(function(){Hj=!0}).transition().duration(Z).attrTween("d",function(a){var b,c=Kb(a);return c?(isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle),b=eg.interpolate(this._current,c),this._current=b(0),function(a){return Nb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",K?"scale(1)":"").style("fill",function(a){return Kj?Kj(a.data.values[0].value):Jj(a.data.id)}).style("opacity",1).call(Ue,function(){Hj=!1}),t.exit().transition().duration($).style("opacity",0).remove(),fk.selectAll("."+g.chartArc).select("text").style("opacity",0).attr("class",function(a){return Be(a.data)?g.gaugeValue:""}).text(Rb).attr("transform",Ob).transition().duration(Z).style("opacity",function(a){return Qc(a.data.id)&&De(a.data)?1:0}),fk.select("."+g.chartArcsTitle).style("opacity",se(fg.data.targets)||re(fg.data.targets)?1:0),Hh&&(eg.event&&"zoom"===eg.event.type&&bk.extent(Xg.orgDomain()).update(),G&&(!Rh&&bi&&kb(Pj.subx,c.axisSubX,bi),bk.empty()||bk.extent(Xg.orgDomain()).update(),R=rf(db,!0),T=tf(eb,!0),V=sf(fb,!0),y=gk.selectAll("."+g.bars).selectAll("."+g.bar).data(Ge),y.enter().append("path").attr("class",ld).style("stroke","none").style("fill",Jj),y.style("opacity",Dd).transition().duration(Z).attr("d",T).style("opacity",1),y.exit().transition().duration(Z).style("opacity",0).remove(),w=gk.selectAll("."+g.lines).selectAll("."+g.line).data(Ee),w.enter().append("path").attr("class",hd).style("stroke",Jj),w.style("opacity",Dd).transition().duration(Z).attr("d",V).style("opacity",1),w.exit().transition().duration(Z).style("opacity",0).remove(),x=gk.selectAll("."+g.areas).selectAll("."+g.area).data(Ee),x.enter().append("path").attr("class",pd).style("fill",Jj).style("opacity",function(){return lk=+eg.select(this).style("opacity"),0}),x.style("opacity",0).transition().duration(Z).attr("d",R).style("fill",Jj).style("opacity",lk),x.exit().transition().duration($).style("opacity",0).remove())),fk.selectAll("."+g.selectedCircles).filter(function(a){return ye(a)}).selectAll("circle").remove(),rg&&(z=fk.select("."+g.eventRects),Re(gh)&&!yc(gh)?(z.classed(g.eventRectsMultiple)||z.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),A=fk.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),Ef(A.enter()),A.attr("x",0).attr("y",0).attr("width",Ag).attr("height",Cg)):(z.classed(g.eventRectsSingle)||z.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),!Cj&&!Aj||Bj?(E=Q(),D=function(a){return Xg(a.x)-E/2}):(E=function(a){var b=Ic(a.index),c=Jc(a.index),d=fg.data.xs[a.id][a.index];return(Xg(c?c:d)-Xg(b?b:d))/2},D=function(a){var b=Ic(a.index),c=fg.data.xs[a.id][a.index];return(Xg(c)+Xg(b?b:c))/2}),B=Lc(fg.data.targets),fk.select("."+g.eventRects).datum(B?B.values:[]),A=fk.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),Df(A.enter()),A.attr("class",sd).attr("x",Rh?0:D).attr("y",Rh?D:0).attr("width",Rh?Ag:E).attr("height",Rh?E:Cg),A.exit().remove())),eg.transition().duration(Z).each(function(){hb.add(s.transition().attr("d",S).style("fill",Jj).style("opacity",1)),hb.add(m.transition().attr("d",U).style("stroke",Jj).style("opacity",1)),hb.add(n.transition().attr("d",P).style("fill",Jj).style("opacity",lk)),hb.add(r.transition().style("opacity",Fd).style("fill",Jj).attr("cx",Rh?ke:je).attr("cy",Rh?je:ke)),hb.add(fk.selectAll("."+g.selectedCircle).transition().attr("cx",Rh?ke:je).attr("cy",Rh?je:ke))}).call(hb,a.flow?function(){var b,c,d=1,e=a.flow.index,f=a.flow.length,h=Ac(fg.data.targets[0].values,e),i=Ac(fg.data.targets[0].values,e+f),j=Xg.domain(),k=Ve();fg.data.targets.forEach(function(a){a.values.splice(0,f)}),hc(ib,!0,!0),b=Xg(h.x)-Xg(i.x),Aj&&(b=.9*b,d=ic(j)/ic(Xg.domain())),c="translate("+b+",0) scale("+d+",1)",eg.transition().ease("linear").each(function(){k.add(Pj.x.transition().call(bh)),k.add(s.transition().attr("transform",c)),k.add(m.transition().attr("transform",c)),k.add(n.transition().attr("transform",c)),k.add(r.transition().attr("transform",c))}).call(k,function(){var a,b=[],c=[];for(a=0;f>a;a++)b.push("."+g.shape+"-"+(e+a)),c.push("."+g.eventRect+"-"+(e+a));dk.selectAll("."+g.shapes).selectAll(b).remove(),dk.selectAll("."+g.eventRects).selectAll(c).remove(),s.attr("transform",null).attr("d",S),m.attr("transform",null).attr("d",U),n.attr("transform",null).attr("d",P),r.attr("transform",null).attr("cx",Rh?ke:je).attr("cy",Rh?je:ke),A.attr("x",Rh?0:D).attr("y",Rh?D:0).attr("width",Rh?Ag:E).attr("height",Rh?E:Cg)})}:null),Nc(fg.data.targets).forEach(function(a){mk[a]=!0})}function Lf(){Kf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Mf(){if(0!==Sc(fg.data.targets).length){if("mousemove"===eg.event.sourceEvent.type&&ck.altDomain)return Xg.domain(ck.altDomain),void ck.scale(Xg).updateScaleExtent();Bj&&Xg.orgDomain()[0]===kk[0]&&Xg.domain([kk[0]-1e-10,Xg.orgDomain()[1]]),Kf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===eg.event.sourceEvent.type&&(Fj=!0)}}function Nf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Of(){dk.attr("width",Eg).attr("height",Fg),dk.select("#"+uj).select("rect").attr("width",Ag).attr("height",Cg),dk.select("#"+vj).select("rect").attr("x",G).attr("y",H).attr("width",M).attr("height",N),dk.select("#"+wj).select("rect").attr("x",I).attr("y",J).attr("width",O).attr("height",P),dk.select("."+g.zoomRect).attr("width",Ag).attr("height",Cg),jk.style("max-height",Fg+"px")}function Pf(a){return{axisX:a?Pj.x.transition().duration(a):Pj.x,axisY:a?Pj.y.transition().duration(a):Pj.y,axisY2:a?Pj.y2.transition().duration(a):Pj.y2,axisSubX:a?Pj.subx.transition().duration(a):Pj.subx}}function Qf(a){var b;a=a||{},a.withTransition=We(a,"withTransition",!0),a.withTransform=We(a,"withTransform",!1),a.withLegend=We(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&Lh||(b=Pf(a.withTransitionForAxis?wg:0),p(),W(),Of(),o(a.withTransition,b)),Kf(a,b)}function Rf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=fk.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",ud),j=i.enter().append("g").attr("class",ud).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",ed),e=fk.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",wd),d=e.enter().append("g").attr("class",wd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",md).style("cursor",function(a){return yh(a)?"pointer":null}),c=fk.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",vd),b=c.enter().append("g").attr("class",vd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",id),b.append("g").attr("class",qd),b.append("g").attr("class",function(a){return cd(g.selectedCircles,a.id)}),b.append("g").attr("class",kd).style("cursor",function(a){return yh(a)?"pointer":null}),a.forEach(function(a){fk.selectAll("."+g.selectedCircles+yd(a.id)).selectAll("."+g.selectedCircle).each(function(b){b.value=a.values[b.index].value})}),h=fk.select("."+g.chartArcs).selectAll("."+g.chartArc).data(Og(a)).attr("class",xd),f=h.enter().append("g").attr("class",xd),f.append("g").attr("class",od),f.append("text").attr("dy",re(fg.data.targets)?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Hh&&(n=gk.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",wd),m=n.enter().append("g").style("opacity",0).attr("class",wd),m.append("g").attr("class",md),l=gk.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",vd),k=l.enter().append("g").style("opacity",0).attr("class",vd),k.append("g").attr("class",id),k.append("g").attr("class",qd)),dk.selectAll("."+g.target).filter(function(a){return Qc(a.id)}).transition().duration(wg).style("opacity",1)}function Sf(a,b){b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?me(a.id,b.types[a.id]):me(a.id,b.type)}),fg.data.targets.forEach(function(b){for(var c=0;c<a.length;c++)if(b.id===a[c].id){b.values=a[c].values,a.splice(c,1);break}}),fg.data.targets=fg.data.targets.concat(a),Rf(fg.data.targets),Kf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b.done&&b.done()}function Tf(a){if("data"in a)Sf(Gc(a.data),a);else if("url"in a)eg.csv(a.url,function(b,c){Sf(Gc(c),a)});else if("rows"in a)Sf(Gc(Ec(a.rows)),a);else{if(!("columns"in a))throw Error("url or rows or columns is required.");Sf(Gc(Fc(a.columns)),a)}}function Uf(a,b){return"function"!=typeof b&&(b=function(){}),a=a.filter(function(a){return Pc(fg.data.targets,a)}),a&&0!==a.length?(dk.selectAll(a.map(function(a){return zd(a)})).transition().style("opacity",0).remove().call(Ue,b),void a.forEach(function(a){mk[a]=!1,hk.selectAll("."+g.legendItem+yd(a)).remove(),fg.data.targets=fg.data.targets.filter(function(b){return b.id!==a})})):void b()}function Vf(a){return a.classed(g.legendItemHidden)?Zj:1}function Wf(a){return a.classed(g.legendItemHidden)?Zj:.3}function Xf(a,b){hk.selectAll("."+g.legendItem).transition().duration(100).style("opacity",function(c){var d=eg.select(this);return a&&c!==a?b?Wf(d):Vf(d):b?Vf(d):Wf(d)})}function Yf(){hk.selectAll("."+g.legendItem).transition().duration(100).style("opacity",function(){return Vf(eg.select(this))})}function Zf(a){Lh||(Lh=!0,hk.style("visibility","visible")),Yc(a),hk.selectAll(Cd(a)).style("visibility","visible").transition().style("opacity",function(){return Vf(eg.select(this))})}function $f(a){Lh&&Qe(a)&&(Lh=!1,hk.style("visibility","hidden")),Xc(a),hk.selectAll(Cd(a)).style("opacity",0).style("visibility","hidden")}function _f(a,b,c){function e(b,c,d){function e(a,b){b||(f=(m-z-l)/2,y>f&&(f=(m-l)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=l}var f,h,i=Ye(b.textContent,g.legendItem),j=10*Math.ceil((i.width+v)/10),k=10*Math.ceil((i.height+u)/10),l=Vj?k:j,m=Vj?V():U();return d&&(z=0,F=0,w=0,x=0),Lh&&!Rc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=j,C[c]=k,(!w||j>=w)&&(w=j),(!x||k>=x)&&(x=k),h=Vj?x:w,void(Qh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(m-h*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=36,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=hk.selectAll("."+g.legendItemFocused).size();b=b||{},n=We(b,"withTransition",!0),q=We(b,"withTransitionForTransform",!0),Vj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=hk.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return cd(g.legendItem,a)}).style("visibility",function(a){return Rc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Nh?Nh(a):fg.toggle(a)}).on("mouseover",function(a){eg.select(this).classed(g.legendItemFocused,!0),Hj||fg.focus(a),"function"==typeof Oh&&Oh(a)}).on("mouseout",function(a){eg.select(this).classed(g.legendItemFocused,!1),Hj||fg.revert(),"function"==typeof Ph&&Ph(a)}),m.append("text").text(function(a){return d(jh[a])?jh[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Vj?h:-200).attr("y",Vj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",Vj?i:-200).attr("y",Vj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Jj).attr("x",Vj?h:-200).attr("y",Vj?-200:j).attr("width",10).attr("height",10),r=hk.selectAll("text").data(a).text(function(a){return d(jh[a])?jh[a]:a |
|
}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=hk.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=hk.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",Jj).attr("x",f).attr("y",j),hk.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Qc(a)}).transition().style("opacity",function(a){var b=eg.select(this);return Qc(a)?!G||b.classed(g.legendItemFocused)?Vf(b):Wf(b):Zj}),S(w),T(x),R(F),p(),W(),Of(),o(q,c)}function ag(a){return Pc(fg.data.targets,a.id)}function bg(a){return"data"in a&&Pc(fg.data.targets,a.data.id)}function cg(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 dg(a,b,c){var d=!te(fg.data.targets);Hj=!1,me(a,b),Qf(c||{withTransitionForAxis:d})}var eg=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,fg={data:{},axis:{},legend:{}},gg={},hg=i(["bindto"],"#chart"),ig=i(["size","width"]),jg=i(["size","height"]),kg=i(["padding","left"]),lg=i(["padding","right"]),mg=i(["padding","top"]),ng=i(["padding","bottom"]),og=i(["zoom","enabled"],!1),pg=i(["zoom","extent"]),qg=i(["zoom","privileged"],!1),rg=i(["interaction","enabled"],!0),sg=i(["onenter"],function(){}),tg=i(["onleave"],function(){}),ug=i(["onresize"],function(){}),vg=i(["onresized"],function(){}),wg=i(["transition","duration"],350);h("data","data is required in config");var xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng,Og,Pg,Qg,Rg,Sg,Tg,Ug,Vg,Wg,Xg,Yg,Zg,$g,_g,ah,bh,ch,dh,eh,fh=i(["data","x"]),gh=i(["data","xs"],{}),hh=i(["data","x_format"]),ih=i(["data","id_converter"],function(a){return a}),jh=i(["data","names"],{}),kh=i(["data","classes"],{}),lh=i(["data","groups"],[]),mh=i(["data","axes"],{}),nh=i(["data","type"]),oh=i(["data","types"],{}),ph=i(["data","labels"],{}),qh=i(["data","order"]),rh=i(["data","regions"],{}),sh=i(["data","color"]),th=i(["data","colors"],{}),uh=i(["data","hide"],!1),vh=i(["data","filter"]),wh=i(["data","selection","enabled"],!1),xh=i(["data","selection","grouped"],!1),yh=i(["data","selection","isselectable"],function(){return!0}),zh=i(["data","selection","multiple"],!0),Ah=i(["data","onclick"],function(){}),Bh=i(["data","onenter"],function(){}),Ch=i(["data","onleave"],function(){}),Dh=i(["data","onselected"],function(){}),Eh=i(["data","onunselected"],function(){}),Fh=i(["data","ondragstart"],function(){}),Gh=i(["data","ondragend"],function(){}),Hh=i(["subchart","show"],!1),Ih=i(["subchart","size","height"],60),Jh=i(["color","pattern"],[]),Kh=i(["color","threshold"],{}),Lh=i(["legend","show"],!0),Mh=i(["legend","position"],"bottom"),Nh=i(["legend","item","onclick"]),Oh=i(["legend","item","onmouseover"]),Ph=i(["legend","item","onmouseout"]),Qh=i(["legend","equally"],!1),Rh=i(["axis","rotated"],!1),Sh=i(["axis","x","show"],!0),Th=i(["axis","x","type"],"indexed"),Uh=i(["axis","x","localtime"],!0),Vh=i(["axis","x","categories"],[]),Wh=i(["axis","x","tick","centered"],!1),Xh=i(["axis","x","tick","format"]),Yh=i(["axis","x","tick","culling"],{}),Zh=i(["axis","x","tick","culling","max"],10),$h=i(["axis","x","tick","count"]),_h=i(["axis","x","tick","fit"],!0),ai=i(["axis","x","tick","values"],null),bi=i(["axis","x","tick","rotate"]),ci=i(["axis","x","max"],null),di=i(["axis","x","min"],null),ei=i(["axis","x","padding"],{}),fi=i(["axis","x","height"]),gi=i(["axis","x","default"]),hi=i(["axis","x","label"],{}),ii=i(["axis","y","show"],!0),ji=i(["axis","y","max"]),ki=i(["axis","y","min"]),li=i(["axis","y","center"]),mi=i(["axis","y","label"],{}),ni=i(["axis","y","inner"],!1),oi=i(["axis","y","tick","format"]),pi=i(["axis","y","padding"]),qi=i(["axis","y","ticks"],10),ri=i(["axis","y2","show"],!1),si=i(["axis","y2","max"]),ti=i(["axis","y2","min"]),ui=i(["axis","y2","center"]),vi=i(["axis","y2","label"],{}),wi=i(["axis","y2","inner"],!1),xi=i(["axis","y2","tick","format"]),yi=i(["axis","y2","padding"]),zi=i(["axis","y2","ticks"],10),Ai=i(["grid","x","show"],!1),Bi=i(["grid","x","type"],"tick"),Ci=i(["grid","x","lines"],[]),Di=i(["grid","y","show"],!1),Ei=i(["grid","y","lines"],[]),Fi=i(["grid","y","ticks"],10),Gi=i(["point","show"],!0),Hi=i(["point","r"],2.5),Ii=i(["point","focus","line","enabled"],!0),Ji=i(["point","focus","expand","enabled"],!0),Ki=i(["point","focus","expand","r"]),Li=i(["point","focus","select","r"]),Mi=i(["line","connect_null"],!1),Ni=i(["bar","width"]),Oi=i(["bar","width","ratio"],.6),Pi=i(["pie","label","show"],!0),Qi=i(["pie","label","format"]),Ri=i(["pie","label","threshold"],.05),Si=i(["pie","expand"],!0),Ti=i(["pie","onclick"],function(){}),Ui=i(["pie","onmouseover"],function(){}),Vi=i(["pie","onmouseout"],function(){}),Wi=i(["gauge","label","show"],!0),Xi=i(["gauge","label","format"]),Yi=i(["gauge","expand"],!0),Zi=i(["gauge","min"],0),$i=i(["gauge","max"],100),_i=i(["gauge","onclick"],function(){}),aj=i(["gauge","onmouseover"],function(){}),bj=i(["gauge","onmouseout"],function(){}),cj=i(["gauge","units"]),dj=i(["gauge","width"]),ej=i(["donut","label","show"],!0),fj=i(["donut","label","format"]),gj=i(["donut","label","threshold"],.05),hj=i(["donut","expand"],!0),ij=i(["donut","title"],""),jj=i(["donut","onclick"],function(){}),kj=i(["donut","onmouseover"],function(){}),lj=i(["donut","onmouseout"],function(){}),mj=i(["regions"],[]),nj=i(["tooltip","show"],!0),oj=i(["tooltip","format","title"]),pj=i(["tooltip","format","value"]),qj=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k,l=oj?oj:b,m=pj?pj:c;for(f=0;f<a.length;f++)a[f]&&(a[f].value||0===a[f].value)&&(e||(h=l?l(a[f].x):a[f].x,e="<table class='"+g.tooltip+"'>"+(h||0===h?"<tr><th colspan='2'>"+h+"</th></tr>":"")),j=a[f].name,i=m(a[f].value,a[f].ratio,a[f].id,a[f].index),k=Kj?Kj(a[f].value):d(a[f].id),e+="<tr class='"+g.tooltipName+"-"+a[f].id+"'>",e+="<td class='name'><span style='background-color:"+k+"'></span>"+j+"</td>",e+="<td class='value'>"+i+"</td>",e+="</tr>");return e+"</table>"}),rj=i(["tooltip","init","show"],!1),sj=i(["tooltip","init","x"],0),tj=i(["tooltip","init","position"],{top:"0px",left:"50px"}),uj="c3-"+ +new Date+"-clip",vj=uj+"-xaxis",wj=uj+"-yaxis",xj=j(uj),yj=j(vj),zj=j(wj),Aj="timeseries"===Th,Bj="categorized"===Th,Cj=!Aj&&(fh||Re(gh)),Dj=null,Ej=!1,Fj=!1,Gj=!1,Hj=!1,Ij=eg.scale.category10().range(),Jj=Ke(th,Re(Jh)?Jh:Ij,sh),Kj=Re(Kh)?Le(Jh,Kh):null,Lj=Uh?eg.time.format:eg.time.format.utc,Mj=Lj.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),Nj=[],Oj=[],Pj={},Qj=Rh?"left":"bottom",Rj=Rh?ni?"top":"bottom":ni?"right":"left",Sj=Rh?wi?"bottom":"top":wi?"left":"right",Tj=Rh?"left":"bottom",Uj={main:function(){return"translate("+k(xg.left)+","+k(xg.top)+")"},context:function(){return"translate("+k(yg.left)+","+k(yg.top)+")"},legend:function(){return"translate("+zg.left+","+zg.top+")"},x:function(){return"translate(0,"+(Rh?0:Cg)+")"},y:function(){return"translate(0,"+(Rh?Cg:0)+")"},y2:function(){return"translate("+(Rh?0:Ag)+","+(Rh?1:0)+")"},subx:function(){return"translate(0,"+(Rh?0:Dg)+")"},arc:function(){return"translate("+Jg/2+","+Kg/2+")"}},Vj="right"===Mh,Wj=0,Xj=0,Yj=0,Zj=.15,$j=30,_j=Rh&&!Sh?0:30,ak=5;Og=eg.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var bk,ck=function(){};bk=eg.svg.brush().on("brush",Lf),bk.update=function(){return gk&&gk.select("."+g.brush).call(this),this},bk.scale=function(a){return Rh?this.y(a):this.x(a)},og&&(ck=eg.behavior.zoom().on("zoomstart",function(){ck.altDomain=eg.event.sourceEvent.altKey?Xg.orgDomain():null}).on("zoom",og?Mf:null),ck.scale=function(a){return Rh?this.y(a):this.x(a)},ck.orgScaleExtent=function(){var a=pg?pg:[1,10];return[a[0],Math.max(Kc()/a[1],a[1])]},ck.updateScaleExtent=function(){var a=ic(Xg.orgDomain())/ic(kk),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dk,ek,fk,gk,hk,ik,jk,kk,lk,mk={};if(fg.focus=function(a){function b(a){Sc(a).transition().duration(100).style("opacity",1)}var c=dk.selectAll(zd(a)),d=c.filter(ag),e=c.filter(bg);fg.revert(),fg.defocus(),b(d.classed(g.focused,!0)),b(e),te(fg.data.targets)&&Sb(a,!0),Xf(a,!0)},fg.defocus=function(a){function b(a){Sc(a).transition().duration(100).style("opacity",.3)}var c=dk.selectAll(zd(a)),d=c.filter(ag),e=c.filter(bg);fg.revert(),b(d.classed(g.focused,!1)),b(e),te(fg.data.targets)&&Tb(a),Xf(a,!1)},fg.revert=function(a){function b(a){Sc(a).transition().duration(100).style("opacity",1)}var c=dk.selectAll(zd(a)),d=c.filter(ag),e=c.filter(bg);b(d.classed(g.focused,!1)),b(e),te(fg.data.targets)&&Tb(a),Yf()},fg.show=function(a,b){a=Oc(a),b=b||{},Wc(a),dk.selectAll(Ad(a)).transition().style("opacity",1),b.withLegend&&Zf(a),Kf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},fg.hide=function(a,b){a=Oc(a),b=b||{},Vc(a),dk.selectAll(Ad(a)).transition().style("opacity",0),b.withLegend&&$f(a),Kf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},fg.toggle=function(a){Qc(a)?fg.hide(a):fg.show(a)},fg.unzoom=function(){bk.clear().update(),Kf({withUpdateXDomain:!0})},fg.load=function(a){return a.xs&&xc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){kh[b]=a.classes[b]}),"categories"in a&&Bj&&(Vh=a.categories),"cacheIds"in a&&jc(a.cacheIds)?void Sf(lc(a.cacheIds),a.done):void("unload"in a?Uf(Oc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Tf(a)}):Tf(a))},fg.unload=function(a,b){Uf(Oc(a),function(){Kf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},fg.flow=function(a){var b,c,d=Gc(Fc(a.columns),!0),e=[];fg.data.targets.forEach(function(a){var f,g,h=!1;for(f=0;f<d.length;f++)if(a.id===d[f].id){for(h=!0,c=a.values[a.values.length-1].index+1,b=d[f].values.length,g=0;g<d[f].values.length;g++)d[f].values[g].index=c+g,Aj||(d[f].values[g].x=c+g);a.values=a.values.concat(d[f].values),d.splice(f,1);break}h||e.push(a.id)}),fg.data.targets.forEach(function(a){var d,f;for(d=0;d<e.length;d++)if(a.id===e[d])for(c=a.values[a.values.length-1].index+1,f=0;b>f;f++)a.values.push({id:a.id,index:c+f,x:Aj?wc(c+f):c+f,value:null})}),d.forEach(function(a){var b,d=[];for(b=fg.data.targets[0].values[0].index;c>b;b++)d.push({id:a.id,index:b,x:Aj?wc(b):b,value:null});a.values.forEach(function(a){a.index+=c,Aj||(a.x+=c)}),a.values=d.concat(a.values)}),fg.data.targets=fg.data.targets.concat(d),Rf(fg.data.targets),Kf({flow:{index:fg.data.targets[0].values[0].index,length:b},withLegend:!0})},fg.selected=function(a){return eg.merge(fk.selectAll("."+g.shapes+yd(a)).selectAll("."+g.shape).filter(function(){return eg.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},fg.select=function(a,b,c){wh&&fk.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=eg.select(this),i=e.data?e.data.id:e.id,j=ff(this),k=xh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?yh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},fg.unselect=function(a,b){wh&&fk.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=eg.select(this),f=c.data?c.data.id:c.id,h=ff(this),i=xh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&yh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},fg.toLine=function(a){dg(a,"line")},fg.toSpline=function(a){dg(a,"spline")},fg.toBar=function(a){dg(a,"bar")},fg.toScatter=function(a){dg(a,"scatter")},fg.toArea=function(a){dg(a,"area")},fg.toAreaSpline=function(a){dg(a,"area-spline")},fg.toPie=function(a){dg(a,"pie",{withTransform:!0})},fg.toDonut=function(a){dg(a,"donut",{withTransform:!0})},fg.groups=function(a){return c(a)?lh:(lh=a,Kf(),lh)},fg.xgrids=function(a){return a?(Ci=a,Kf(),Ci):Ci},fg.xgrids.add=function(a){return a?fg.xgrids(Ci.concat(a)):void 0},fg.xgrids.remove=function(a){var b=cg(a);return fg.xgrids(Ci.filter(b))},fg.ygrids=function(a){return a?(Ei=a,Kf(),Ei):Ei},fg.ygrids.add=function(a){return a?fg.ygrids(Ei.concat(a)):void 0},fg.ygrids.remove=function(a){var b=cg(a);return fg.ygrids(Ei.filter(b))},fg.regions=function(a){return a?(mj=a,Kf(),mj):mj},fg.regions.add=function(a){return a?(mj=mj.concat(a),Kf(),mj):mj},fg.regions.remove=function(a){var b,c,d;return a=a||{},b=We(a,"duration",wg),c=We(a,"classes",[g.region]),d=fk.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),mj=mj.filter(function(a){var b=!1;return a.class?(a.class.split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0})},fg.data.get=function(a){var b=fg.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},fg.data.getAsTarget=function(a){var b=fg.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},fg.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){jh[b]=a[b]}),Kf({withLegend:!0}),jh):jh},fg.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){th[b]=a[b]}),Kf({withLegend:!0}),th):th},fg.x=function(a){return arguments.length&&(Bc(fg.data.targets,a),Kf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),fg.data.xs},fg.xs=function(a){return arguments.length&&(Cc(fg.data.targets,a),Kf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),fg.data.xs},fg.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){hb(b,a[b])}),Jb())},fg.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(ci=+a.x),b(a.y)&&(ji=+a.y),b(a.y2)&&(si=+a.y2)):ji=si=+a,Kf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},fg.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(di=+a.x),b(a.y)&&(ki=+a.y),b(a.y2)&&(ti=+a.y2)):ki=ti=+a,Kf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},fg.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&fg.axis.max(a.max),"undefined"!=typeof a.min&&fg.axis.min(a.min))},fg.legend.show=function(a){Zf(Oc(a)),Kf({withLegend:!0})},fg.legend.hide=function(a){$f(Oc(a)),Kf({withLegend:!0})},fg.resize=function(a){ig=a?a.width:null,jg=a?a.height:null,fg.flush(),fg.flush()},fg.flush=function(){Qf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},fg.destroy=function(){fg.data.targets=void 0,fg.data.xs={},jk.classed("c3",!1).html(""),a.onresize=null},"url"in f.data)eg.xhr(f.data.url,function(a,b){var c,d=eg.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=eg.csv.parse(b.response),Cf(c)});else if("rows"in f.data)Cf(Ec(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");Cf(Fc(f.data.columns))}return fg},"function"==typeof define&&define.amd?define("c3",["d3"],f):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=f:a.c3=f}(window); |