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