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