diff --git a/c3.js b/c3.js index cc6dcbb..c1e0df0 100644 --- a/c3.js +++ b/c3.js @@ -1494,6 +1494,18 @@ } return x; } + function convertUrlToData(url, mimeType, keys, done) { + var type = mimeType ? mimeType : 'csv'; + d3.xhr(url, function (error, data) { + var d; + if (type === 'json') { + d = convertJsonToData(JSON.parse(data.response), keys); + } else { + d = convertCsvToData(data.response); + } + done(d); + }); + } function convertCsvToData(csv) { var rows = d3.csv.parseRows(csv), d; if (rows.length === 1) { @@ -4457,7 +4469,7 @@ load(convertDataToTargets(args.data), args); } else if (args.url) { - d3.csv(args.url, function (error, data) { + convertUrlToData(args.url, args.mimeType, args.keys, function (data) { load(convertDataToTargets(data), args); }); } @@ -5296,21 +5308,8 @@ /*-- Load data and init chart with defined functions --*/ - function initWithUrl(args) { - var type = args.mimeType ? args.mimeType : 'csv'; - d3.xhr(args.url, function (error, data) { - var d; - if (type === 'json') { - d = convertJsonToData(JSON.parse(data.response), args.keys); - } else { - d = convertCsvToData(data.response); - } - init(d); - }); - } - if (config.data.url) { - initWithUrl(config.data); + convertUrlToData(config.data.url, config.data.mimeType, config.data.keys, init); } else if (config.data.json) { init(convertJsonToData(config.data.json, config.data.keys)); diff --git a/c3.min.js b/c3.min.js index a2d8791..8da54d5 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,3 +1,3 @@ -!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}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]);b0&&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]=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=ue(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=te(lg.data.targets)||se(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=ue(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(Ye(z("x")),40):1:!ui||zi?1:Ye(z("y"))}function y(){var a=10,c=dk?U()+20:0;return b(rg)?rg+1:bi?a+c:(!Di||Ii?a:Ye(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=Mc(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=Lc(),e=pe(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),Re(ii)&&(ii=!1)):f.tickOffset=function(){var a=Nc(lg.data.targets),b=bh(a[1])-bh(a[0]),c=b?b:bi?Ig:Gg;return c/Lc()/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?cd: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=Tc(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=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(Tc(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),Ce(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||Ee(a.data)?Rg(a,b):"M 0 0"}function Pb(a){var b,c,d,e,f,g=Lb(a),h="";return g&&!se(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=se(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),se(lg.data.targets)||Wb(d)?(e=Xb(),e?e(c,d):Nd(c,d)):""):""}function Tb(a,b){var c=rk.selectAll("."+g.chartArc+Ad(a)),d=rk.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});Ke(a)&&c.selectAll("path").transition().duration(50).attr("d",Sg).transition().duration(100).attr("d",Tg).each(function(a){De(a.data)}),b||d.style("opacity",.3)}function Ub(a){var b=rk.selectAll("."+g.chartArc+Ad(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 te(lg.data.targets)?a=nj:re(lg.data.targets)&&(a=bj),a}function Wb(a){var b=te(lg.data.targets)?pj:dj;return a>=b}function Xb(){var a=cj;return se(lg.data.targets)?a=hj:te(lg.data.targets)&&(a=oj),a}function Yb(){return te(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=Oc(a),i=$c(a);if(sh.length>0)for(g=ad(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return kg.min(Object.keys(i).map(function(a){return kg.min(i[a])}))}function _b(a){var b,c,d,e,f,g,h=Oc(a),i=$c(a);if(sh.length>0)for(g=bd(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return 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=pe(n)&&_i||oe(n)&&aj,u=Hd()&&bi,v=Hd()&&!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=Id(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=Id(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?Ne(pi):pi:kg.min(a,function(a){return kg.min(a.values,function(a){return a.x})})}function cc(a){return oi?Jj?Ne(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=Nc(a),h=g[1]-g[0];return Kj?d=0:pe(a)?(c=Lc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qi&&Se(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;bb?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?Ne(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||Se(mh)&&Te(mh,a)}function qc(a){return!pc(a)}function rc(a){return lh?lh:Se(mh)?mh[a]:null}function sc(a,b){var c,d=b&&Se(b)?Oc(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=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():Se(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&&me(Oc(d).filter(function(a){return!(a in vh)}),uh),d.forEach(function(a){ic(a.id_org,a)}),d}function Ic(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 Jc(a){var b=zc(lg.data.targets[0].values,a-1);return b?b.x:null}function Kc(a){var b=zc(lg.data.targets[0].values,a+1);return b?b.x:null}function Lc(){return kg.max(lg.data.targets,function(a){return a.values.length})}function Mc(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 Nc(a){var b,c,d=Mc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Oc(a){return a.map(function(a){return a.id})}function Pc(a){return a?"string"==typeof a?[a]:a:Oc(lg.data.targets)}function Qc(a,b){var c,d=Oc(a);for(c=0;c2){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 Wc(a){Xj=Xj.concat(a)}function Xc(a){Xj=Xj.filter(function(b){return a.indexOf(b)<0})}function Yc(a){Yj=Yj.concat(a)}function Zc(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 _c(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function bd(a){return _c(a,function(a){return a>0})}function cd(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(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=Ue(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Xd(a,b){return kg.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 xh&&"desc"===xh.toLowerCase()}function $d(){return xh&&"asc"===xh.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 xh&&a.sort(xh),a}function ae(a,c){var d,e,f,g,h,i,j,k=ue(lg.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&uj&&(wk.html(zj(a,eb(),Jd(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 be(){wk.style("display","none")}function ce(a){var c=a.filter(function(a){return a&&b(a.value)});if(uj&&!qe(lg.data.targets)&&!ue(lg.data.targets)){var d=tk.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(bi?"y1":"x1",Pd).attr(bi?"y2":"x2",Pd),Nf(d,"grid")}}function de(){tk.select("line."+g.xgridFocus).style("visibility","hidden")}function ee(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 fe(a){var b,d,e={},f=0;return Tc(lg.data.targets.filter(a)).forEach(function(a){for(b=0;b=0&&(i+=g(c.values[f].value)-h)}),i}}function je(a){return a.x||0===a.x?bh(a.x):null}function ke(a,b){var c=fe(ve),d=Bf(c);return sh.length>0?d(a,b)[0][1]:_(a.id)(a.value)}function le(a,b){return"number"==typeof Zi?Zi:b?2*a.tickOffset()*$i/b:0}function me(a,b){Pc(a).forEach(function(a){Ak[a]=b===vh[a],vh[a]=b}),a||(uh=b)}function ne(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 oe(a){return ne(a,"area")||ne(a,"area-spline")||ne(a,"area-step")}function pe(a){return ne(a,"bar")}function qe(a){return ne(a,"scatter")}function re(a){return"pie"===uh||ne(a,"pie")}function se(a){return ne(a,"gauge")}function te(a){return"donut"===uh||ne(a,"donut")}function ue(a){return re(a)||te(a)||se(a)}function ve(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 we(a){var b="string"==typeof a?a:a.id;return["step","area-step"].indexOf(vh[b])>=0}function xe(a){var b="string"==typeof a?a:a.id;return["spline","area-spline"].indexOf(vh[b])>=0}function ye(a){var b="string"==typeof a?a:a.id;return["area","area-spline","area-step"].indexOf(vh[b])>=0}function ze(a){var b="string"==typeof a?a:a.id;return"bar"===vh[b]}function Ae(a){var b="string"==typeof a?a:a.id;return"scatter"===vh[b]}function Be(a){var b="string"==typeof a?a:a.id;return"pie"===vh[b]}function Ce(a){var b="string"==typeof a?a:a.id;return"gauge"===vh[b]}function De(a){var b="string"==typeof a?a:a.id;return"donut"===vh[b]}function Ee(a){return Be(a)||De(a)||Ce(a)}function Fe(a){return ve(a)?[a]:[]}function Ge(a){return Ee(a.data)?[a]:[]}function He(a){return ze(a)?a.values:[]}function Ie(a){return ve(a)||Ae(a)?a.values:[]}function Je(a){return ze(a)||ve(a)?a.values:[]}function Ke(a){return De(a)&&rj||Ce(a)&&ij||Be(a)&&fj}function Le(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 Me(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;f0}function Te(a,b){var c=!1; -return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ue(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 Ve(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function We(){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 Xe(a,b,c){return d(a[b])?a[b]:c}function Ye(a){return 10*Math.ceil(a/10)}function Ze(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 xe(a)?"cardinal":we(a)?"step-after":"linear"}function _e(){return kg.selectAll([])}function af(a,b,c){Kh.call(lg,b,a.node()),tk.select("."+g.selectedCircles+zd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return dd(g.selectedCircle,c)}).attr("cx",bi?ke:je).attr("cy",bi?je:ke).attr("stroke",function(){return Sj(b)}).attr("r",1.4*mf(b)).transition().duration(100).attr("r",mf)}function bf(a,b,c){Lh.call(lg,b,a.node()),tk.select("."+g.selectedCircles+zd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function cf(a,b,c,d){a?af(b,c,d):bf(b,c,d)}function df(a,b){Kh.call(lg,b,a.node()),a.transition().duration(100).style("fill",function(){return kg.rgb(Sj(b)).brighter(.75)})}function ef(a,b){Lh.call(lg,b,a.node()),a.transition().duration(100).style("fill",function(){return Sj(b)})}function ff(a,b,c,d){a?df(b,c,d):ef(b,c,d)}function gf(a,b,c,d){ff(a,b,c.data,d)}function hf(a){return"circle"===a.nodeName?cf:kg.select(a).classed(g.bar)?ff:gf}function jf(a){return a.filter(function(a){return b(a.value)})}function kf(a){return Ti&&!we(a)?"function"==typeof Ui?Ui(a):Ui:0}function lf(a){return Vi?Wi?Wi:1.75*kf(a):kf(a)}function mf(a){return Xi?Xi:4*kf(a)}function nf(a,c){return(c?tk.selectAll("."+g.circles+zd(c)):tk).selectAll("."+g.circle+(b(a)?"-"+a:""))}function of(a,b){nf(a,b).classed(g.EXPANDED,!0).attr("r",lf)}function pf(a){nf(a).filter(function(){return kg.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",kf)}function qf(a){return tk.selectAll("."+g.bar+(b(a)?"-"+a:""))}function rf(a){qf(a).classed(g.EXPANDED,!0)}function sf(a){qf(a).classed(g.EXPANDED,!1)}function tf(a,b){var c=kg.svg.area(),d=zf(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(Pd):c.x(Pd).y0(f).y1(g),function(a){var b,d=jf(a.values),e=0,f=0;return ye(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 uf(a,b){var c=kg.svg.line(),d=Bf(a,b),e=b?ab:_,f=b?Sd:Pd,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?jf(a.values):a.values,g=b?g:eh,h=e(a.id),i=0,j=0;return ve(a)?d=yh[a.id]?Cf(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 vf(a,b){var c=Af(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 wf(a,b){var c=Af(a,!1),d=b?xf:yf;return function(a,b){return d(c(a,b),a,this)}}function xf(a,b,c){var d,e,f=c.getBoundingClientRect();return bi?(e=ze(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 yf(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:ze(b)?-3:-6),dj||a.value<0&&j>c)&&(j=c),[[i,h],[i,j-(c-h)]]}}function Af(a,b){var c=a.__max__+1,d=le(hh,c),e=ge(d,c,a,!!b),f=he(!!b),g=ie(ze,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&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Bf(a,b){var c=a.__max__+1,d=ge(0,c,a,!!b),e=he(!!b),f=ie(ve,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&&(0j||a.value<0&&j>c)&&(j=c),[[i,j-(c-h)]]}}function Cf(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=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function Df(){var a=ug?qk:function(){};tk.select("."+g.zoomRect).call(a),tk.selectAll("."+g.eventRect).call(a)}function Ef(){bi?(Zj.x.call(hh),Zj.subx.call(kh)):(Zj.y.call(ih),Zj.y2.call(jh)),p(),W(),Sf(),o(!1)}function Ff(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),Ef(),Of({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 Gf(b){var c,d,e,f,h=!0;if(xk=kg.select(ng),xk.empty()&&(xk=kg.select(document.createElement("div")).style("opacity",0),Ff(xk),h=!1),xk.html("").classed("c3",!0),lg.data.xs={},lg.data.targets=Hc(b),Ch&&(lg.data.targets=lg.data.targets.filter(Ch)),Bh&&Wc(Bh===!0?Oc(lg.data.targets):Bh),se(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"),Sf(),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=Oc(lg.data.targets)),wk=xk.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),dg(Oc(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()),se(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).style("cursor",bi?"ns-resize":"ew-resize").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),Vf(lg.data.targets),h&&(Ef(),Of({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1})),Aj){if(Jj&&"string"==typeof Bj){for(Bj=Ne(Bj),f=0;ff&&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=ff,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 Lf(a){ue(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 Mf(){ue(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 Nf(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 Of(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=fe(ye),cb=fe(ze),eb=fe(ve),fb=ue(lg.data.targets),gb=Tc(lg.data.targets);if(d=h=p=u=_e(),a=a||{},E=Xe(a,"withY",!0),F=Xe(a,"withSubchart",!0),G=Xe(a,"withTransition",!0),J=Xe(a,"withTransform",!1),K=Xe(a,"withUpdateXDomain",!1),L=Xe(a,"withUpdateOrgXDomain",!1),M=Xe(a,"withLegend",!1),H=Xe(a,"withTransitionForExit",G),I=Xe(a,"withTransitionForAxis",G),W=G?Cg:0,X=H?W:0,Y=I?W:0,c=c||Tf(Y),M&&Th&&dg(Oc(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||($=Vc(Uc(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/_=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=tf(bb,!1),P=vf(cb),S=uf(eb,!1),U=wf(cb,!0),V=wf(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=ee(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(),Nf(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?Rd:0).attr("x2",bi?Rd:Gg).attr("y1",bi?0:Rd).attr("y2",bi?Ig:Rd).style("opacity",1),k.select("text").transition().duration(W).attr("x",bi?0:Gg).attr("y",Rd).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",sd).append("rect").style("fill-opacity",0),t.exit().transition().duration(W).style("opacity",0).remove(),r=tk.selectAll("."+g.bars).selectAll("."+g.bar).data(He),r.enter().append("path").attr("class",md).style("stroke",function(a){return Sj(a.id)}).style("fill",function(a){return Sj(a.id)}),r.style("opacity",Ed),r.exit().transition().duration(X).style("opacity",0).remove(),n=tk.selectAll("."+g.lines).selectAll("."+g.line).data(Fe),n.enter().append("path").attr("class",id).style("stroke",Sj),n.style("opacity",Ed).attr("transform",null),n.exit().transition().duration(X).style("opacity",0).remove(),o=tk.selectAll("."+g.areas).selectAll("."+g.area).data(Fe),o.enter().append("path").attr("class",qd).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(Ie),p.enter().append("circle").attr("class",kd).attr("r",kf).style("fill",Sj),p.style("opacity",Ed),p.exit().remove()),Hd()&&(u=tk.selectAll("."+g.texts).selectAll("."+g.text).data(Je),u.enter().append("text").attr("class",ed).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 Od(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(Ge),s.enter().append("path").attr("class",od).style("fill",function(a){return Sj(a.data)}).style("cursor",function(a){return Fh(a)?"pointer":null}).style("opacity",0).each(function(a){Ce(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),_f(b.data.id,!0),Ih.call(lg,c,this))}).on("mousemove",function(a){var b=Lb(a),c=Rb(b),d=[c];ae(d,kg.mouse(this))}).on("mouseout",function(a){var b,c;Qj||(b=Lb(a),c=Rb(b),Ub(b.data.id),ag(),be(),Jh.call(lg,c,this))}).on("click",function(a,b){var c=Lb(a),d=Rb(c);Jf(this,d,b)}),s.attr("transform",function(a){return!Ce(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(Ve,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 Ce(a.data)?g.gaugeValue:""}).text(Sb).attr("transform",Pb).transition().duration(W).style("opacity",function(a){return Rc(a.data.id)&&Ee(a.data)?1:0}),tk.select("."+g.chartArcsTitle).style("opacity",te(lg.data.targets)||se(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=tf(bb,!0),R=vf(cb,!0),T=uf(eb,!0),x=uk.selectAll("."+g.bars).selectAll("."+g.bar).data(He),x.enter().append("path").attr("class",md).style("stroke","none").style("fill",Sj),x.style("opacity",Ed).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(Fe),v.enter().append("path").attr("class",id).style("stroke",Sj),v.style("opacity",Ed).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(Fe),w.enter().append("path").attr("class",qd).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 ze(a)}).selectAll("circle").remove(),xg&&(y=tk.select("."+g.eventRects).style("cursor",ug?bi?"ns-resize":"ew-resize":null),Se(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]),If(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=Jc(a.index),c=Kc(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=Jc(a.index),c=lg.data.xs[a.id][a.index];return(bh(c)+bh(b?b:c))/2}),A=Mc(lg.data.targets),tk.select("."+g.eventRects).datum(A?A.values:[]),z=tk.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),Hf(z.enter()),z.attr("class",td).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",Fd).style("fill",Sj).attr("cx",bi?ke:je).attr("cy",bi?je:ke)),c.push(tk.selectAll("."+g.selectedCircle).transition().attr("cx",bi?ke:je).attr("cy",bi?je:ke)),c.push(u.transition().attr("x",U).attr("y",V).style("fill",Sj).style("fill-opacity",a.flow?0:Gd)),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:Qd).attr("x2",bi?Gg:Qd).attr("y1",bi?Qd:Dg.top).attr("y2",bi?Qd:Ig).style("opacity",1)),c.push(h.select("text").transition().attr("x",bi?Gg:0).attr("y",Qd).text(function(a){return a.text}).style("opacity",1)),a.flow&&(Z=We(),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=We();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:Qd).attr("x2",bi?Gg:Qd),h.select("text").attr("x",bi?Gg:0).attr("y",Qd),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?ke:je).attr("cy",bi?je:ke),u.attr("transform",null).attr("x",U).attr("y",V).style("fill-opacity",Gd),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()})}),Oc(lg.data.targets).forEach(function(a){Ak[a]=!0}),Df()}function Pf(){Of({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Qf(){if(ug&&0!==Tc(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]]),Of({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===kg.event.sourceEvent.type&&(Oj=!0)}}function Rf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Sf(){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 Tf(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 Uf(a){var b;a=a||{},a.withTransition=Xe(a,"withTransition",!0),a.withTransform=Xe(a,"withTransform",!1),a.withLegend=Xe(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withTransitionForTransform=Xe(a,"withTransitionForTransform",a.withTransition),p(),a.withLegend&&Th||(b=Tf(a.withTransitionForAxis?Cg:0),W(),Sf(),o(a.withTransitionForTransform,b)),Of(a,b)}function Vf(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",vd),j=i.enter().append("g").attr("class",vd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",fd),e=tk.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",xd),d=e.enter().append("g").attr("class",xd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",nd).style("cursor",function(a){return Fh(a)?"pointer":null}),c=tk.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",wd),b=c.enter().append("g").attr("class",wd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",jd),b.append("g").attr("class",rd),b.append("g").attr("class",function(a){return dd(g.selectedCircles,a.id)}),b.append("g").attr("class",ld).style("cursor",function(a){return Fh(a)?"pointer":null}),a.forEach(function(a){tk.selectAll("."+g.selectedCircles+zd(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",yd),f=h.enter().append("g").attr("class",yd),f.append("g").attr("class",pd),f.append("text").attr("dy",se(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",xd),m=n.enter().append("g").style("opacity",0).attr("class",xd),m.append("g").attr("class",nd),l=uk.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",wd),k=l.enter().append("g").style("opacity",0).attr("class",wd),k.append("g").attr("class",jd),k.append("g").attr("class",rd)),rk.selectAll("."+g.target).filter(function(a){return Rc(a.id)}).transition().duration(Cg).style("opacity",1)}function Wf(a,b){a&&(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)}),lg.data.targets.forEach(function(b){for(var c=0;cf&&(f=(m-l)/2,z=0,F++)),E[a]=F,D[F]=ek?10:f,A[a]=z,z+=l}var f,h,i=Ze(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&&!Sc(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=Xe(b,"withTransition",!0),q=Xe(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 dd(g.legendItem,a)}).style("visibility",function(a){return Sc(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!Rc(a)}).transition().style("opacity",function(a){var b=kg.select(this);return Rc(a)?!G||b.classed(g.legendItemFocused)?Zf(b):$f(b):kk}),S(w),T(x),R(F),p(),W(),Sf(),o(q,c)}function eg(a){return Qc(lg.data.targets,a.id)}function fg(a){return"data"in a&&Qc(lg.data.targets,a.data.id)}function gg(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 hg(a,b){var c=gg(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 ig(a,b,c){var d=!ue(lg.data.targets),e=c||{withTransitionForAxis:d};e.withTransitionForTransform=!1,Qj=!1,me(a,b),Uf(e)}function jg(a){var b=a.mimeType?a.mimeType:"csv";kg.xhr(a.url,function(c,d){var e;e="json"===b?Ec(JSON.parse(d.response),a.keys):Dc(d.response),Gf(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"+(h||0===h?""+h+"":"")),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+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),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||Se(mh))},Mj=null,Nj=!1,Oj=!1,Pj=!1,Qj=!1,Rj=kg.scale.category10().range(),Sj=Le(Ah,Se(Rh)?Rh:Rj,zh),Tj=Se(Sh)?Me(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",Pf),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",Qf),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(Lc()/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){Tc(a).transition().duration(100).style("opacity",1)}var c=rk.selectAll(Ad(a)),d=c.filter(eg),e=c.filter(fg);lg.revert(),lg.defocus(),b(d.classed(g.focused,!0)),b(e),ue(lg.data.targets)&&Tb(a,!0),_f(a,!0)},lg.defocus=function(a){function b(a){Tc(a).transition().duration(100).style("opacity",.3)}var c=rk.selectAll(Ad(a)),d=c.filter(eg),e=c.filter(fg);lg.revert(),b(d.classed(g.focused,!1)),b(e),ue(lg.data.targets)&&Ub(a),_f(a,!1)},lg.revert=function(a){function b(a){Tc(a).transition().duration(100).style("opacity",1)}var c=rk.selectAll(Ad(a)),d=c.filter(eg),e=c.filter(fg);b(d.classed(g.focused,!1)),b(e),ue(lg.data.targets)&&Ub(a),ag()},lg.show=function(a,b){a=Pc(a),b=b||{},Xc(a),rk.selectAll(Bd(a)).transition().style("opacity",1),b.withLegend&&bg(a),Of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},lg.hide=function(a,b){a=Pc(a),b=b||{},Wc(a),rk.selectAll(Bd(a)).transition().style("opacity",0),b.withLegend&&cg(a),Of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},lg.toggle=function(a){Rc(a)?lg.hide(a):lg.show(a)},lg.unzoom=function(){pk.clear().update(),Of({withUpdateXDomain:!0})},lg.zoom=function(){},lg.zoom.enable=function(a){ug=a,Uf()},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 Wf(jc(a.cacheIds),a.done):void("unload"in a?Yf(Pc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Xf(a)}):Xf(a))},lg.unload=function(a,b){Yf(Pc(a),function(){Of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},lg.flow=function(a){var c,e,f,g,h,i,j=Hc(Gc(a.columns),!0),k=[],l=Lc(),m=0,n=0;lg.data.targets.forEach(function(a){var b,c,d=!1;for(b=0;bc;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;bc;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=Lc(),f=lg.data.targets[0],g=f.values[0],d(a.to)?(m=0,i=Jj?Ne(a.to):a.to,f.values.forEach(function(a){a.x1?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)),Vf(lg.data.targets),Of({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+zd(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=hf(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=hf(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;ig(b,a,c)},lg.groups=function(a){return c(a)?sh:(sh=a,Of(),sh)},lg.xgrids=function(a){return a?(Oi=a,Of(),Oi):Oi},lg.xgrids.add=function(a){return a?lg.xgrids(Oi.concat(a)):void 0},lg.xgrids.remove=function(a){hg(a,!0)},lg.ygrids=function(a){return a?(Qi=a,Of(),Qi):Qi},lg.ygrids.add=function(a){return a?lg.ygrids(Qi.concat(a)):void 0},lg.ygrids.remove=function(a){hg(a,!1)},lg.regions=function(a){return a?(tj=a,Of(),tj):tj},lg.regions.add=function(a){return a?(tj=tj.concat(a),Of(),tj):tj},lg.regions.remove=function(a){var b,c,d;return a=a||{},b=Xe(a,"duration",Cg),c=Xe(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]}),Of({withLegend:!0}),qh):qh},lg.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Ah[b]=a[b]}),Of({withLegend:!0}),Ah):Ah},lg.category=function(a,b){return arguments.length>1&&(fi[a]=b,Of()),fi[a]},lg.categories=function(a){return arguments.length?(fi=a,Of(),fi):fi},lg.color=Sj,lg.x=function(a){return arguments.length&&(Ac(lg.data.targets,a),Of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),lg.data.xs},lg.xs=function(a){return arguments.length&&(Bc(lg.data.targets,a),Of({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,Of({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,Of({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){bg(Pc(a)),Uf({withLegend:!0})},lg.legend.hide=function(a){cg(Pc(a)),Uf({withLegend:!0})},lg.resize=function(a){og=a?a.width:null,pg=a?a.height:null,lg.flush()},lg.flush=function(){Uf({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)jg(f.data);else if(f.data.json)Gf(Ec(f.data.json,f.data.keys));else if(f.data.rows)Gf(Fc(f.data.rows));else{if(!f.data.columns)throw Error("url or json or rows or columns is required.");Gf(Gc(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); \ No newline at end of file +!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]);b0&&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]=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=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=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return 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=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return 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;bb?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=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;c2){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;ca})}function cd(a){return ad(a,function(a){return a>0})}function dd(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(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=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;f0}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),dj||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&&(0k||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&&(0j||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=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).style("cursor",bi?"ns-resize":"ew-resize").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;ff&&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/_=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;cf&&(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"+(h||0===h?""+h+"":"")),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+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),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,b){Zf(Qc(a),function(){Pf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},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;bc;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;bc;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.x1?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); \ No newline at end of file diff --git a/htdocs/data/c3_test_2.json b/htdocs/data/c3_test_2.json new file mode 100644 index 0000000..ed18b2f --- /dev/null +++ b/htdocs/data/c3_test_2.json @@ -0,0 +1,5 @@ +{ + "data1": [20, 40, 70, 50, 80, 30], + "data2": [180, 150, 200, 170, 220, 400], + "data3": [1200, 1210, 1250, 1300, 1280, 1000] +} diff --git a/htdocs/samples/data_url.html b/htdocs/samples/data_url.html index a5a2f82..c30390a 100644 --- a/htdocs/samples/data_url.html +++ b/htdocs/samples/data_url.html @@ -3,27 +3,39 @@ -
-
+