From 1c81c418cb0d302886ecbff078514040aa6e016d Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 19:15:29 +0900 Subject: [PATCH] Fix legend positioning - #176 --- c3.js | 6 +++--- c3.min.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/c3.js b/c3.js index 042ba68..752a651 100644 --- a/c3.js +++ b/c3.js @@ -511,7 +511,7 @@ } else if (__padding_right) { return __padding_right; } else if (isLegendRight) { - return getLegendWidth() + (__axis_y2_show && !__axis_rotated ? getAxisWidthByAxisId('y2') : defaultPadding); + return getLegendWidth() + 20 + (__axis_y2_show && !__axis_rotated ? getAxisWidthByAxisId('y2') : defaultPadding); } else if (__axis_y2_show) { return __axis_y2_inner || __axis_rotated ? defaultPadding : getAxisWidthByAxisId('y2'); } else { @@ -4081,11 +4081,11 @@ } if (isLegendRight) { - xForLegend = function (id) { return maxWidth * (0.2 + steps[id]); }; + xForLegend = function (id) { return maxWidth * steps[id]; }; yForLegend = function (id) { return margins[steps[id]] + offsets[id]; }; } else { xForLegend = function (id) { return margins[steps[id]] + offsets[id]; }; - yForLegend = function (id) { return maxHeight * (0.2 + steps[id]); }; + yForLegend = function (id) { return maxHeight * steps[id]; }; } xForLegendText = function (id, i) { return xForLegend(id, i) + 14; }; yForLegendText = function (id, i) { return yForLegend(id, i) + 9; }; diff --git a/c3.min.js b/c3.min.js index 56ec73a..806dcc8 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}var e={version:"0.1.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(a,b){var c=_(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.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=yd(o,p),j=ac(rg.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&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.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})}}),c.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++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(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(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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(Jd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Jd(a,g))),Md(e,b)):Kd(a,b,f,g)}function Ld(a,b){var c;return c=a.map(function(a){return Kd(a.values,b)}),Md(c,b)}function Md(a,b){var c,d;return a.forEach(function(a){var e=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(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 we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;e0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Qi).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("stroke",Qi).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("fill",Qi).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Qi),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Qi).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Qi).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Qi).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Qi(a.data)}).style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*(.2+B[a])},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*(.2+B[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Qi).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Qi).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,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,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); +!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}var e={version:"0.1.34"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",legendItemHidden:"c3-legend-item-hidden",legendItemFocused:"c3-legend-item-focused",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cXf&&(Xf=0),0>Zf&&(Zf=0),Yf=ih?Uf.left-dj-ej:Xf,$f=ih?Zf:ag-Vf.top-Vf.bottom,0>Yf&&(Yf=0),0>$f&&($f=0),p(),$i&&he(Ff.data.targets)&&(Wf.left=Xf/2+cg)}function o(){nj.select("line."+f.xgridFocus).attr("x1",ih?0:-10).attr("x2",ih?Xf:-10).attr("y1",ih?-10:Uf.top).attr("y2",ih?-10:Zf)}function p(){cg=Zf/2,bg=.95*cg,dg=ge(Ff.data.targets)?.6*bg:0}function q(){var a=ih?f.axisX:f.axisY,b=nj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ef.select(Hf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return If?If:x()}function s(){var a=Jf?Jf:y();return a>0?a:320}function t(){return he(Ff.data.targets)?0:Kf?Kf:ih?jh?v("x"):1:!Bh||Gh?1:v("y")}function u(){var a=1;return he(Ff.data.targets)?0:Lf?Lf:$i?P()+20+(Kh&&!ih?v("y2"):a):Kh?Ph||ih?a:v("y2"):a}function v(a){var b=jb(a);return b.isInner?20+Cb(a):40+Cb(a)}function w(a){return"x"!==a||jh?"x"===a&&yh?yh:"y"!==a||Bh?"y2"!==a||Kh?(jb(a).isInner?30:40)+("y2"===a?-10:0):fj:ch&&!$i?10:1:0}function x(){return+Ef.select(Hf).style("width").replace("px","")}function y(){return+Ef.select(Hf).style("height").replace("px","")}function z(a){return a?-5:-(Uf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ih)}function C(){return A(!ih)}function D(){return z(ih)}function E(){return A(ih)}function F(a){return a?Xf+2+4:Uf.left+20}function G(a){return a?(yh?yh:0)+80:Zf+8}function H(){return F(!ih)}function I(){return G(!ih)}function J(){return F(ih)}function K(){return G(ih)}function L(){var a,b,c,d,e,f=Ac(Ff.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=qg(b.x)-qg(a.x),0===c?ih?Zf:Xf:(d=zc(),e=de(Ff.data.targets)?(d-(Ii?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){_i=a}function N(a){aj=a}function O(a){bj=a}function P(){return ch?$i?aj*(_i+1):_f:0}function Q(){return ch?$i?ag:bj*(_i+1):0}function R(){var a,b,c=!qg;ig=ih?1:0,jg=ih?Zf:Xf,kg=ih?0:Zf,lg=ih?Xf:1,mg=ig,ng=jg,og=ih?0:$f,pg=ih?Yf:1,qg=T(ig,jg,c?void 0:qg.domain(),function(){return wg.tickOffset()}),rg=U(kg,lg,c?void 0:rg.domain()),sg=U(kg,lg,c?void 0:sg.domain()),tg=T(ig,jg,sj,function(a){return a%1?0:zg.tickOffset()}),ug=U(og,pg,c?void 0:ug.domain()),vg=U(og,pg,c?void 0:vg.domain()),a=$(),b=th?th:c?void 0:wg.tickValues(),wg=X(qg,Vi,a,b),zg=X(tg,Yi,a,b),xg=Y(rg,Wi,Hh,Jh),yg=Y(sg,Xi,Qh,Sh),c||(gj.scale(tg),Mf&&kj.scale(qg)),S()}function S(){eg=Gb(),fg=Hb(),gg=Hb(.98)}function T(a,b,d,e){var f=(Hi?Ef.time.scale():Ef.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ii){var g,h=f;f=function(a){return h(a)+e(a)};for(g in h)f[g]=h[g];f.orgDomain=function(){return h.domain()},f.domain=function(a){return arguments.length?(h.domain(a),f):(a=h.domain(),[a[0],a[1]+1])}}return f}function U(a,b,c){var d=Ef.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?sg:rg}function W(a){return"y2"===Z(a)?vg:ug}function X(a,b,c,d){var e=(Ii?Eb():Ef.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ii?(e.tickCentered(nh),Ae(ph)&&(ph=!1)):e.tickOffset=function(){var a=Bc(Ff.data.targets),b=qg(a[1])-qg(a[0]),c=b?b:ih?Zf:Xf;return c/zc()/2},Ii&&e.categories(mh),e}function Y(a,b,c,d){return Ef.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Hg?Hg[a]:"y"}function $(){var a=Hi?Si:Ii?Tc:function(a){return 0>a?a.toFixed(0):a};return oh&&("function"==typeof oh?a=oh:Hi&&(a=function(a){return a?Ri(oh)(a):""})),a}function _(a){var b;return"y"===a?b=Fh:"y2"===a?b=Oh:"x"===a&&(b=Ah),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Fh=b:"y2"===a?Oh=b:"x"===a&&(Ah=b):c&&(c.text=b)}function cb(a){return 10*Math.sin(Math.PI*(a/180))}function db(a){return 11.5-2.5*(a/15)}function eb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",db(c)).attr("x",cb(c)).attr("transform","rotate("+c+")")}function fb(a,b){var c=_(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 gb(){return fb("x",ih?"inner-top":"inner-right")}function hb(){return fb("y",ih?"inner-right":"inner-top")}function ib(){return fb("y2",ih?"inner-right":"inner-top")}function jb(a){return"y2"===a?ib():"y"===a?hb():gb()}function kb(){return ab("x")}function lb(){return ab("y")}function mb(){return ab("y2")}function nb(a,b){return a?b.isLeft?0:b.isCenter?Xf/2:Xf:b.isBottom?-Zf:b.isMiddle?-Zf/2:0}function ob(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function pb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function qb(){return nb(!ih,gb())}function rb(){return nb(ih,hb())}function sb(){return nb(ih,ib())}function tb(){return ob(!ih,gb())}function ub(){return ob(ih,hb())}function vb(){return ob(ih,ib())}function wb(){var a=gb();return ih?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":yh?yh-10:"3em"}function xb(){var a=hb();return ih?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ih?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ih,gb())}function Ab(){return pb(ih,hb())}function Bb(){return pb(ih,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Ef.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){nj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),nj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),nj.select("."+f.axisY2+" ."+f.axisY2Label).transition().attr("x",sb).attr("dx",vb).attr("dy",yb).text(mb)}function Eb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a){return a0)for(g=Rc(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 Ef.min(Object.keys(i).map(function(a){return Ef.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Gg.length>0)for(g=Sc(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 Ef.max(Object.keys(i).map(function(a){return Ef.max(i[a])}))}function Xb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?Mh:Dh,n="y2"===c?Lh:Ch,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Nh:Eh,r=xd()&&ih;return 0===l.length?"y2"===c?sg.domain():rg.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=yd(o,p),j=ac(rg.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&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),"y2"===c&&Rh&&(f=b(Rh.top)?Rh.top:e,g=b(Rh.bottom)?Rh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return wh?Hi?we(wh):wh:Ef.min(a,function(a){return Ef.min(a.values,function(a){return a.x})})}function Zb(a){return vh?Hi?we(vh):vh:Ef.max(a,function(a){return Ef.max(a.values,function(a){return a.x})})}function $b(a){var c,d,e,f,g=Bc(a),h=g[1]-g[0];return Ii?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof xh&&Be(xh)?(e=b(xh.left)?xh.left:d,f=b(xh.right)?xh.right:d):e=f="number"==typeof xh?xh:d,{left:e,right:f}}function _b(a){var b=[Yb(a),Zb(a)],c=b[0],d=b[1],e=$b(a),f=0,g=0;return c-d===0&&(c=Hi?new Date(.5*c.getTime()):-.5,d=Hi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Hi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Hi?new Date(d.getTime()+e.right):d+e.right),[f,g]}function ac(a){return a[1]-a[0]}function bc(a){for(var b=0;bb?0:b-c}function hc(a){var b,c=fc(a),d="y"===a.axis?rg:sg;return b="y"===a.axis||"y2"===a.axis?ih?Zf:"start"in a?d(a.start):Zf:ih?"end"in a?qg(Hi?we(a.end):a.end):Zf:Zf,c>b?0:b-c}function ic(a){return Ag&&a===Ag||Be(Bg)&&Ce(Bg,a)}function jc(a){return!ic(a)}function kc(a){return Ag?Ag:Be(Bg)?Bg[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ff.data.xs[b])}),c}function mc(a,b){return a in Ff.data.xs&&Ff.data.xs[a]&&Ff.data.xs[a][b]?Ff.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Bg[b]=a[b]})}function oc(a){return 1===Ef.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Eg[a.id],a.name=b?b:a.id),a}function qc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=sc(b[d],a.id,d)}),Ff.data.xs[a.id]=b})}function rc(a,b){a.forEach(function(a){b[a.id]&&qc([a],b[a.id])})}function sc(a,c,d){var e;return e=Hi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ji&&!Ii?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ff.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Ag?(d=Object.keys(Ff.data.xs),Ff.data.xs[c]=d.length>0?Ff.data.xs[d[0]]:void 0):Be(Bg)&&(Ff.data.xs[c]=lc(f,Ff.data.targets)):Ff.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ff.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=kc(b),g=a[f],h=sc(g,b,e);return Ji&&Ii&&0===c&&g&&(0===e&&(mh=[]),mh.push(g)),("undefined"==typeof a[b]||Ff.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})}}),c.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++})}),Ig&&be(Cc(c).filter(function(a){return!(a in Jg)}),Ig),c.forEach(function(a){cc(a.id_org,a)}),c}function wc(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 xc(a){return a>0&&Ff.data.targets[0].values[a-1]?Ff.data.targets[0].values[a-1].x:void 0}function yc(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Bc(a){var b,c,d=Ac(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Cc(a){return a.map(function(a){return a.id})}function Dc(a){return a?"string"==typeof a?[a]:a:Cc(Ff.data.targets)}function Ec(a,b){var c,d=Cc(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(Hi?new Date(i):i);j.push(e)}return Hi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ti=Ti.concat(a)}function Mc(a){Ti=Ti.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ui=Ui.concat(a)}function Oc(a){Ui=Ui.filter(function(b){return a.indexOf(b)<0})}function Pc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Qc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Sc(a){return Qc(a,function(a){return a>0})}function Tc(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(Jd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Jd(a,g))),Md(e,b)):Kd(a,b,f,g)}function Ld(a,b){var c;return c=a.map(function(a){return Kd(a.values,b)}),Md(c,b)}function Md(a,b){var c,d;return a.forEach(function(a){var e=De(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Nd(a,b){return Ef.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Od(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 Pd(){return Lg&&"desc"===Lg.toLowerCase()}function Qd(){return Lg&&"asc"===Lg.toLowerCase()}function Rd(a){var b=Qd(),c=Pd();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 Lg&&a.sort(Lg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ff.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ui&&(qj.html(xi(a,$(),zd(k),Qi)).style("display","block"),d=qj.property("offsetWidth"),e=qj.property("offsetHeight"),k?(g=Xf/2+c[0],i=Zf/2+c[1]+20):(ih?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=qg(l[0].x)+20):(f=q(),g=f+t()+qg(l[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),qj.style("top",i+"px").style("left",g+"px"))}function Td(){qj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ui&&(ee(Ff.data.targets)||he(Ff.data.targets)||nj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ih?"y1":"x1",Fd).attr(ih?"y2":"x2",Fd))}function Vd(){nj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?qg(a.x):null}function Xd(a){return V(a.id)(a.value)}function Yd(){var a,b,d={},e=0;return Ic(Fc(ke)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function ae(a,b){return"number"==typeof ei?ei:b?2*a.tickOffset()*fi/b:0}function be(a,b){Dc(a).forEach(function(a){uj[a]=b===Jg[a],Jg[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Jg[a.id]===b&&(c=!0),a.id in Jg||"line"!==b||(c=!0)}),c}function de(a){return ce(a,"bar")}function ee(a){return ce(a,"scatter")}function fe(a){return ce(a,"pie")}function ge(a){return ce(a,"donut")}function he(a){return fe(a)||ge(a)}function ie(a){var b="string"==typeof a?a:a.id;return!(b in Jg)||"line"===Jg[b]||"spline"===Jg[b]||"area"===Jg[b]||"area-spline"===Jg[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Jg[b]||"area-spline"===Jg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Jg[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Jg[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Jg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Jg[b]}function oe(a){return me(a)||ne(a)}function pe(a){return ie(a)?[a]:[]}function qe(a){return oe(a.data)?[a]:[]}function re(a){return ke(a)?a.values:[]}function se(a){return ie(a)||le(a)?a.values:[]}function te(a){return ke(a)||ie(a)?a.values:[]}function ue(a){return ne(a)&&oi||me(a)&&ii}function ve(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 we(b){var c;try{c=Cg?Ef.time.format(Cg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Cg)}return c}function xe(a,b){var c=Ef.mouse(a),d=Ef.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Ce(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function De(a,b){var c="y"===Z(a.id)?rg:sg,d=ih?1:0,e=ih?0:1;return Math.pow(qg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function Ee(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Fe(a,b,c){Xg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd).attr("stroke",function(){return Qi(b)}).attr("r",1.4*Qe(b)).transition().duration(100).attr("r",Qe)}function Ge(a,b,c){Yg(b,a.node()),nj.select("."+f.selectedCircles+od(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function He(a,b,c,d){a?Fe(b,c,d):Ge(b,c,d)}function Ie(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ef.rgb(Qi(b)).brighter(.75)})}function Je(a,b){Yg(b,a.node()),a.transition().duration(100).style("fill",function(){return Qi(b)})}function Ke(a,b,c,d){a?Ie(b,c,d):Je(b,c,d)}function Le(a,b,c,d){Ke(a,b,c.data,d)}function Me(a){return"circle"===a.nodeName?He:Ef.select(a).classed(f.bar)?Ke:Le}function Ne(a){return a.filter(function(a){return b(a.value)})}function Oe(a){return Zh?"function"==typeof $h?$h(a):$h:0}function Pe(a){return ai?bi?bi:1.75*Oe(a):Oe(a)}function Qe(a){return ci?ci:4*Oe(a)}function Re(a,c){return(c?nj.selectAll("."+f.circles+od(c)):nj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Se(a,b){Re(a,b).classed(f.EXPANDED,!0).attr("r",Pe)}function Te(a){Re(a).filter(function(){return Ef.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Oe)}function Ue(a){return nj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ve(a){Ue(a).classed(f.EXPANDED,!0)}function We(a){Ue(a).classed(f.EXPANDED,!1)}function Xe(a,b){var c=_e(a,b);return function(a,b){var d=c(a,b),e=ih?1:0,f=ih?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 Ye(a,b){var c=_e(a,!1),d=b?Ze:$e;return function(a,b){return d(c(a,b),a,this)}}function Ze(a,b){var c;return ih?(c=ke(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function $e(a,b,c){var d=c.getBoundingClientRect();return ih?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ke(b)?-3:-6)}function _e(a,b){var c=a.__max__+1,d=ae(wg,c),e=Zd(d,c,a,!!b),f=$d(!!b),g=_d(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return ih&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function af(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function bf(b){var c,d,e;if(rj=Ef.select(Hf),rj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(rj.html("").classed("c3",!0),Ff.data.xs={},Ff.data.targets=vc(b),Pg&&Lc(Pg===!0?Cc(Ff.data.targets):Pg),n(),R(),qg.domain(Ef.extent(_b(Ff.data.targets))),rg.domain(Xb(Ff.data.targets,"y")),sg.domain(Xb(Ff.data.targets,"y2")),tg.domain(qg.domain()),ug.domain(rg.domain()),vg.domain(sg.domain()),sj=qg.domain(),gj.scale(tg),Mf&&kj.scale(qg),lj=rj.append("svg").on("mouseenter",Pf).on("mouseleave",Qf),mj=lj.append("defs"),mj.append("clipPath").attr("id",Bi).append("rect"),mj.append("clipPath").attr("id",Ci).append("rect"),mj.append("clipPath").attr("id",Di).append("rect"),nf(),nj=lj.append("g").attr("transform",Zi.main),oj=lj.append("g").attr("transform",Zi.context),pj=lj.append("g").attr("transform",Zi.legend),_g||oj.style("visibility","hidden"),ch||(pj.style("visibility","hidden"),Ui=Cc(Ff.data.targets)),qj=Ef.select(Hf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),zf(Cc(Ff.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=nj.append("g").attr("clip-path",Ei).attr("class",f.grid),Th&&d.append("g").attr("class",f.xgrids),Be(Vh)&&d.append("g").attr("class",f.xgridLines),_h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Wh&&d.append("g").attr("class",f.ygrids),Be(Xh)&&d.append("g").attr("class",f.ygridLines),jh&&nj.append("g").attr("class",f.axisX).attr("clip-path",Fi).attr("transform",Zi.x).append("text").attr("class",f.axisXLabel).attr("transform",ih?"rotate(-90)":"").style("text-anchor",zb),Bh&&nj.append("g").attr("class",f.axisY).attr("clip-path",Gi).attr("transform",Zi.y).append("text").attr("class",f.axisYLabel).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Ab),Kh&&nj.append("g").attr("class",f.axisY2).attr("transform",Zi.y2).append("text").attr("class",f.axisY2Label).attr("transform",ih?"":"rotate(-90)").style("text-anchor",Bb),nj.append("g").attr("clip-path",Ei).attr("class",f.regions),nj.append("g").attr("clip-path",Ei).attr("class",f.chart),c=nj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Mf?ih?"ns-resize":"ew-resize":null),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Zi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),nj.select("."+f.chart).append("g").attr("class",f.chartTexts),Mf&&nj.insert("rect",Of?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Xf).attr("height",Zf).style("opacity",0).style("cursor",ih?"ns-resize":"ew-resize").call(kj).on("dblclick.zoom",null),zh&&gj.extent("function"!=typeof zh?zh:zh(_b())),oj.append("g").attr("clip-path",Ei).attr("class",f.chart),oj.select("."+f.chart).append("g").attr("class",f.chartBars),oj.select("."+f.chart).append("g").attr("class",f.chartLines),oj.append("g").attr("clip-path",Ei).attr("class",f.brush).call(gj).selectAll("rect").attr(ih?"width":"height",ih?Yf:$f),oj.append("g").attr("class",f.axisX).attr("transform",Zi.subx).attr("clip-path",ih?"":Fi),pf(Ff.data.targets),ih?nj.select("."+f.axisX).style("opacity",0).call(wg):(nj.select("."+f.axisY).style("opacity",0).call(xg),nj.select("."+f.axisY2).style("opacity",0).call(yg)),n(),R(),nf(),m(!1),jf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),yi){if(Hi&&"string"==typeof zi){for(zi=we(zi),e=0;e0){d=[];for(var g in Eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Od(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Ke,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function gf(a){he(Ff.data.targets)||Qg&&(Ki=a,nj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Li=!0,Zg())}function hf(){he(Ff.data.targets)||Qg&&(nj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),nj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Li=!1,$g())}function jf(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z=Yd(),$=he(Ff.data.targets),_=Ic(Ff.data.targets);if(a=d(a)?a:{},E=d(a.withY)?a.withY:!0,F=d(a.withSubchart)?a.withSubchart:!0,G=d(a.withTransition)?a.withTransition:!0,J=d(a.withTransform)?a.withTransform:!1,K=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,M=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,N=d(a.withLegend)?a.withLegend:!1,H=d(a.withTransitionForExit)?a.withTransitionForExit:G,I=d(a.withTransitionForAxis)?a.withTransitionForAxis:G,T=G?Tf:0,U=H?T:0,V=I?T:0,c=nj.select("."+f.axisX).style("opacity",$?0:1),g=nj.select("."+f.axisY).style("opacity",$?0:1),h=nj.select("."+f.axisY2).style("opacity",$?0:1),e=oj.select("."+f.axisX).style("opacity",$?0:1),S={axisX:c.transition().duration(V),axisY:g.transition().duration(V),axisY2:h.transition().duration(V),axisSubX:e.transition().duration(V)},N&&ch&&zf(Cc(Ff.data.targets),a,S),Ii&&(0!==_.length&&M&&K||qg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(qg.domain(Ef.extent(_b(_))),sj=qg.domain(),Mf&&kj.scale(qg).updateScaleExtent(),tg.domain(qg.domain()),gj.scale(tg)),K&&(qg.domain(gj.empty()?sj:gj.extent()),Mf&&kj.scale(qg).updateScaleExtent()),th||!sh&&!rh||(W=Kc(Jc(_),rh),wg.tickValues(W),zg.tickValues(W))),rg.domain(Xb(_,"y")),sg.domain(Xb(_,"y2")),S.axisX.call(wg),S.axisY.call(xg),S.axisY2.call(yg),S.axisSubX.call(zg),K&&_.length)if(ph&&W){for(X=1;X=0&&Ef.select(this).style("display",b%Y?"none":"block")})}else lj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ih&&uh&&eb(c,S.axisX,uh),O=Xe(Z),Q=Ye(Z,!0),R=Ye(Z,!1),Db(),ug.domain(rg.domain()),vg.domain(sg.domain()),qj.style("display","none"),o(),nj.select("line."+f.xgridFocus).style("visibility","hidden"),Th){if("year"===Uh){j=[];for(var ab=_b(),bb=ab[0].getFullYear(),cb=ab[1].getFullYear(),db=bb;cb>=db;db++)j.push(new Date(db+"-01-01 00:00:00"))}else j=qg.ticks(10);i=nj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ih?0:function(a){return qg(a)-wg.tickOffset()}).attr("x2",ih?Xf:function(a){return qg(a)-wg.tickOffset()}).attr("y1",ih?function(a){return qg(a)-wg.tickOffset()}:Uf.top).attr("y2",ih?function(a){return qg(a)-wg.tickOffset()}:Zf).style("opacity",function(){return+Ef.select(this).attr(ih?"y1":"x1")===(ih?Zf:0)?0:1}),i.exit().remove()}Be(Vh)&&(k=nj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Vh),l=k.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",ih?"":"rotate(-90)").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",ih?0:Gd).attr("x2",ih?Xf:Gd).attr("y1",ih?Gd:Uf.top).attr("y2",ih?Gd:Zf).style("opacity",1),k.select("text").transition().duration(T).attr("x",ih?Xf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Wh&&(m=nj.select("."+f.ygrids).selectAll("."+f.ygrid).data(rg.ticks(Yh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ih?rg:0).attr("x2",ih?rg:Xf).attr("y1",ih?0:rg).attr("y2",ih?Zf:rg),m.exit().remove()),E&&Be(Xh)&&(n=nj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Xh),p=n.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),p.append("line").style("opacity",0),p.append("text").attr("text-anchor","end").attr("transform",ih?"rotate(-90)":"").attr("dx",ih?0:-Uf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",ih?Hd:0).attr("x2",ih?Hd:Xf).attr("y1",ih?0:Hd).attr("y2",ih?Zf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",ih?0:Xf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=nj.select("."+f.regions).selectAll("rect."+f.region).data(ti),v.enter().append("rect").style("fill-opacity",0),v.attr("class",hd).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(T).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),v.exit().transition().duration(T).style("fill-opacity",0).remove(),t=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),t.style("opacity",td).transition().duration(T).attr("d",O).style("fill",Qi).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Qi),q.style("opacity",td).transition().duration(T).attr("d",hj).style("stroke",Qi).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=nj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Qi).style("opacity",function(){return tj=+Ef.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",ij).style("fill",Qi).style("opacity",tj),r.exit().transition().duration(U).style("opacity",0).remove(),s=nj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Oe).style("fill",Qi),s.style("opacity",td).transition().duration(T).style("opacity",vd).style("fill",Qi).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),s.exit().remove(),w=nj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ih?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Qi).style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value,a.id)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill",Qi).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=nj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Qi(a.data)}).style("cursor",function(a){return Sg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),vf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Ef.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Oi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),wf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();ef(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Oi=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Ef.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return Qi(a.data)}).style("opacity",1).call(Ee,function(){Oi=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),nj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(T).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&oe(a.data)?1:0}),nj.select("."+f.chartArcsTitle).style("opacity",ge(Ff.data.targets)?1:0),_g&&(null!==Ef.event&&"zoom"===Ef.event.type&&gj.extent(qg.orgDomain()).update(),F&&(!ih&&uh&&eb(e,S.axisSubX,uh),gj.empty()||gj.extent(qg.orgDomain()).update(),P=Xe(Z,!0),y=oj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Qi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=oj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Qi),x.style("opacity",td).transition().duration(T).attr("d",jj).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),nj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),nj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",ih?Xd:Wd).attr("cy",ih?Wd:Xd),z=nj.select("."+f.eventRects),Be(Bg)&&!oc(Bg)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),df(A.enter()),A.attr("x",0).attr("y",0).attr("width",Xf).attr("height",Zf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ji&&!Ii?(D=function(a,b){var c=xc(b),d=yc(b),e=Ff.data.xs[a.id][b];return(qg(d?d:e+50)-qg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ff.data.xs[a.id][b];return(qg(d)+qg(c?c:d-50))/2}):(D=L(),C=function(a){return qg(a.x)-D/2}),B=Ac(Ff.data.targets),nj.select("."+f.eventRects).datum(B?B.values:[]),A=nj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),cf(A.enter()),A.attr("class",id).attr("x",ih?0:C).attr("y",ih?C:0).attr("width",ih?Xf:D).attr("height",ih?D:Zf),A.exit().remove()),Cc(Ff.data.targets).forEach(function(a){uj[a]=!0})}function kf(){jf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function lf(){return"mousemove"===Ef.event.sourceEvent.type&&kj.altDomain?(qg.domain(kj.altDomain),void kj.scale(qg).updateScaleExtent()):(Ii&&qg.orgDomain()[0]===sj[0]&&qg.domain([sj[0]-1e-10,qg.orgDomain()[1]]),jf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Ef.event.sourceEvent.type&&(Mi=!0)))}function mf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function nf(){lj.attr("width",_f).attr("height",ag),lj.select("#"+Bi).select("rect").attr("width",Xf).attr("height",Zf),lj.select("#"+Ci).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lj.select("#"+Di).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),lj.select("."+f.zoomRect).attr("width",Xf).attr("height",Zf),rj.style("max-height",ag+"px")}function of(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),nf(),m(a.withTransition),jf(a)}function pf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=nj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",kd),j=i.enter().append("g").attr("class",kd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc),e=nj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),d=e.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",cd).style("cursor",function(a){return Sg(a)?"pointer":null}),c=nj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),b=c.enter().append("g").attr("class",ld).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",$c),b.append("g").attr("class",gd),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",ad).style("cursor",function(a){return Sg(a)?"pointer":null}),a.forEach(function(a){nj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=nj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(hg(a)).attr("class",nd),g=h.enter().append("g").attr("class",nd),g.append("g").attr("class",ed),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),_g&&(n=oj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",md),m=n.enter().append("g").style("opacity",0).attr("class",md),m.append("g").attr("class",cd),l=oj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",ld),k=l.enter().append("g").style("opacity",0).attr("class",ld),k.append("g").attr("class",$c)),lj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Tf).style("opacity",1)}function qf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ff.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=$i?j:i,l=$i?Q():P();return d&&(w=0,C=0,t=0,u=0),ch&&!Hc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=$i?u:t,void(hh?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0,D=pj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,$i?(g=function(a){return t*B[a]},j=function(a){return A[B[a]]+x[a]}):(g=function(a){return A[B[a]]+x[a]},j=function(a){return u*B[a]}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},o=pj.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Uc(f.legendItem,a)}).style("visibility",function(a){return Hc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof eh?eh(a):Ff.toggle(a)}).on("mouseover",function(a){Ef.select(this).classed(f.legendItemFocused,!0),Oi||Ff.focus(a),"function"==typeof fh&&fh(a)}).on("mouseout",function(a){Ef.select(this).classed(f.legendItemFocused,!1),Oi||Ff.revert(),"function"==typeof gh&&gh(a)}),o.append("text").text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",$i?h:-200).attr("y",$i?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",$i?i:-200).attr("y",$i?-200:l).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",Qi).attr("x",$i?h:-200).attr("y",$i?-200:j).attr("width",10).attr("height",10),pj.selectAll("text").data(a).text(function(a){return d(Eg[a])?Eg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),pj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),pj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).style("fill",Qi).attr("x",g).attr("y",j),pj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Ef.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?tf(b):uf(b):cj}),N(t),O(u),M(C),n(),R(),nf(),m(q,c)}function Af(a){return Ec(Ff.data.targets,a.id)}function Bf(a){return"data"in a&&Ec(Ff.data.targets,a.data.id)}function Cf(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 Df(a,b,c){var d=!he(Ff.data.targets);Oi=!1,be(a,b),of(c||{withTransitionForAxis:d})}var Ef=a.d3?a.d3:a.require?a.require("d3"):void 0,Ff={data:{},axis:{},legend:{}},Gf={},Hf=h(["bindto"],"#chart"),If=h(["size","width"]),Jf=h(["size","height"]),Kf=h(["padding","left"],50),Lf=h(["padding","right"]),Mf=h(["zoom","enabled"],!1),Nf=h(["zoom","extent"]),Of=h(["zoom","privileged"],!1),Pf=h(["onenter"],function(){}),Qf=h(["onleave"],function(){}),Rf=h(["onresize"],function(){}),Sf=h(["onresized"],function(){}),Tf=h(["transition","duration"],350);g("data","data is required in config");var Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,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,Ag=h(["data","x"]),Bg=h(["data","xs"],{}),Cg=h(["data","x_format"]),Dg=h(["data","id_converter"],function(a){return a}),Eg=h(["data","names"],{}),Fg=h(["data","classes"],{}),Gg=h(["data","groups"],[]),Hg=h(["data","axes"],{}),Ig=h(["data","type"]),Jg=h(["data","types"],{}),Kg=h(["data","labels"],{}),Lg=h(["data","order"]),Mg=h(["data","regions"],{}),Ng=h(["data","color"]),Og=h(["data","colors"],{}),Pg=h(["data","hide"],!1),Qg=h(["data","selection","enabled"],!1),Rg=h(["data","selection","grouped"],!1),Sg=h(["data","selection","isselectable"],function(){return!0}),Tg=h(["data","selection","multiple"],!0),Ug=h(["data","onclick"],function(){}),Vg=h(["data","onenter"],function(){}),Wg=h(["data","onleave"],function(){}),Xg=h(["data","onselected"],function(){}),Yg=h(["data","onunselected"],function(){}),Zg=h(["data","ondragstart"],function(){}),$g=h(["data","ondragend"],function(){}),_g=h(["subchart","show"],!1),ah=h(["subchart","size","height"],60),bh=h(["color","pattern"],[]),ch=h(["legend","show"],!0),dh=h(["legend","position"],"bottom"),eh=h(["legend","item","onclick"]),fh=h(["legend","item","onmouseover"]),gh=h(["legend","item","onmouseout"]),hh=h(["legend","equally"],!1),ih=h(["axis","rotated"],!1),jh=h(["axis","x","show"],!0),kh=h(["axis","x","type"],"indexed"),lh=h(["axis","x","localtime"],!0),mh=h(["axis","x","categories"],[]),nh=h(["axis","x","tick","centered"],!1),oh=h(["axis","x","tick","format"]),ph=h(["axis","x","tick","culling"],{}),qh=h(["axis","x","tick","culling","max"],10),rh=h(["axis","x","tick","count"]),sh=h(["axis","x","tick","fit"],!0),th=h(["axis","x","tick","values"],null),uh=h(["axis","x","tick","rotate"]),vh=h(["axis","x","max"],null),wh=h(["axis","x","min"],null),xh=h(["axis","x","padding"],{}),yh=h(["axis","x","height"]),zh=h(["axis","x","default"]),Ah=h(["axis","x","label"],{}),Bh=h(["axis","y","show"],!0),Ch=h(["axis","y","max"]),Dh=h(["axis","y","min"]),Eh=h(["axis","y","center"]),Fh=h(["axis","y","label"],{}),Gh=h(["axis","y","inner"],!1),Hh=h(["axis","y","tick","format"]),Ih=h(["axis","y","padding"]),Jh=h(["axis","y","ticks"],10),Kh=h(["axis","y2","show"],!1),Lh=h(["axis","y2","max"]),Mh=h(["axis","y2","min"]),Nh=h(["axis","y2","center"]),Oh=h(["axis","y2","label"],{}),Ph=h(["axis","y2","inner"],!1),Qh=h(["axis","y2","tick","format"]),Rh=h(["axis","y2","padding"]),Sh=h(["axis","y2","ticks"],10),Th=h(["grid","x","show"],!1),Uh=h(["grid","x","type"],"tick"),Vh=h(["grid","x","lines"],[]),Wh=h(["grid","y","show"],!1),Xh=h(["grid","y","lines"],[]),Yh=h(["grid","y","ticks"],10),Zh=h(["point","show"],!0),$h=h(["point","r"],2.5),_h=h(["point","focus","line","enabled"],!0),ai=h(["point","focus","expand","enabled"],!0),bi=h(["point","focus","expand","r"]),ci=h(["point","focus","select","r"]),di=h(["line","connect_null"],!1),ei=h(["bar","width"]),fi=h(["bar","width","ratio"],.6),gi=h(["pie","label","show"],!0),hi=h(["pie","label","format"]),ii=h(["pie","expand"],!0),ji=h(["pie","onclick"],function(){}),ki=h(["pie","onmouseover"],function(){}),li=h(["pie","onmouseout"],function(){}),mi=h(["donut","label","show"],!0),ni=h(["donut","label","format"]),oi=h(["donut","expand"],!0),pi=h(["donut","title"],""),qi=h(["donut","onclick"],function(){}),ri=h(["donut","onmouseover"],function(){}),si=h(["donut","onmouseout"],function(){}),ti=h(["regions"],[]),ui=h(["tooltip","show"],!0),vi=h(["tooltip","format","title"]),wi=h(["tooltip","format","value"]),xi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=vi?vi:b,l=wi?wi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id,a[g].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),yi=h(["tooltip","init","show"],!1),zi=h(["tooltip","init","x"],0),Ai=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Bi=("string"==typeof Hf?Hf.replace("#",""):Hf.id)+"-clip",Ci=Bi+"-xaxis",Di=Bi+"-yaxis",Ei=i(Bi),Fi=i(Ci),Gi=i(Di),Hi="timeseries"===kh,Ii="categorized"===kh,Ji=!Hi&&(Ag||Be(Bg)),Ki=null,Li=!1,Mi=!1,Ni=!1,Oi=!1,Pi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Qi=ve(Og,Be(bh)?bh:Pi,Ng),Ri=lh?Ef.time.format:Ef.time.format.utc,Si=function(){var a=[[Ri("%Y/%-m/%-d"),function(){return!0}],[Ri("%-m/%-d"),function(a){return a.getMonth()}],[Ri("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ri("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ri("%I %p"),function(a){return a.getHours()}],[Ri("%I:%M"),function(a){return a.getMinutes()}],[Ri(":%S"),function(a){return a.getSeconds()}],[Ri(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),Ti=[],Ui=[],Vi=ih?"left":"bottom",Wi=ih?Gh?"top":"bottom":Gh?"right":"left",Xi=ih?Ph?"bottom":"top":Ph?"left":"right",Yi=ih?"left":"bottom",Zi={main:function(){return"translate("+Uf.left+","+Uf.top+")"},context:function(){return"translate("+Vf.left+","+Vf.top+")"},legend:function(){return"translate("+Wf.left+","+Wf.top+")"},x:function(){return"translate(0,"+(ih?0:Zf)+")"},y:function(){return"translate(0,"+(ih?Zf:0)+")"},y2:function(){return"translate("+(ih?0:Xf)+","+(ih?1:0)+")"},subx:function(){return"translate(0,"+(ih?0:$f)+")"},arc:function(){return"translate("+Xf/2+","+Zf/2+")"}},$i="right"===dh,_i=0,aj=0,bj=0,cj=.15,dj=30,ej=ih&&!jh?0:30,fj=5;hg=Ef.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var gj,hj=function(){var a=Ef.svg.line().x(ih?function(a){return V(a.id)(a.value)}:Fd).y(ih?Fd:function(a){return V(a.id)(a.value)});return di||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=di?Ne(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Mg[b.id]?af(e,qg,V(b.id),Mg[b.id]):a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a;return a=ih?Ef.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Ef.svg.area().x(Fd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ne(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?qg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ih?"M "+d+" "+c:"M "+c+" "+d)}}(),jj=function(){var a=Ef.svg.line().x(ih?function(a){return W(a.id)(a.value)}:Id).y(ih?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Ne(b.values);return ie(b)?a(c):"M "+tg(c[0].x)+" "+W(b.id)(c[0].value)}}(),kj=function(){};gj=Ef.svg.brush().on("brush",kf),gj.update=function(){return oj&&oj.select("."+f.brush).call(this),this},gj.scale=function(a){return ih?this.y(a):this.x(a)},Mf&&(kj=Ef.behavior.zoom().on("zoomstart",function(){kj.altDomain=Ef.event.sourceEvent.altKey?qg.orgDomain():null}).on("zoom",Mf?lf:null),kj.scale=function(a){return ih?this.y(a):this.x(a)},kj.orgScaleExtent=function(){var a=Nf?Nf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},kj.updateScaleExtent=function(){var a=ac(qg.orgDomain())/ac(sj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var lj,mj,nj,oj,pj,qj,rj,sj,tj,uj={};if(Ff.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),Ff.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ff.data.targets)&&Nb(a,!0),vf(a,!0)},Ff.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);Ff.revert(),b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),vf(a,!1)},Ff.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=lj.selectAll(pd(a)),d=c.filter(Af),e=c.filter(Bf);b(d.classed(f.focused,!1)),b(e),he(Ff.data.targets)&&Ob(a),wf()},Ff.show=function(a,b){a=Dc(a),b=b||{},Mc(a),lj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&xf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),lj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&yf(a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ff.toggle=function(a){Gc(a)?Ff.hide(a):Ff.show(a)},Ff.unzoom=function(){gj.clear().update(),jf({withUpdateXDomain:!0})},Ff.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Fg[b]=a.classes[b]}),"categories"in a&&Ii&&(mh=a.categories,wg.categories(mh)),"cacheIds"in a&&bc(a.cacheIds)?void qf(dc(a.cacheIds),a.done):void("unload"in a?sf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){rf(a)}):rf(a))},Ff.unload=function(a,b){sf(Dc(a),function(){jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ff.selected=function(a){return Ef.merge(nj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Ef.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ff.select=function(a,b,c){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Ef.select(this),i=e.data?e.data.id:e.id,j=Me(this),k=Rg||!a||a.indexOf(i)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Sg(e)&&!m&&j(!0,h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(!1,h.classed(f.SELECTED,!1),e,g)})},Ff.unselect=function(a,b){Qg&&nj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Ef.select(this),g=c.data?c.data.id:c.id,h=Me(this),i=Rg||!a||a.indexOf(g)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(f.SELECTED); i&&j&&Sg(c)&&k&&h(!1,e.classed(f.SELECTED,!1),c,d)})},Ff.toLine=function(a){Df(a,"line")},Ff.toSpline=function(a){Df(a,"spline")},Ff.toBar=function(a){Df(a,"bar")},Ff.toScatter=function(a){Df(a,"scatter")},Ff.toArea=function(a){Df(a,"area")},Ff.toAreaSpline=function(a){Df(a,"area-spline")},Ff.toPie=function(a){Df(a,"pie",{withTransform:!0})},Ff.toDonut=function(a){Df(a,"donut",{withTransform:!0})},Ff.groups=function(a){return c(a)?Gg:(Gg=a,jf(),Gg)},Ff.xgrids=function(a){return a?(Vh=a,jf(),Vh):Vh},Ff.xgrids.add=function(a){return a?Ff.xgrids(Vh.concat(a)):void 0},Ff.xgrids.remove=function(a){var b=Cf(a);return Ff.xgrids(Vh.filter(b))},Ff.ygrids=function(a){return a?(Xh=a,jf(),Xh):Xh},Ff.ygrids.add=function(a){return a?Ff.ygrids(Xh.concat(a)):void 0},Ff.ygrids.remove=function(a){var b=Cf(a);return Ff.ygrids(Xh.filter(b))},Ff.regions=function(a){return c(a)?ti:(ti=a,jf(),ti)},Ff.regions.add=function(a){return c(a)?ti:(ti=ti.concat(a),jf(),ti)},Ff.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;lj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ti=ti.filter(function(b){return b.classes.indexOf(a)<0})}),ti},Ff.data.get=function(a){var b=Ff.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ff.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ff.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Eg[b]=a[b]}),zf(Cc(Ff.data.targets),{withTransition:!0}),Eg):Eg},Ff.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Og[b]=a[b]}),jf({withLegend:!0}),Og):Og},Ff.x=function(a){return arguments.length&&(qc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.xs=function(a){return arguments.length&&(rc(Ff.data.targets,a),jf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ff.data.xs},Ff.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ff.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,jf())},Ff.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Dh=+a.y),b(a.y2)&&(Mh=+a.y2)):Dh=Mh=+a,jf())},Ff.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ff.axis.max(a.max),"undefined"!=typeof a.min&&Ff.axis.min(a.min))},Ff.legend.show=function(a){xf(Dc(a)),jf({withLegend:!0})},Ff.legend.hide=function(a){yf(Dc(a)),jf({withLegend:!0})},Ff.resize=function(a){If=a?a.width:null,Jf=a?a.height:null,of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ff.destroy=function(){Ff.data.targets=void 0,Ff.data.xs={},rj.html(""),a.onresize=null},"url"in e.data)Ef.xhr(e.data.url,function(a,b){var c,d=Ef.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Ef.csv.parse(b.response),bf(c)});else if("rows"in e.data)bf(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");bf(uc(e.data.columns))}return Ff},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file