From b8b89a6ea1a9ef6f7c098f870c68a1880d8543b2 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 29 Apr 2014 16:48:31 +0900 Subject: [PATCH 01/38] Remove useless fill style for bar --- c3.js | 1 - 1 file changed, 1 deletion(-) diff --git a/c3.js b/c3.js index 03a40f6..c9e0a45 100644 --- a/c3.js +++ b/c3.js @@ -3672,7 +3672,6 @@ // Bars for each data mainBarEnter.append('g') .attr("class", classBars) - .style("fill", function (d) { return color(d); }) .style("stroke", "none") .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }); From 3a55f7dff91150fef5c38da1f7e5d9a614a7b1cf Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 29 Apr 2014 17:09:45 +0900 Subject: [PATCH 02/38] Add done callback for unload - #182 --- c3.js | 3 ++- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index c9e0a45..ca8f613 100644 --- a/c3.js +++ b/c3.js @@ -4233,9 +4233,10 @@ } }; - c3.unload = function (targetIds) { + c3.unload = function (targetIds, done) { unload(mapToTargetIds(targetIds), function () { redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); + if (typeof done === 'function') { done(); } }); }; diff --git a/c3.min.js b/c3.min.js index 1f0ebff..5d0abce 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.32"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); +}hj.html(oi(xf.data.targets.map(function(a){return pc(a.values[qi])}),$(),wd(ee(xf.data.targets)),Hi)),hj.style("top",ri.top).style("left",ri.left).style("display","block")}null==a.onresize&&(a.onresize=bf()),a.onresize.add&&(a.onresize.add(Jf),a.onresize.add(function(){df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Kf))}function Ue(a){a.append("rect").attr("class",fd).style("cursor",Hg&&Ig?"pointer":null).on("mouseover",function(a,b){if(!Ci&&!ee(xf.data.targets)){var c,d,e=xf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(wg).length>0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 3c9901e82a2c668617a6dc0602b30b3b0b87c5a5 Mon Sep 17 00:00:00 2001 From: Mattia Larentis Date: Tue, 29 Apr 2014 10:26:32 +0200 Subject: [PATCH 03/38] Lable -> Label --- htdocs/samples/grid_x_lines.html | 8 ++++---- htdocs/samples/grid_y_lines.html | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/samples/grid_x_lines.html b/htdocs/samples/grid_x_lines.html index 0b65e54..6f1e3fe 100644 --- a/htdocs/samples/grid_x_lines.html +++ b/htdocs/samples/grid_x_lines.html @@ -20,21 +20,21 @@ }, grid: { x: { - lines: [{value: 3, text:'Lable 3'}, {value: 4.5, text: 'Lable 4.5'}] + lines: [{value: 3, text:'Label 3'}, {value: 4.5, text: 'Label 4.5'}] } } }); setTimeout(function () { - chart.xgrids([{value: 1, text:'Lable 1'}, {value: 4, text: 'Lable 4'}]); + chart.xgrids([{value: 1, text:'Label 1'}, {value: 4, text: 'Label 4'}]); }, 1000); setTimeout(function () { - chart.xgrids([{value: 2, text:'Lable 2'}]); + chart.xgrids([{value: 2, text:'Label 2'}]); }, 2000); setTimeout(function () { - chart.xgrids.add([{value: 3, text:'Lable 3', class:'hoge'}]); + chart.xgrids.add([{value: 3, text:'Label 3', class:'hoge'}]); }, 3000); setTimeout(function () { diff --git a/htdocs/samples/grid_y_lines.html b/htdocs/samples/grid_y_lines.html index 260bd19..e1e7207 100644 --- a/htdocs/samples/grid_y_lines.html +++ b/htdocs/samples/grid_y_lines.html @@ -20,21 +20,21 @@ }, grid: { y: { - lines: [{value: 30, text:'Lable 30'}, {value: 250, text: 'Lable 250'}] + lines: [{value: 30, text:'Label 30'}, {value: 250, text: 'Label 250'}] } } }); setTimeout(function () { - chart.ygrids([{value: 130, text:'Lable 130'}, {value: 50, text: 'Lable 50'}]); + chart.ygrids([{value: 130, text:'Label 130'}, {value: 50, text: 'Label 50'}]); }, 1000); setTimeout(function () { - chart.ygrids([{value: 130, text:'Lable 130', class: 'hoge'}]); + chart.ygrids([{value: 130, text:'Label 130', class: 'hoge'}]); }, 2000); setTimeout(function () { - chart.ygrids.add([{value: 230, text:'Lable 230'}]); + chart.ygrids.add([{value: 230, text:'Label 230'}]); }, 3000); setTimeout(function () { From 44bfd0a7447d64c54c532784423a870b98db51bf Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 29 Apr 2014 17:50:02 +0900 Subject: [PATCH 04/38] Remove default padding for tick width of vertical axis - #151 --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index ca8f613..6cb57c6 100644 --- a/c3.js +++ b/c3.js @@ -855,7 +855,7 @@ var box = this.getBoundingClientRect(); if (maxWidth < box.width) { maxWidth = box.width; } }); - return maxWidth < 30 ? 30 : maxWidth; + return maxWidth < 0 ? 0 : maxWidth; } function updateAxisLabels() { main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel) diff --git a/c3.min.js b/c3.min.js index 5d0abce..f3f6672 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.32"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?30:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;ePf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 5d7672410bfce78886d3405892930dbded2da557 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 29 Apr 2014 18:08:11 +0900 Subject: [PATCH 05/38] Update samples --- htdocs/data/c3_test2_ts.csv | 6 +++ htdocs/data/c3_test_ts.csv | 6 +++ htdocs/samples/custom_x_scale.html | 9 ++++ htdocs/samples/custom_xs_scale.html | 24 ++++++++--- htdocs/samples/data_load_timeseries.html | 53 ++++++++++++++++++++++++ 5 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 htdocs/data/c3_test2_ts.csv create mode 100644 htdocs/data/c3_test_ts.csv create mode 100644 htdocs/samples/data_load_timeseries.html diff --git a/htdocs/data/c3_test2_ts.csv b/htdocs/data/c3_test2_ts.csv new file mode 100644 index 0000000..2b8d00e --- /dev/null +++ b/htdocs/data/c3_test2_ts.csv @@ -0,0 +1,6 @@ +x,data1,data2,data3 +2013-04-01,20,180,400 +2013-04-02,40,150,310 +2013-04-03,70,120,470 +2013-04-04,50,170,400 +2013-04-05,80,200,380 \ No newline at end of file diff --git a/htdocs/data/c3_test_ts.csv b/htdocs/data/c3_test_ts.csv new file mode 100644 index 0000000..5bfbd34 --- /dev/null +++ b/htdocs/data/c3_test_ts.csv @@ -0,0 +1,6 @@ +x,data1,data2,data3 +2012-12-31,120,80,200 +2013-01-01,140,50,210 +2013-01-02,170,100,250 +2013-01-03,150,70,300 +2013-01-04,180,120,280 \ No newline at end of file diff --git a/htdocs/samples/custom_x_scale.html b/htdocs/samples/custom_x_scale.html index 6c8aecc..f56569e 100644 --- a/htdocs/samples/custom_x_scale.html +++ b/htdocs/samples/custom_x_scale.html @@ -36,6 +36,15 @@ setTimeout(function () { chart.x([200, 210, 350, 400, 550, 750]); }, 2000); + + setTimeout(function () { + chart.load({ + columns: [ + ['data3', 300, 410, 350, 400, 500, 350], + ] + }); + }, 3000); + diff --git a/htdocs/samples/custom_xs_scale.html b/htdocs/samples/custom_xs_scale.html index 8bd7715..5dd78b8 100644 --- a/htdocs/samples/custom_xs_scale.html +++ b/htdocs/samples/custom_xs_scale.html @@ -26,24 +26,38 @@ }, onenter: function (d) { console.log("onenter", d); }, onleave: function (d) { console.log("onleave", d); } - }, + } }); setTimeout(function () { chart.load({ columns: [ - ['data1', 100, 210, 150, 200, null, 150], + ['data1', 100, 210, 150, null, 200, 150], ['data2', 200, 310, 50, 400, 120, 250, 10], ] }); }, 1000); setTimeout(function () { - chart.xs({ - 'data1': [200, 210, 350, 400, 600, 750] -// 'data2': [200, 210, 350, 400, 550, 750, 900] + chart.load({ + columns: [ + ['x2', 150, 220, 230, 400, 540, 600, 800], + ['data2', 200, 310, 50, 400, 120, 250, 10], + ['data3', 300, 410, 350, 600, 420, 550, 310], + ], + xs: { + data3: 'x2' + } }); }, 2000); + + setTimeout(function () { + chart.xs({ + 'data1': [200, 210, 350, 400, 600, 750], + 'data2': [200, 210, 350, 400, 550, 750, 900] + }); + }, 3000); + diff --git a/htdocs/samples/data_load_timeseries.html b/htdocs/samples/data_load_timeseries.html new file mode 100644 index 0000000..46d2fcc --- /dev/null +++ b/htdocs/samples/data_load_timeseries.html @@ -0,0 +1,53 @@ + + + + + +
+ + + + + + From 9f1660125058d74bdf531206fd43d3a3d1a6178c Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 29 Apr 2014 21:07:32 +0900 Subject: [PATCH 06/38] Fix y2 axis --- c3.js | 25 +++++++++++++++++++++---- c3.min.js | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/c3.js b/c3.js index 6cb57c6..8f794c3 100644 --- a/c3.js +++ b/c3.js @@ -349,10 +349,27 @@ } function transformMain(withTransition, transitions) { - var duration = withTransition !== false ? 250 : 0, - xAxis = (transitions && transitions.axisX) ? transitions.axisX : main.select('.' + CLASS.axisX).transition().duration(duration), - yAxis = (transitions && transitions.axisY) ? transitions.axisY : main.select('.' + CLASS.axisY).transition().duration(duration), - y2Axis = (transitions && transitions.axisYs) ? transitions.axisY2 : main.select('.' + CLASS.axisY2).transition().duration(duration); + var xAxis, yAxis, y2Axis; + + if (transitions && transitions.axisX) { + xAxis = transitions.axisX; + } else { + xAxis = main.select('.' + CLASS.axisX); + if (withTransition) { xAxis = xAxis.transition(); } + } + if (transitions && transitions.axisY) { + yAxis = transitions.axisY; + } else { + yAxis = main.select('.' + CLASS.axisY); + if (withTransition) { yAxis = yAxis.transition(); } + } + if (transitions && transitions.axisY2) { + y2Axis = transitions.axisY2; + } else { + y2Axis = main.select('.' + CLASS.axisY2); + if (withTransition) { y2Axis = y2Axis.transition(); } + } + main.attr("transform", translate.main); xAxis.attr("transform", translate.x); yAxis.attr("transform", translate.y); diff --git a/c3.min.js b/c3.min.js index f3f6672..7bcad33 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.32"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;ePf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 7f4e03c676d51e48d0dc78381a4ad3e6ec04be7b Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 29 Apr 2014 21:10:43 +0900 Subject: [PATCH 07/38] Update version to 0.1.33 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index b6a0675..069e26d 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.32", + "version": "0.1.33", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 8f794c3..c1838de 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.32" + version: "0.1.33" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index 7bcad33..099413e 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.32"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;ePf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file diff --git a/package.json b/package.json index 84d69d5..fd94236 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.32", + "version": "0.1.33", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From 0121bb7ee7cda3011066482ae1e10c585ebef0a4 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 13:35:12 +0900 Subject: [PATCH 08/38] Fix transition --- c3.js | 7 ++++++- c3.min.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index c1838de..b8145f4 100644 --- a/c3.js +++ b/c3.js @@ -3674,6 +3674,7 @@ .attr('class', classChartText); mainTextEnter = mainTextUpdate.enter().append('g') .attr('class', classChartText) + .style('opacity', 0) .style("pointer-events", "none"); mainTextEnter.append('g') .attr('class', classTexts) @@ -3685,6 +3686,7 @@ .attr('class', classChartBar); mainBarEnter = mainBarUpdate.enter().append('g') .attr('class', classChartBar) + .style('opacity', 0) .style("pointer-events", "none"); // Bars for each data mainBarEnter.append('g') @@ -3699,6 +3701,7 @@ .attr('class', classChartLine); mainLineEnter = mainLineUpdate.enter().append('g') .attr('class', classChartLine) + .style('opacity', 0) .style("pointer-events", "none"); // Lines for each data mainLineEnter.append("path") @@ -3789,6 +3792,7 @@ .data(targets) .attr('class', classChartBar); contextBarEnter = contextBarUpdate.enter().append('g') + .style('opacity', 0) .attr('class', classChartBar); // Bars for each data contextBarEnter.append('g') @@ -3800,6 +3804,7 @@ .data(targets) .attr('class', classChartLine); contextLineEnter = contextLineUpdate.enter().append('g') + .style('opacity', 0) .attr('class', classChartLine); // Lines for each data contextLineEnter.append("path") @@ -3812,7 +3817,7 @@ // Fade-in each chart svg.selectAll('.' + CLASS.target).filter(function (d) { return isTargetToShow(d.id); }) - .transition() + .transition().duration(750) .style("opacity", 1); } diff --git a/c3.min.js b/c3.min.js index 099413e..dbe2e38 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); -return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}hj.html(oi(xf.data.targets.map(function(a){return pc(a.values[qi])}),$(),wd(ee(xf.data.targets)),Hi)),hj.style("top",ri.top).style("left",ri.left).style("display","block")}null==a.onresize&&(a.onresize=bf()),a.onresize.add&&(a.onresize.add(Jf),a.onresize.add(function(){df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Kf))}function Ue(a){a.append("rect").attr("class",fd).style("cursor",Hg&&Ig?"pointer":null).on("mouseover",function(a,b){if(!Ci&&!ee(xf.data.targets)){var c,d,e=xf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(wg).length>0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh +},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 740b558194e57ae0e6a88436c30f3e15e35599a5 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 14:11:50 +0900 Subject: [PATCH 09/38] Revert chart state when legend clicked --- c3.js | 22 ++++++++++------------ c3.min.js | 4 ++-- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/c3.js b/c3.js index b8145f4..1947e84 100644 --- a/c3.js +++ b/c3.js @@ -1747,9 +1747,9 @@ return targetId || targetId === 0 ? '-' + (targetId.replace ? targetId.replace(/([^a-zA-Z0-9-_])/g, '-') : targetId) : ''; } function selectorTarget(id) { return '.' + CLASS.target + getTargetSelectorSuffix(id); } - function selectorTargets(ids) { return ids.map(function (id) { return selectorTarget(id); }); } + function selectorTargets(ids) { return ids.length ? ids.map(function (id) { return selectorTarget(id); }) : null; } function selectorLegend(id) { return '.' + CLASS.legendItem + getTargetSelectorSuffix(id); } - function selectorLegends(ids) { return ids.map(function (id) { return selectorLegend(id); }); } + function selectorLegends(ids) { return ids.length ? ids.map(function (id) { return selectorLegend(id); }) : null; } function initialOpacity(d) { return d.value !== null && withoutFadeIn[d.id] ? 1 : 0; @@ -4090,6 +4090,12 @@ .attr('x', xForLegend) .attr('y', yForLegend); + // toggle legend state + legend.selectAll('.' + CLASS.legendItem) + .classed(CLASS.legendItemHidden, function (id) { return !isTargetToShow(id); }) + .transition() + .style('opacity', function (id) { return isTargetToShow(id) ? 1 : legendOpacityForHidden; }); + // Update all to reflect change of legend updateLegendItemWidth(maxWidth); updateLegendItemHeight(maxHeight); @@ -4183,14 +4189,10 @@ if (options.withLegend) { showLegend(targetIds); - } else { - legend.selectAll(selectorLegends(targetIds)) - .classed(CLASS.legendItemHidden, false) - .transition() - .style('opacity', 1); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); + c3.revert(); }; c3.hide = function (targetIds, options) { @@ -4204,14 +4206,10 @@ if (options.withLegend) { hideLegend(targetIds); - } else { - legend.selectAll(selectorLegends(targetIds)) - .classed(CLASS.legendItemHidden, true) - .transition() - .style('opacity', legendOpacityForHidden); } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); + c3.revert(); }; c3.toggle = function (targetId) { diff --git a/c3.min.js b/c3.min.js index dbe2e38..5dd04dd 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh +!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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),gj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Vi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh },xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 36c3553ca3fa77809e64edcdeb73b236bff9c557 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 14:26:38 +0900 Subject: [PATCH 10/38] Fix withLegend on show/hide --- c3.js | 16 ++++++++-------- c3.min.js | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/c3.js b/c3.js index 1947e84..10f0a38 100644 --- a/c3.js +++ b/c3.js @@ -3926,6 +3926,10 @@ .style('opacity', opacityForLegend); } function showLegend(targetIds) { + if (!__legend_show) { + __legend_show = true; + legend.style('visibility', 'visible'); + } removeHiddenLegendIds(targetIds); legend.selectAll(selectorLegends(targetIds)) .style('visibility', 'visible') @@ -3933,6 +3937,10 @@ .style('opacity', opacityForLegend); } function hideLegend(targetIds) { + if (__legend_show && isEmpty(targetIds)) { + __legend_show = false; + legend.style('visibility', 'hidden'); + } addHiddenLegendIds(targetIds); legend.selectAll(selectorLegends(targetIds)) .style('opacity', 0) @@ -4475,20 +4483,12 @@ }; c3.legend.show = function (targetIds) { - if (!__legend_show) { - __legend_show = true; - legend.style('visibility', 'visible'); - } showLegend(mapToTargetIds(targetIds)); redraw({withLegend: true}); }; c3.legend.hide = function (targetIds) { hideLegend(mapToTargetIds(targetIds)); redraw({withLegend: true}); - if (__legend_show && isEmpty(targetIds)) { - __legend_show = false; - legend.style('visibility', 'hidden'); - } }; c3.resize = function (size) { diff --git a/c3.min.js b/c3.min.js index 5dd04dd..b97e9ab 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),gj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Vi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh -},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +}hj.html(oi(xf.data.targets.map(function(a){return pc(a.values[qi])}),$(),wd(ee(xf.data.targets)),Hi)),hj.style("top",ri.top).style("left",ri.left).style("display","block")}null==a.onresize&&(a.onresize=bf()),a.onresize.add&&(a.onresize.add(Jf),a.onresize.add(function(){df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Kf))}function Ue(a){a.append("rect").attr("class",fd).style("cursor",Hg&&Ig?"pointer":null).on("mouseover",function(a,b){if(!Ci&&!ee(xf.data.targets)){var c,d,e=xf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(wg).length>0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),gj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Vi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) +},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 97beb21a33ce7c002bdaf80711ad638b4e9104f6 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 14:43:30 +0900 Subject: [PATCH 11/38] Add data.hide option - #151 --- c3.js | 6 ++++++ c3.min.js | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 10f0a38..33aaa9d 100644 --- a/c3.js +++ b/c3.js @@ -137,6 +137,7 @@ __data_regions = getConfig(['data', 'regions'], {}), __data_color = getConfig(['data', 'color']), __data_colors = getConfig(['data', 'colors'], {}), + __data_hide = getConfig(['data', 'hide'], false), __data_selection_enabled = getConfig(['data', 'selection', 'enabled'], false), __data_selection_grouped = getConfig(['data', 'selection', 'grouped'], false), __data_selection_isselectable = getConfig(['data', 'selection', 'isselectable'], function () { return true; }), @@ -2546,6 +2547,11 @@ c3.data.xs = {}; c3.data.targets = convertDataToTargets(data); + // Set targets to hide if needed + if (__data_hide) { + addHiddenTargetIds(__data_hide === true ? mapToIds(c3.data.targets) : __data_hide); + } + // Init sizes and scales updateSizes(); updateScales(); diff --git a/c3.min.js b/c3.min.js index b97e9ab..bbddace 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),gj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Vi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) -},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?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||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),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?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=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",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.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 Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph: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||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=ah?1:0,f=ah?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return ah?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 ah&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),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",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),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",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=hj.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 Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%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)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) +},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From a81982f27d536f2c9266391392cdb52dbe8770f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Go=CC=88bel?= Date: Wed, 30 Apr 2014 08:50:05 +0200 Subject: [PATCH 12/38] added 'index' to tooltip:format:value arguments --- c3.js | 2 +- c3.min.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index c1838de..e6bb3e0 100644 --- a/c3.js +++ b/c3.js @@ -264,7 +264,7 @@ } name = d[i].name; - value = valueFormat(d[i].value, d[i].ratio, d[i].id); + value = valueFormat(d[i].value, d[i].ratio, d[i].id, d[i].index); text += ""; text += "" + name + ""; diff --git a/c3.min.js b/c3.min.js index 099413e..7f00d5b 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g?"end"in a?ig(yi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); +!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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=_g?Mf.left-Wi-Xi:Pf,Sf=_g?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Ri&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){ej.select("line."+f.xgridFocus).attr("x1",_g?0:-10).attr("x2",_g?Pf:-10).attr("y1",_g?-10:Mf.top).attr("y2",_g?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=_g?f.axisX:f.axisY,b=ej.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:_g?ah?v("x"):1:!sh||xh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Ri?P()+(Bh&&!_g?v("y2"):a):Bh?Gh||_g?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||ah?"x"===a&&ph?ph:"y"!==a||sh?"y2"!==a||Bh?(jb(a).isInner?30:40)+("y2"===a?-10:0):Yi:Vg&&!Ri?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!_g)}function C(){return A(!_g)}function D(){return z(_g)}function E(){return A(_g)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(ph?ph:0)+80:Rf+8}function H(){return F(!_g)}function I(){return G(!_g)}function J(){return F(_g)}function K(){return G(_g)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(zi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Si=a}function N(a){Ti=a}function O(a){Ui=a}function P(){return Vg?Ri?Ti*(Si+1):Tf:0}function Q(){return Vg?Ri?Uf:Ui*(Si+1):0}function R(){var a,b,c=!ig;ag=_g?1:0,bg=_g?Rf:Pf,cg=_g?0:Rf,dg=_g?Pf:1,eg=ag,fg=bg,gg=_g?0:Sf,hg=_g?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,jj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=kh?kh:c?void 0:og.tickValues(),og=X(ig,Mi,a,b),rg=X(lg,Pi,a,b),pg=Y(jg,Ni,yh,Ah),qg=Y(kg,Oi,Hh,Jh),c||(Zi.scale(lg),Ef&&bj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(yi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),zi){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(zi?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),zi?(e.tickCentered(eh),ve(gh)&&(gh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},zi&&e.categories(dh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=yi?Ji:zi?Tc:function(a){return 0>a?a.toFixed(0):a};return fh&&("function"==typeof fh?a=fh:yi&&(a=function(a){return a?Ii(fh)(a):""})),a}function _(a){var b;return"y"===a?b=wh:"y2"===a?b=Fh:"x"===a&&(b=rh),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?wh=b:"y2"===a?Fh=b:"x"===a&&(rh=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",_g?"inner-top":"inner-right")}function hb(){return fb("y",_g?"inner-right":"inner-top")}function ib(){return fb("y2",_g?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!_g,gb())}function rb(){return nb(_g,hb())}function sb(){return nb(_g,ib())}function tb(){return ob(!_g,gb())}function ub(){return ob(_g,hb())}function vb(){return ob(_g,ib())}function wb(){var a=gb();return _g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":ph?ph-10:"3em"}function xb(){var a=hb();return _g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return _g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!_g,gb())}function Ab(){return pb(_g,hb())}function Bb(){return pb(_g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){ej.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),ej.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),ej.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Dh:uh,n="y2"===c?Ch:th,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Eh:vh,r=ud()&&_g;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&zh&&(f=b(zh.top)?zh.top:e,g=b(zh.bottom)?zh.bottom:e),"y2"===c&&Ih&&(f=b(Ih.top)?Ih.top:e,g=b(Ih.bottom)?Ih.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return nh?yi?re(nh):nh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return mh?yi?re(mh):mh:wf.max(a,function(a){return wf.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 zi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof oh&&we(oh)?(e=b(oh.left)?oh.left:d,f=b(oh.right)?oh.right:d):e=f="number"==typeof oh?oh: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||0===c)&&(f=yi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=yi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?_g?Rf:"start"in a?d(a.start):Rf:_g&&"end"in a?ig(yi?re(a.end):a.end):Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=yi?a?a instanceof Date?a:re(a):re(mc(c,d)):Ai&&!zi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Ai&&zi&&0===c&&g&&(0===e&&(dh=[]),dh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(yi?new Date(i):i);j.push(e)}return yi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ki=Ki.concat(a)}function Mc(a){Ki=Ki.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Li=Li.concat(a)}function Oc(a){Li=Li.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&li&&(hj.html(oi(a,$(),wd(k),Hi)).style("display","block"),d=hj.property("offsetWidth"),e=hj.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(_g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),hj.style("top",i+"px").style("left",g+"px"))}function Qd(){hj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});li&&(be(xf.data.targets)||ee(xf.data.targets)||ej.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(_g?"y1":"x1",Cd).attr(_g?"y2":"x2",Cd))}function Sd(){ej.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Xh?Xh:b?2*a.tickOffset()*Yh/b:0}function $d(a,b){Dc(a).forEach(function(a){lj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&fi||je(a)&&_h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=_g?1:0,e=_g?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Og(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud).attr("stroke",function(){return Hi(b)}).attr("r",1.4*Vh).transition().duration(100).attr("r",Vh)}function Be(a,b,c){Pg(b,a.node()),ej.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Hi(b)).darker(1)})}function Ee(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return Hi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?ej.selectAll("."+f.circles+ld(c)):ej).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Uh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Rh)}function Ke(a){return ej.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=_g?1:0,f=_g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return _g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return _g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 _g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(ij=wf.select(zf),ij.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(ij.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),jj=ig.domain(),Zi.scale(lg),Ef&&bj.scale(ig),cj=ij.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),dj=cj.append("defs"),dj.append("clipPath").attr("id",si).append("rect").attr("width",Pf).attr("height",Rf),dj.append("clipPath").attr("id",ti).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.append("clipPath").attr("id",ui).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej=cj.append("g").attr("transform",Qi.main),fj=cj.append("g").attr("transform",Qi.context),gj=cj.append("g").attr("transform",Qi.legend),Sg||fj.style("visibility","hidden"),Vg||(gj.style("visibility","hidden"),Li=Cc(xf.data.targets)),hj=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ah&&ej.append("g").attr("class",f.axisX).attr("clip-path",wi).attr("transform",Qi.x).append("text").attr("class",f.axisXLabel).attr("transform",_g?"rotate(-90)":"").style("text-anchor",zb),sh&&ej.append("g").attr("class",f.axisY).attr("clip-path",xi).attr("transform",Qi.y).append("text").attr("class",f.axisYLabel).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Ab),Bh&&ej.append("g").attr("class",f.axisY2).attr("transform",Qi.y2).append("text").attr("class",f.axisY2Label).attr("transform",_g?"":"rotate(-90)").style("text-anchor",Bb),d=ej.append("g").attr("clip-path",vi).attr("class",f.grid),Kh&&d.append("g").attr("class",f.xgrids),we(Mh)&&d.append("g").attr("class",f.xgridLines),Sh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Nh&&d.append("g").attr("class",f.ygrids),we(Oh)&&d.append("g").attr("class",f.ygridLines),ej.append("g").attr("clip-path",vi).attr("class",f.regions),ej.append("g").attr("clip-path",vi).attr("class",f.chart),c=ej.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?_g?"ns-resize":"ew-resize":null),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Qi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),ej.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&ej.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",_g?"ns-resize":"ew-resize").call(bj).on("dblclick.zoom",null),qh&&Zi.extent("function"!=typeof qh?qh:qh(_b())),fj.append("g").attr("clip-path",vi).attr("class",f.chart),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.append("g").attr("clip-path",vi).attr("class",f.brush).call(Zi).selectAll("rect").attr(_g?"width":"height",_g?Qf:Sf),fj.append("g").attr("class",f.axisX).attr("transform",Qi.subx).attr("clip-path",_g?"":wi),ef(xf.data.targets),_g?ej.select("."+f.axisX).style("opacity",0).call(og):(ej.select("."+f.axisY).style("opacity",0).call(pg),ej.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),pi){if(yi&&"string"==typeof qi){for(qi=re(qi),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Hg&&(Bi=a,ej.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ci=!0,Qg())}function Ze(){ee(xf.data.targets)||Hg&&(ej.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ej.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ci=!1,Rg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=ej.select("."+f.axisX).style("opacity",W?0:1),g=ej.select("."+f.axisY).style("opacity",W?0:1),h=ej.select("."+f.axisY2).style("opacity",W?0:1),e=fj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Vg&&rf(Cc(xf.data.targets),a,O),zi&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),jj=ig.domain(),Ef&&bj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),Zi.scale(lg)),G&&(ig.domain(Zi.empty()?jj:Zi.extent()),Ef&&bj.scale(ig).updateScaleExtent()),kh||!jh&&!ih||(S=Kc(Jc(X),ih),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(gh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!_g&&lh&&eb(c,O.axisX,lh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),hj.style("display","none"),o(),ej.select("line."+f.xgridFocus).style("visibility","hidden"),Kh){if("year"===Lh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=ej.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",_g?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",_g?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",_g?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",_g?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(_g?"y1":"x1")===(_g?Rf:0)?0:1}),i.exit().remove()}we(Mh)&&(k=ej.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Mh),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",_g?"":"rotate(-90)").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",_g?0:Dd).attr("x2",_g?Pf:Dd).attr("y1",_g?Dd:Mf.top).attr("y2",_g?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",_g?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Nh&&(m=ej.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Ph)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",_g?jg:0).attr("x2",_g?jg:Pf).attr("y1",_g?0:jg).attr("y2",_g?Rf:jg),m.exit().remove()),A&&we(Oh)&&(n=ej.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Oh),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",_g?"rotate(-90)":"").attr("dx",_g?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",_g?Ed:0).attr("x2",_g?Ed:Pf).attr("y1",_g?0:Ed).attr("y2",_g?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",_g?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=ej.select("."+f.regions).selectAll("rect."+f.region).data(ki),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Hi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=ej.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return _g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",$i).style("opacity",1),ej.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",_i).style("opacity",kj),q=ej.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Rh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),q.exit().remove(),ej.each(function(){Fi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Fi=!1}),ej.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),ej.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Sg&&(null!==wf.event&&"zoom"===wf.event.type&&Zi.extent(ig.orgDomain()).update(),B&&(!_g&&lh&&eb(e,O.axisSubX,lh),Zi.empty()||Zi.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Hi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1))),ej.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),ej.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",_g?Ud:Td).attr("cy",_g?Td:Ud),v=ej.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ai&&!zi?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),ej.select("."+f.eventRects).datum(x?x.values:[]),w=ej.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",_g?0:y).attr("y",_g?y:0).attr("width",_g?Pf:z).attr("height",_g?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){lj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&bj.altDomain?(ig.domain(bj.altDomain),void bj.scale(ig).updateScaleExtent()):(zi&&ig.orgDomain()[0]===jj[0]&&ig.domain([jj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Di=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){cj.attr("width",Tf).attr("height",Uf),cj.select("#"+si).select("rect").attr("width",Pf).attr("height",Rf),cj.select("#"+ti).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.select("#"+ui).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),cj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),ij.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=ej.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Hi(a)}),e=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Jg(a)?"pointer":null}),c=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return kj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Hi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Hi(a)}).style("cursor",function(a){return Jg(a)?"pointer":null}),a.forEach(function(a){ej.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=ej.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Hi(a.data)}).style("cursor",function(a){return Jg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Fi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Sg&&(n=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Hi(a)}),l=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Hi(a)})),cj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Ri?j:i,l=Ri?Q():P();return d&&(x=0,D=0,u=0,v=0),Vg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Ri?v:u,void($g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Ri?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=gj.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 Xg?Xg(a):xf.toggle(a)}).on("mouseover",function(a){Fi||xf.focus(a),"function"==typeof Yg&&Yg(a)}).on("mouseout",function(a){Fi||xf.revert(),"function"==typeof Zg&&Zg(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ri?h:-200).attr("y",Ri?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ri?i:-200).attr("y",Ri?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Hi(a)}).attr("x",Ri?h:-200).attr("y",Ri?-200:j).attr("width",10).attr("height",10),gj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),gj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),gj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Fi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","selection","enabled"],!1),Ig=h(["data","selection","grouped"],!1),Jg=h(["data","selection","isselectable"],function(){return!0}),Kg=h(["data","selection","multiple"],!0),Lg=h(["data","onclick"],function(){}),Mg=h(["data","onenter"],function(){}),Ng=h(["data","onleave"],function(){}),Og=h(["data","onselected"],function(){}),Pg=h(["data","onunselected"],function(){}),Qg=h(["data","ondragstart"],function(){}),Rg=h(["data","ondragend"],function(){}),Sg=h(["subchart","show"],!1),Tg=h(["subchart","size","height"],60),Ug=h(["color","pattern"],[]),Vg=h(["legend","show"],!0),Wg=h(["legend","position"],"bottom"),Xg=h(["legend","item","onclick"]),Yg=h(["legend","item","onmouseover"]),Zg=h(["legend","item","onmouseout"]),$g=h(["legend","equally"],!1),_g=h(["axis","rotated"],!1),ah=h(["axis","x","show"],!0),bh=h(["axis","x","type"],"indexed"),ch=h(["axis","x","localtime"],!0),dh=h(["axis","x","categories"],[]),eh=h(["axis","x","tick","centered"],!1),fh=h(["axis","x","tick","format"]),gh=h(["axis","x","tick","culling"],{}),hh=h(["axis","x","tick","culling","max"],10),ih=h(["axis","x","tick","count"]),jh=h(["axis","x","tick","fit"],!0),kh=h(["axis","x","tick","values"],null),lh=h(["axis","x","tick","rotate"]),mh=h(["axis","x","max"],null),nh=h(["axis","x","min"],null),oh=h(["axis","x","padding"],{}),ph=h(["axis","x","height"]),qh=h(["axis","x","default"]),rh=h(["axis","x","label"],{}),sh=h(["axis","y","show"],!0),th=h(["axis","y","max"]),uh=h(["axis","y","min"]),vh=h(["axis","y","center"]),wh=h(["axis","y","label"],{}),xh=h(["axis","y","inner"],!1),yh=h(["axis","y","tick","format"]),zh=h(["axis","y","padding"],{}),Ah=h(["axis","y","ticks"],10),Bh=h(["axis","y2","show"],!1),Ch=h(["axis","y2","max"]),Dh=h(["axis","y2","min"]),Eh=h(["axis","y2","center"]),Fh=h(["axis","y2","label"],{}),Gh=h(["axis","y2","inner"],!1),Hh=h(["axis","y2","tick","format"]),Ih=h(["axis","y2","padding"],{}),Jh=h(["axis","y2","ticks"],10),Kh=h(["grid","x","show"],!1),Lh=h(["grid","x","type"],"tick"),Mh=h(["grid","x","lines"],[]),Nh=h(["grid","y","show"],!1),Oh=h(["grid","y","lines"],[]),Ph=h(["grid","y","ticks"],10),Qh=h(["point","show"],!0),Rh=Qh?h(["point","r"],2.5):0,Sh=h(["point","focus","line","enabled"],!0),Th=h(["point","focus","expand","enabled"],!0),Uh=h(["point","focus","expand","r"],Th?4:Rh),Vh=h(["point","focus","select","r"],8),Wh=h(["line","connect_null"],!1),Xh=h(["bar","width"]),Yh=h(["bar","width","ratio"],.6),Zh=h(["pie","label","show"],!0),$h=h(["pie","label","format"]),_h=h(["pie","expand"],!0),ai=h(["pie","onclick"],function(){}),bi=h(["pie","onmouseover"],function(){}),ci=h(["pie","onmouseout"],function(){}),di=h(["donut","label","show"],!0),ei=h(["donut","label","format"]),fi=h(["donut","expand"],!0),gi=h(["donut","title"],""),hi=h(["donut","onclick"],function(){}),ii=h(["donut","onmouseover"],function(){}),ji=h(["donut","onmouseout"],function(){}),ki=h(["regions"],[]),li=h(["tooltip","show"],!0),mi=h(["tooltip","format","title"]),ni=h(["tooltip","format","value"]),oi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=mi?mi:b,l=ni?ni: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+""}),pi=h(["tooltip","init","show"],!1),qi=h(["tooltip","init","x"],0),ri=h(["tooltip","init","position"],{top:"0px",left:"50px"}),si=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ti=si+"-xaxis",ui=si+"-yaxis",vi=i(si),wi=i(ti),xi=i(ui),yi="timeseries"===bh,zi="categorized"===bh,Ai=!yi&&(sg||we(tg)),Bi=null,Ci=!1,Di=!1,Ei=!1,Fi=!1,Gi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Hi=qe(Gg,we(Ug)?Ug:Gi,Fg),Ii=ch?wf.time.format:wf.time.format.utc,Ji=function(){var a=[[Ii("%Y/%-m/%-d"),function(){return!0}],[Ii("%-m/%-d"),function(a){return a.getMonth()}],[Ii("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ii("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ii("%I %p"),function(a){return a.getHours()}],[Ii("%I:%M"),function(a){return a.getMinutes()}],[Ii(":%S"),function(a){return a.getSeconds()}],[Ii(".%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)}}(),Ki=[],Li=[],Mi=_g?"left":"bottom",Ni=_g?xh?"top":"bottom":xh?"right":"left",Oi=_g?Gh?"bottom":"top":Gh?"left":"right",Pi=_g?"left":"bottom",Qi={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(_g?0:Rf)+")"},y:function(){return"translate(0,"+(_g?Rf:0)+")"},y2:function(){return"translate("+(_g?0:Pf)+","+(_g?1:0)+")"},subx:function(){return"translate(0,"+(_g?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Ri="right"===Wg,Si=0,Ti=0,Ui=0,Vi=.15,Wi=30,Xi=_g&&!ah?0:30,Yi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Zi,$i=function(){var a=wf.svg.line().x(_g?function(a){return V(a.id)(a.value)}:Cd).y(_g?Cd:function(a){return V(a.id)(a.value)});return Wh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Wh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a;return a=_g?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,_g?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a=wf.svg.line().x(_g?function(a){return W(a.id)(a.value)}:Fd).y(_g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),bj=function(){};Zi=wf.svg.brush().on("brush",_e),Zi.update=function(){return fj&&fj.select("."+f.brush).call(this),this},Zi.scale=function(a){return _g?this.y(a):this.x(a)},Ef&&(bj=wf.behavior.zoom().on("zoomstart",function(){bj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),bj.scale=function(a){return _g?this.y(a):this.x(a)},bj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},bj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(jj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var cj,dj,ej,fj,gj,hj,ij,jj,kj,lj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=cj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),cj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend?pf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!1).transition().style("opacity",1),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),cj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend?qf(a):gj.selectAll(pd(a)).classed(f.legendItemHidden,!0).transition().style("opacity",Vi),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){Zi.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&zi&&(dh=a.categories,og.categories(dh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(ej.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Ig||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Jg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Hg&&ej.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Ig||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Jg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Mh=a,$e(),Mh):Mh},xf.xgrids.add=function(a){return a?xf.xgrids(Mh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a); return xf.xgrids(Mh.filter(b))},xf.ygrids=function(a){return a?(Oh=a,$e(),Oh):Oh},xf.ygrids.add=function(a){return a?xf.ygrids(Oh.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Oh.filter(b))},xf.regions=function(a){return c(a)?ki:(ki=a,$e(),ki)},xf.regions.add=function(a){return c(a)?ki:(ki=ki.concat(a),$e(),ki)},xf.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;cj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ki=ki.filter(function(b){return b.classes.indexOf(a)<0})}),ki},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){Vg||(Vg=!0,gj.style("visibility","visible")),pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0}),Vg&&ve(a)&&(Vg=!1,gj.style("visibility","hidden"))},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},ij.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From d5181f1db7d10b679d04befa7573523056608f38 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 16:55:05 +0900 Subject: [PATCH 13/38] Modify config logic --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 33aaa9d..60fcb07 100644 --- a/c3.js +++ b/c3.js @@ -91,7 +91,7 @@ // Check next key's value isLast = (i === keys.length - 1); nextTarget = target[keys[i]]; - if ((!isLast && typeof nextTarget !== 'object') || (isLast && typeof defaultValue !== 'object' && typeof nextTarget === 'object' && nextTarget !== null)) { + if (!isLast && typeof nextTarget !== 'object') { return defaultValue; } target = nextTarget; @@ -2048,7 +2048,7 @@ }; } function getBarW(axis, barTargetsNum) { - return __bar_width ? __bar_width : barTargetsNum ? (axis.tickOffset() * 2 * __bar_width_ratio) / barTargetsNum : 0; + return typeof __bar_width === 'number' ? __bar_width : barTargetsNum ? (axis.tickOffset() * 2 * __bar_width_ratio) / barTargetsNum : 0; } //-- Type --// diff --git a/c3.min.js b/c3.min.js index bbddace..2a9b990 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?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||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),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?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=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",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.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 Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph: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||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=ah?1:0,f=ah?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return ah?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 ah&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;ePf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?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||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),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?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=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",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.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 Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph: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||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=ah?1:0,f=ah?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return ah?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 ah&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),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",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),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",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=hj.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 Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%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)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) },xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From d62c5f360a165c7561211046318d575fc2ba2efd Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 18:36:19 +0900 Subject: [PATCH 14/38] Fix transition --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 60fcb07..9bf967b 100644 --- a/c3.js +++ b/c3.js @@ -3823,7 +3823,7 @@ // Fade-in each chart svg.selectAll('.' + CLASS.target).filter(function (d) { return isTargetToShow(d.id); }) - .transition().duration(750) + .transition().duration(__transition_duration) .style("opacity", 1); } diff --git a/c3.min.js b/c3.min.js index 2a9b990..c451a36 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?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||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),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?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=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",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.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 Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph: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||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=ah?1:0,f=ah?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return ah?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 ah&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),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",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),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",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(750).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=hj.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 Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%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)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) +}ij.html(pi(xf.data.targets.map(function(a){return pc(a.values[ri])}),$(),wd(ee(xf.data.targets)),Ii)),ij.style("top",si.top).style("left",si.left).style("display","block")}null==a.onresize&&(a.onresize=bf()),a.onresize.add&&(a.onresize.add(Jf),a.onresize.add(function(){df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Kf))}function Ue(a){a.append("rect").attr("class",fd).style("cursor",Ig&&Jg?"pointer":null).on("mouseover",function(a,b){if(!Di&&!ee(xf.data.targets)){var c,d,e=xf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(wg).length>0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),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",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),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",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=hj.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 Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%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)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) },xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 47b13dadcc394db99c3630131809940550d9576a Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 18:39:30 +0900 Subject: [PATCH 15/38] Set default padding.left --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 9bf967b..9072ad8 100644 --- a/c3.js +++ b/c3.js @@ -105,7 +105,7 @@ var __size_width = getConfig(['size', 'width']), __size_height = getConfig(['size', 'height']); - var __padding_left = getConfig(['padding', 'left']), + var __padding_left = getConfig(['padding', 'left'], 50), __padding_right = getConfig(['padding', 'right']); var __zoom_enabled = getConfig(['zoom', 'enabled'], false), diff --git a/c3.min.js b/c3.min.js index c451a36..400fa4b 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?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||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),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?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=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",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.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 Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph: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||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=ah?1:0,f=ah?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return ah?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 ah&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),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",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),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",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=hj.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 Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"]),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%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)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) +}ij.html(pi(xf.data.targets.map(function(a){return pc(a.values[ri])}),$(),wd(ee(xf.data.targets)),Ii)),ij.style("top",si.top).style("left",si.left).style("display","block")}null==a.onresize&&(a.onresize=bf()),a.onresize.add&&(a.onresize.add(Jf),a.onresize.add(function(){df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Kf))}function Ue(a){a.append("rect").attr("class",fd).style("cursor",Ig&&Jg?"pointer":null).on("mouseover",function(a,b){if(!Di&&!ee(xf.data.targets)){var c,d,e=xf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(wg).length>0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),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",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),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",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=hj.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 Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%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)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) },xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 94976e507f261a8c60030610e63ff18bc10ca1ab Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 18:43:13 +0900 Subject: [PATCH 16/38] Add transition for axis label --- c3.js | 3 +++ c3.min.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/c3.js b/c3.js index 9072ad8..6141a80 100644 --- a/c3.js +++ b/c3.js @@ -877,17 +877,20 @@ } function updateAxisLabels() { main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel) + .transition() .attr("x", xForXAxisLabel) .attr("dx", dxForXAxisLabel) .attr("dy", dyForXAxisLabel) .text(textForXAxisLabel); main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel) + .transition() .attr("x", xForYAxisLabel) .attr("dx", dxForYAxisLabel) .attr("dy", dyForYAxisLabel) .attr("dy", dyForYAxisLabel) .text(textForYAxisLabel); main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label) + .transition() .attr("x", xForY2AxisLabel) .attr("dx", dxForY2AxisLabel) .attr("dy", dyForY2AxisLabel) diff --git a/c3.min.js b/c3.min.js index 400fa4b..699521b 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?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||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),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?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=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",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.select("."+f.axisY2+" ."+f.axisY2Label).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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.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 Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph: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||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=ah?1:0,f=ah?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return ah?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 ah&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;ePf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?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||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),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?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=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",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.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 Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph: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||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=ah?1:0,f=ah?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return ah?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 ah&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),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",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),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",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=hj.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 Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%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)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) },xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 71a74885def39708b62916b8a35f265814206119 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 19:37:34 +0900 Subject: [PATCH 17/38] Remove revert when show/hide --- c3.js | 21 +++++++++------------ c3.min.js | 6 +++--- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/c3.js b/c3.js index 6141a80..40398a7 100644 --- a/c3.js +++ b/c3.js @@ -2630,7 +2630,7 @@ // MEMO: call here to update legend box and tranlate for all // MEMO: translate will be upated by this, so transform not needed in updateLegend() - updateLegend(mapToIds(c3.data.targets), {withTransform: false, withTransitionForTransform: false}); + updateLegend(mapToIds(c3.data.targets), {withTransform: false, withTransitionForTransform: false, withLegendState: true}); /*-- Main Region --*/ @@ -3960,12 +3960,11 @@ var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect; var paddingTop = 4, paddingRight = 26, maxWidth = 0, maxHeight = 0, posMin = 10; var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; - var withTransition, withTransitionForTransform, withTransformAll; + var withTransition, withTransitionForTransform; options = options || {}; withTransition = isDefined(options.withTransition) ? options.withTransition : true; withTransitionForTransform = isDefined(options.withTransitionForTransform) ? options.withTransitionForTransform : true; - withTransformAll = isDefined(options.withTransformAll) ? options.withTransformAll : true; function updatePositions(textElement, id, reset) { var box = textElement.getBoundingClientRect(), @@ -4108,10 +4107,12 @@ .attr('y', yForLegend); // toggle legend state - legend.selectAll('.' + CLASS.legendItem) - .classed(CLASS.legendItemHidden, function (id) { return !isTargetToShow(id); }) - .transition() - .style('opacity', function (id) { return isTargetToShow(id) ? 1 : legendOpacityForHidden; }); + if (options.withLegendState) { + legend.selectAll('.' + CLASS.legendItem) + .classed(CLASS.legendItemHidden, function (id) { return !isTargetToShow(id); }) + .transition() + .style('opacity', function (id) { return isTargetToShow(id) ? 1 : legendOpacityForHidden; }); + } // Update all to reflect change of legend updateLegendItemWidth(maxWidth); @@ -4122,9 +4123,7 @@ updateScales(); updateSvgSize(); // Update g positions - if (withTransformAll) { - transformAll(withTransitionForTransform, transitions); - } + transformAll(withTransitionForTransform, transitions); } /*-- Event Handling --*/ @@ -4209,7 +4208,6 @@ } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); - c3.revert(); }; c3.hide = function (targetIds, options) { @@ -4226,7 +4224,6 @@ } redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); - c3.revert(); }; c3.toggle = function (targetId) { diff --git a/c3.min.js b/c3.min.js index 699521b..9fe583e 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?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||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),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?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=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",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.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 Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph: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||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=ah?1:0,f=ah?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return ah?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 ah&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),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",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),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",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,x=0,D++)),C[a]=D,B[D]=f,y[a]=x,x+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+t)/10),j=10*Math.ceil((h.height+s)/10),k=Si?j:i,l=Si?Q():P();return d&&(x=0,D=0,u=0,v=0),Wg&&!Hc(c)?void(z[c]=A[c]=C[c]=y[c]=0):(z[c]=i,A[c]=j,(!u||i>=u)&&(u=i),(!v||j>=v)&&(v=j),g=Si?v:u,void(_g?(Object.keys(z).forEach(function(a){z[a]=u}),Object.keys(A).forEach(function(a){A[a]=v}),f=(l-g*a.length)/2,w>f?(x=0,D=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var g,h,i,j,k,l,o,p,q,r,s=4,t=26,u=0,v=0,w=10,x=0,y={},z={},A={},B=[0],C={},D=0;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,r=d(b.withTransformAll)?b.withTransformAll:!0,Si?(g=function(a){return u*(.2+C[a])},j=function(a){return B[C[a]]+y[a]}):(g=function(a){return B[C[a]]+y[a]},j=function(a){return v*(.2+C[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=hj.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 Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-200:l).attr("width",function(a){return z[a]}).attr("height",function(a){return A[a]}),o.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(u),O(v),M(D),n(),R(),cf(),r&&m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%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)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xf.revert()},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0}) -},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?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||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),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?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=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",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.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 Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph: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||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=ah?1:0,f=ah?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return ah?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 ah&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1,withLegendState:!0}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),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",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),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",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.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=Si?j:i,l=Si?Q():P();return d&&(w=0,C=0,t=0,u=0),Wg&&!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=Si?u:t,void(_g?(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;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Si?(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=hj.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 Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-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",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),b.withLegendState&&hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(t),O(u),M(C),n(),R(),cf(),m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%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)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg) +},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From a4bee876973b8650a72ee4f9a8da43540cedfacb Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 22:18:45 +0900 Subject: [PATCH 18/38] Refactor legend --- c3.js | 64 ++++++++++++++++++++++++++++++++++--------------------- c3.min.js | 6 +++--- 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/c3.js b/c3.js index 40398a7..a5e3d97 100644 --- a/c3.js +++ b/c3.js @@ -61,6 +61,7 @@ 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_', @@ -351,7 +352,6 @@ function transformMain(withTransition, transitions) { var xAxis, yAxis, y2Axis; - if (transitions && transitions.axisX) { xAxis = transitions.axisX; } else { @@ -370,7 +370,6 @@ y2Axis = main.select('.' + CLASS.axisY2); if (withTransition) { y2Axis = y2Axis.transition(); } } - main.attr("transform", translate.main); xAxis.attr("transform", translate.x); yAxis.attr("transform", translate.y); @@ -378,14 +377,18 @@ main.select('.' + CLASS.chartArcs).attr("transform", translate.arc); } function transformContext(withTransition, transitions) { - var duration = withTransition !== false ? 250 : 0, - subXAxis = (transitions && transitions.axisSubX) ? transitions.axisSubX : context.select('.' + CLASS.axisX).transition().duration(duration); + var subXAxis; + if (transitions && transitions.axisSubX) { + subXAxis = transitions.axisSubX; + } else { + subXAxis = context.select('.' + CLASS.axisX); + if (withTransition) { subXAxis = subXAxis.transition(); } + } context.attr("transform", translate.context); subXAxis.attr("transform", translate.subx); } function transformLegend(withTransition) { - var duration = withTransition !== false ? 250 : 0; - legend.transition().duration(duration).attr("transform", translate.legend); + (withTransition ? legend.transition() : legend).attr("transform", translate.legend); } function transformAll(withTransition, transitions) { transformMain(withTransition, transitions); @@ -2630,7 +2633,7 @@ // MEMO: call here to update legend box and tranlate for all // MEMO: translate will be upated by this, so transform not needed in updateLegend() - updateLegend(mapToIds(c3.data.targets), {withTransform: false, withTransitionForTransform: false, withLegendState: true}); + updateLegend(mapToIds(c3.data.targets), {withTransform: false, withTransitionForTransform: false}); /*-- Main Region --*/ @@ -3910,18 +3913,23 @@ /*-- Draw Legend --*/ - function opacityForLegend(id) { - return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 1; + function opacityForLegend(legendItem) { + return legendItem.classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 1; } - function opacityForUnfocusedLegend(id) { - return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 0.3; + function opacityForUnfocusedLegend(legendItem) { + return legendItem.classed(CLASS.legendItemHidden) ? legendOpacityForHidden : 0.3; } function toggleFocusLegend(id, focus) { - var legendItem = legend.selectAll('.' + CLASS.legendItem), - isTarget = function (d) { return (!id || d === id); }, - notTarget = function (d) { return !isTarget(d); }; - legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? opacityForUnfocusedLegend : opacityForLegend); - legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : opacityForUnfocusedLegend); + legend.selectAll('.' + CLASS.legendItem) + .transition().duration(100) + .style('opacity', function (_id) { + var This = d3.select(this); + if (id && _id !== id) { + return focus ? opacityForUnfocusedLegend(This) : opacityForLegend(This); + } else { + return focus ? opacityForLegend(This) : opacityForUnfocusedLegend(This); + } + }); } function focusLegend(id) { toggleFocusLegend(id, true); @@ -3932,7 +3940,7 @@ function revertLegend() { legend.selectAll('.' + CLASS.legendItem) .transition().duration(100) - .style('opacity', opacityForLegend); + .style('opacity', function () { return opacityForLegend(d3.select(this)); }); } function showLegend(targetIds) { if (!__legend_show) { @@ -3943,7 +3951,7 @@ legend.selectAll(selectorLegends(targetIds)) .style('visibility', 'visible') .transition() - .style('opacity', opacityForLegend); + .style('opacity', function () { return opacityForLegend(d3.select(this)); }); } function hideLegend(targetIds) { if (__legend_show && isEmpty(targetIds)) { @@ -3961,6 +3969,7 @@ var paddingTop = 4, paddingRight = 26, maxWidth = 0, maxHeight = 0, posMin = 10; var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; var withTransition, withTransitionForTransform; + var hasFocused = legend.selectAll('.' + CLASS.legendItemFocused).size(); options = options || {}; withTransition = isDefined(options.withTransition) ? options.withTransition : true; @@ -4049,6 +4058,7 @@ typeof __legend_item_onclick === 'function' ? __legend_item_onclick(id) : c3.toggle(id); }) .on('mouseover', function (id) { + d3.select(this).classed(CLASS.legendItemFocused, true); if (!transiting) { c3.focus(id); } @@ -4057,6 +4067,7 @@ } }) .on('mouseout', function (id) { + d3.select(this).classed(CLASS.legendItemFocused, false); if (!transiting) { c3.revert(); } @@ -4107,12 +4118,17 @@ .attr('y', yForLegend); // toggle legend state - if (options.withLegendState) { - legend.selectAll('.' + CLASS.legendItem) - .classed(CLASS.legendItemHidden, function (id) { return !isTargetToShow(id); }) - .transition() - .style('opacity', function (id) { return isTargetToShow(id) ? 1 : legendOpacityForHidden; }); - } + legend.selectAll('.' + CLASS.legendItem) + .classed(CLASS.legendItemHidden, function (id) { return !isTargetToShow(id); }) + .transition() + .style('opacity', function (id) { + var This = d3.select(this); + if (isTargetToShow(id)) { + return !hasFocused || This.classed(CLASS.legendItemFocused) ? opacityForLegend(This) : opacityForUnfocusedLegend(This); + } else { + return legendOpacityForHidden; + } + }); // Update all to reflect change of legend updateLegendItemWidth(maxWidth); diff --git a/c3.min.js b/c3.min.js index 9fe583e..051f91b 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?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||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),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?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=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",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.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 Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph: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||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=ah?1:0,f=ah?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return ah?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 ah&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1,withLegendState:!0}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),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",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),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",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.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=Si?j:i,l=Si?Q():P();return d&&(w=0,C=0,t=0,u=0),Wg&&!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=Si?u:t,void(_g?(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;b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Si?(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=hj.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 Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-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",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),b.withLegendState&&hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){return Gc(a)?1:Wi}),N(t),O(u),M(C),n(),R(),cf(),m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%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)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline")},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg) -},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?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||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),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?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=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",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.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 Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph: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||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=ah?1:0,f=ah?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return ah?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 ah&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),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",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),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",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.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=Si?j:i,l=Si?Q():P();return d&&(w=0,C=0,t=0,u=0),Wg&&!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=Si?u:t,void(_g?(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=hj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Si?(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=hj.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 Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){wf.select(this).classed(f.legendItemFocused,!0),Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){wf.select(this).classed(f.legendItemFocused,!1),Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-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",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=wf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?jf(b):kf(b):Wi}),N(t),O(u),M(C),n(),R(),cf(),m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%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)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline") +},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From eb08e08b0758aba10d06e4147dfd3d3a9de7077e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 22:24:42 +0900 Subject: [PATCH 19/38] Refactor focus/defocus legend item --- c3.js | 12 +++--------- c3.min.js | 6 +++--- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/c3.js b/c3.js index a5e3d97..45e6624 100644 --- a/c3.js +++ b/c3.js @@ -3763,7 +3763,7 @@ callback = getArcOnMouseOver(); // transitions expandArc(updated.data.id); - focusLegend(updated.data.id); + toggleFocusLegend(updated.data.id, true); callback(arcData, i); }) .on('mousemove', function (d) { @@ -3931,12 +3931,6 @@ } }); } - function focusLegend(id) { - toggleFocusLegend(id, true); - } - function defocusLegend(id) { - toggleFocusLegend(id, false); - } function revertLegend() { legend.selectAll('.' + CLASS.legendItem) .transition().duration(100) @@ -4176,7 +4170,7 @@ if (hasArcType(c3.data.targets)) { expandArc(targetId, true); } - focusLegend(targetId); + toggleFocusLegend(targetId, true); }; c3.defocus = function (targetId) { @@ -4192,7 +4186,7 @@ if (hasArcType(c3.data.targets)) { unexpandArc(targetId); } - defocusLegend(targetId); + toggleFocusLegend(targetId, false); }; c3.revert = function (targetId) { diff --git a/c3.min.js b/c3.min.js index 051f91b..fd57c23 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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;cPf&&(Pf=0),0>Rf&&(Rf=0),Qf=ah?Mf.left-Xi-Yi:Pf,Sf=ah?Rf:Uf-Nf.top-Nf.bottom,0>Qf&&(Qf=0),0>Sf&&(Sf=0),p(),Si&&ee(xf.data.targets)&&(Of.left=Pf/2+Wf)}function o(){fj.select("line."+f.xgridFocus).attr("x1",ah?0:-10).attr("x2",ah?Pf:-10).attr("y1",ah?-10:Mf.top).attr("y2",ah?-10:Rf)}function p(){Wf=Rf/2,Vf=.95*Wf,Xf=de(xf.data.targets)?.6*Vf:0}function q(){var a=ah?f.axisX:f.axisY,b=fj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=wf.select(zf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Af?Af:x()}function s(){var a=Bf?Bf:y();return a>0?a:320}function t(){return ee(xf.data.targets)?0:Cf?Cf:ah?bh?v("x"):1:!th||yh?1:v("y")}function u(){var a=1;return ee(xf.data.targets)?0:Df?Df:Si?P()+(Ch&&!ah?v("y2"):a):Ch?Hh||ah?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||bh?"x"===a&&qh?qh:"y"!==a||th?"y2"!==a||Ch?(jb(a).isInner?30:40)+("y2"===a?-10:0):Zi:Wg&&!Si?10:1:0}function x(){return+wf.select(zf).style("width").replace("px","")}function y(){return+wf.select(zf).style("height").replace("px","")}function z(a){return a?-5:-(Mf.left-1)}function A(a){return a?-20:-4}function B(){return z(!ah)}function C(){return A(!ah)}function D(){return z(ah)}function E(){return A(ah)}function F(a){return a?Pf+2+4:Mf.left+20}function G(a){return a?(qh?qh:0)+80:Rf+8}function H(){return F(!ah)}function I(){return G(!ah)}function J(){return F(ah)}function K(){return G(ah)}function L(){var a,b,c,d,e,f=Ac(xf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=ig(b.x)-ig(a.x),d=zc(),e=ae(xf.data.targets)?(d-(Ai?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ti=a}function N(a){Ui=a}function O(a){Vi=a}function P(){return Wg?Si?Ui*(Ti+1):Tf:0}function Q(){return Wg?Si?Uf:Vi*(Ti+1):0}function R(){var a,b,c=!ig;ag=ah?1:0,bg=ah?Rf:Pf,cg=ah?0:Rf,dg=ah?Pf:1,eg=ag,fg=bg,gg=ah?0:Sf,hg=ah?Qf:1,ig=T(ag,bg,c?void 0:ig.domain(),function(){return og.tickOffset()}),jg=U(cg,dg,c?void 0:jg.domain()),kg=U(cg,dg,c?void 0:kg.domain()),lg=T(ag,bg,kj,function(a){return a%1?0:rg.tickOffset()}),mg=U(gg,hg,c?void 0:mg.domain()),ng=U(gg,hg,c?void 0:ng.domain()),a=$(),b=lh?lh:c?void 0:og.tickValues(),og=X(ig,Ni,a,b),rg=X(lg,Qi,a,b),pg=Y(jg,Oi,zh,Bh),qg=Y(kg,Pi,Ih,Kh),c||($i.scale(lg),Ef&&cj.scale(ig)),S()}function S(){Yf=Gb(),Zf=Hb(),$f=Hb(.98)}function T(a,b,d,e){var f=(zi?wf.time.scale():wf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Ai){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=wf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?kg:jg}function W(a){return"y2"===Z(a)?ng:mg}function X(a,b,c,d){var e=(Ai?Eb():wf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Ai?(e.tickCentered(fh),ve(hh)&&(hh=!1)):e.tickOffset=function(){var a=Bc(xf.data.targets),b=ig(a[1])-ig(a[0]);return b/zc()/2},Ai&&e.categories(eh),e}function Y(a,b,c,d){return wf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in zg?zg[a]:"y"}function $(){var a=zi?Ki:Ai?Tc:function(a){return 0>a?a.toFixed(0):a};return gh&&("function"==typeof gh?a=gh:zi&&(a=function(a){return a?Ji(gh)(a):""})),a}function _(a){var b;return"y"===a?b=xh:"y2"===a?b=Gh:"x"===a&&(b=sh),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?xh=b:"y2"===a?Gh=b:"x"===a&&(sh=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",ah?"inner-top":"inner-right")}function hb(){return fb("y",ah?"inner-right":"inner-top")}function ib(){return fb("y2",ah?"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?Pf/2:Pf:b.isBottom?-Rf:b.isMiddle?-Rf/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(!ah,gb())}function rb(){return nb(ah,hb())}function sb(){return nb(ah,ib())}function tb(){return ob(!ah,gb())}function ub(){return ob(ah,hb())}function vb(){return ob(ah,ib())}function wb(){var a=gb();return ah?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":qh?qh-10:"3em"}function xb(){var a=hb();return ah?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return ah?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!ah,gb())}function Ab(){return pb(ah,hb())}function Bb(){return pb(ah,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return wf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){fj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),fj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),fj.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 wf.min(Object.keys(i).map(function(a){return wf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(yg.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 wf.max(Object.keys(i).map(function(a){return wf.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?Eh:vh,n="y2"===c?Dh:uh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Fh:wh,r=ud()&&ah;return 0===l.length?"y2"===c?kg.domain():jg.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=vd(o,p),j=ac(jg.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&&Ah&&(f=b(Ah.top)?Ah.top:e,g=b(Ah.bottom)?Ah.bottom:e),"y2"===c&&Jh&&(f=b(Jh.top)?Jh.top:e,g=b(Jh.bottom)?Jh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return oh?zi?re(oh):oh:wf.min(a,function(a){return wf.min(a.values,function(a){return a.x})})}function Zb(a){return nh?zi?re(nh):nh:wf.max(a,function(a){return wf.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 Ai?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ph&&we(ph)?(e=b(ph.left)?ph.left:d,f=b(ph.right)?ph.right:d):e=f="number"==typeof ph?ph: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||0===c)&&(f=zi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=zi?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?jg:kg;return b="y"===a.axis||"y2"===a.axis?ah?Rf:"start"in a?d(a.start):Rf:ah?"end"in a?ig(zi?re(a.end):a.end):Rf:Rf,c>b?0:b-c}function ic(a){return sg&&a===sg||we(tg)&&xe(tg,a)}function jc(a){return!ic(a)}function kc(a){return sg?sg:we(tg)?tg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=xf.data.xs[b])}),c}function mc(a,b){return a in xf.data.xs&&xf.data.xs[a]&&xf.data.xs[a][b]?xf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){tg[b]=a[b]})}function oc(a){return 1===wf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=wg[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)}),xf.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=zi?a?a instanceof Date?a:re(a):re(mc(c,d)):Bi&&!Ai?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?xf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):sg?(d=Object.keys(xf.data.xs),xf.data.xs[c]=d.length>0?xf.data.xs[d[0]]:void 0):we(tg)&&(xf.data.xs[c]=lc(f,xf.data.targets)):xf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!xf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=vg(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 Bi&&Ai&&0===c&&g&&(0===e&&(eh=[]),eh.push(g)),("undefined"==typeof a[b]||xf.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++})}),Ag&&$d(Cc(c).filter(function(a){return!(a in Bg)}),Ag),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&&xf.data.targets[0].values[a-1]?xf.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(xf.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(zi?new Date(i):i);j.push(e)}return zi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Li=Li.concat(a)}function Mc(a){Li=Li.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Mi=Mi.concat(a)}function Oc(a){Mi=Mi.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return wf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Dg&&"desc"===Dg.toLowerCase()}function Nd(){return Dg&&"asc"===Dg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Dg&&a.sort(Dg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(xf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&mi&&(ij.html(pi(a,$(),wd(k),Ii)).style("display","block"),d=ij.property("offsetWidth"),e=ij.property("offsetHeight"),k?(g=Pf/2+c[0],i=Rf/2+c[1]+20):(ah?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=ig(l[0].x)+20):(f=q(),g=f+t()+ig(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)),ij.style("top",i+"px").style("left",g+"px"))}function Qd(){ij.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});mi&&(be(xf.data.targets)||ee(xf.data.targets)||fj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(ah?"y1":"x1",Cd).attr(ah?"y2":"x2",Cd))}function Sd(){fj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?ig(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Yh?Yh:b?2*a.tickOffset()*Zh/b:0}function $d(a,b){Dc(a).forEach(function(a){mj[a]=b===Bg[a],Bg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Bg[a.id]===b&&(c=!0),a.id in Bg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Bg)||"line"===Bg[b]||"spline"===Bg[b]||"area"===Bg[b]||"area-spline"===Bg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Bg[b]||"area-spline"===Bg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Bg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Bg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Bg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Bg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&gi||je(a)&&ai}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=ug?wf.time.format(ug).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+ug)}return c}function se(a,b){var c=wf.mouse(a),d=wf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?jg:kg,d=ah?1:0,e=ah?0:1;return Math.pow(ig(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Pg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud).attr("stroke",function(){return Ii(b)}).attr("r",1.4*Wh).transition().duration(100).attr("r",Wh)}function Be(a,b,c){Qg(b,a.node()),fj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Pg(b,a.node()),a.transition().duration(100).style("fill",function(){return wf.rgb(Ii(b)).darker(1)})}function Ee(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ii(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?fj.selectAll("."+f.circles+ld(c)):fj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Vh)}function Je(a){He(a).filter(function(){return wf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Sh)}function Ke(a){return fj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=ah?1:0,f=ah?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return ah?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return ah?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(og,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 ah&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(jj=wf.select(zf),jj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(jj.html("").classed("c3",!0),xf.data.xs={},xf.data.targets=vc(b),Hg&&Lc(Hg===!0?Cc(xf.data.targets):Hg),n(),R(),ig.domain(wf.extent(_b(xf.data.targets))),jg.domain(Xb(xf.data.targets,"y")),kg.domain(Xb(xf.data.targets,"y2")),lg.domain(ig.domain()),mg.domain(jg.domain()),ng.domain(kg.domain()),kj=ig.domain(),$i.scale(lg),Ef&&cj.scale(ig),dj=jj.append("svg").attr("width",Pf+Mf.left+Mf.right).attr("height",Rf+Mf.top+Mf.bottom).on("mouseenter",Hf).on("mouseleave",If),ej=dj.append("defs"),ej.append("clipPath").attr("id",ti).append("rect").attr("width",Pf).attr("height",Rf),ej.append("clipPath").attr("id",ui).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.append("clipPath").attr("id",vi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),fj=dj.append("g").attr("transform",Ri.main),gj=dj.append("g").attr("transform",Ri.context),hj=dj.append("g").attr("transform",Ri.legend),Tg||gj.style("visibility","hidden"),Wg||(hj.style("visibility","hidden"),Mi=Cc(xf.data.targets)),ij=wf.select(zf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),rf(Cc(xf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),bh&&fj.append("g").attr("class",f.axisX).attr("clip-path",xi).attr("transform",Ri.x).append("text").attr("class",f.axisXLabel).attr("transform",ah?"rotate(-90)":"").style("text-anchor",zb),th&&fj.append("g").attr("class",f.axisY).attr("clip-path",yi).attr("transform",Ri.y).append("text").attr("class",f.axisYLabel).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Ab),Ch&&fj.append("g").attr("class",f.axisY2).attr("transform",Ri.y2).append("text").attr("class",f.axisY2Label).attr("transform",ah?"":"rotate(-90)").style("text-anchor",Bb),d=fj.append("g").attr("clip-path",wi).attr("class",f.grid),Lh&&d.append("g").attr("class",f.xgrids),we(Nh)&&d.append("g").attr("class",f.xgridLines),Th&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Oh&&d.append("g").attr("class",f.ygrids),we(Ph)&&d.append("g").attr("class",f.ygridLines),fj.append("g").attr("clip-path",wi).attr("class",f.regions),fj.append("g").attr("clip-path",wi).attr("class",f.chart),c=fj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ef?ah?"ns-resize":"ew-resize":null),fj.select("."+f.chart).append("g").attr("class",f.chartBars),fj.select("."+f.chart).append("g").attr("class",f.chartLines),fj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Ri.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),fj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ef&&fj.insert("rect",Gf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Pf).attr("height",Rf).style("opacity",0).style("cursor",ah?"ns-resize":"ew-resize").call(cj).on("dblclick.zoom",null),rh&&$i.extent("function"!=typeof rh?rh:rh(_b())),gj.append("g").attr("clip-path",wi).attr("class",f.chart),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.append("g").attr("clip-path",wi).attr("class",f.brush).call($i).selectAll("rect").attr(ah?"width":"height",ah?Qf:Sf),gj.append("g").attr("class",f.axisX).attr("transform",Ri.subx).attr("clip-path",ah?"":xi),ef(xf.data.targets),ah?fj.select("."+f.axisX).style("opacity",0).call(og):(fj.select("."+f.axisY).style("opacity",0).call(pg),fj.select("."+f.axisY2).style("opacity",0).call(qg)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),qi){if(zi&&"string"==typeof ri){for(ri=re(ri),e=0;e0){d=[];for(var g in wg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(xf.data.targets)||Ig&&(Ci=a,fj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Di=!0,Rg())}function Ze(){ee(xf.data.targets)||Ig&&(fj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),fj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Di=!1,Sg())}function $e(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=Vd(),W=ee(xf.data.targets),X=Ic(xf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Lf:0,Q=D?P:0,R=E?P:0,c=fj.select("."+f.axisX).style("opacity",W?0:1),g=fj.select("."+f.axisY).style("opacity",W?0:1),h=fj.select("."+f.axisY2).style("opacity",W?0:1),e=gj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Wg&&rf(Cc(xf.data.targets),a,O),Ai&&(0!==X.length&&H&&G||ig.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(ig.domain(wf.extent(_b(X))),kj=ig.domain(),Ef&&cj.scale(ig).updateScaleExtent(),lg.domain(ig.domain()),$i.scale(lg)),G&&(ig.domain($i.empty()?kj:$i.extent()),Ef&&cj.scale(ig).updateScaleExtent()),lh||!kh&&!jh||(S=Kc(Jc(X),jh),og.tickValues(S),rg.tickValues(S))),jg.domain(Xb(X,"y")),kg.domain(Xb(X,"y2")),O.axisX.call(og),O.axisY.call(pg),O.axisY2.call(qg),O.axisSubX.call(rg),G&&X.length)if(hh&&S){for(T=1;T=0&&wf.select(this).style("display",b%U?"none":"block")})}else wf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!ah&&mh&&eb(c,O.axisX,mh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),mg.domain(jg.domain()),ng.domain(kg.domain()),ij.style("display","none"),o(),fj.select("line."+f.xgridFocus).style("visibility","hidden"),Lh){if("year"===Mh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=ig.ticks(10);i=fj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",ah?0:function(a){return ig(a)-og.tickOffset()}).attr("x2",ah?Pf:function(a){return ig(a)-og.tickOffset()}).attr("y1",ah?function(a){return ig(a)-og.tickOffset()}:Mf.top).attr("y2",ah?function(a){return ig(a)-og.tickOffset()}:Rf).style("opacity",function(){return+wf.select(this).attr(ah?"y1":"x1")===(ah?Rf:0)?0:1}),i.exit().remove()}we(Nh)&&(k=fj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Nh),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",ah?"":"rotate(-90)").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",ah?0:Dd).attr("x2",ah?Pf:Dd).attr("y1",ah?Dd:Mf.top).attr("y2",ah?Dd:Rf).style("opacity",1),k.select("text").transition().duration(P).attr("x",ah?Pf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Oh&&(m=fj.select("."+f.ygrids).selectAll("."+f.ygrid).data(jg.ticks(Qh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",ah?jg:0).attr("x2",ah?jg:Pf).attr("y1",ah?0:jg).attr("y2",ah?Rf:jg),m.exit().remove()),A&&we(Ph)&&(n=fj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Ph),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",ah?"rotate(-90)":"").attr("dx",ah?0:-Mf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",ah?Ed:0).attr("x2",ah?Ed:Pf).attr("y1",ah?0:Ed).attr("y2",ah?Rf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",ah?0:Pf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=fj.select("."+f.regions).selectAll("rect."+f.region).data(li),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=fj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ii(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=fj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return ah?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),fj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1),fj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",aj).style("opacity",lj),q=fj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Sh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),q.exit().remove(),fj.each(function(){Gi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=wf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Gi=!1}),fj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),fj.select("."+f.chartArcsTitle).style("opacity",de(xf.data.targets)?1:0),Tg&&(null!==wf.event&&"zoom"===wf.event.type&&$i.extent(ig.orgDomain()).update(),B&&(!ah&&mh&&eb(e,O.axisSubX,mh),$i.empty()||$i.extent(ig.orgDomain()).update(),K=Ne(V,!0),u=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ii(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",bj).style("opacity",1))),fj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),fj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",ah?Ud:Td).attr("cy",ah?Td:Ud),v=fj.select("."+f.eventRects),we(tg)&&!oc(tg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Pf).attr("height",Rf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Bi&&!Ai?(z=function(a,b){var c=xc(b),d=yc(b),e=xf.data.xs[a.id][b];return(ig(d?d:e+50)-ig(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=xf.data.xs[a.id][b];return(ig(d)+ig(c?c:d-50))/2}):(z=L(),y=function(a){return ig(a.x)-z/2}),x=Ac(xf.data.targets),fj.select("."+f.eventRects).datum(x?x.values:[]),w=fj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",ah?0:y).attr("y",ah?y:0).attr("width",ah?Pf:z).attr("height",ah?z:Rf),w.exit().remove()),Cc(xf.data.targets).forEach(function(a){mj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===wf.event.sourceEvent.type&&cj.altDomain?(ig.domain(cj.altDomain),void cj.scale(ig).updateScaleExtent()):(Ai&&ig.orgDomain()[0]===kj[0]&&ig.domain([kj[0]-1e-10,ig.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===wf.event.sourceEvent.type&&(Ei=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){dj.attr("width",Tf).attr("height",Uf),dj.select("#"+ti).select("rect").attr("width",Pf).attr("height",Rf),dj.select("#"+ui).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),dj.select("#"+vi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj.select("."+f.zoomRect).attr("width",Pf).attr("height",Rf),jj.style("max-height",Uf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=fj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ii(a)}),e=fj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Kg(a)?"pointer":null}),c=fj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)}),b.append("path").attr("class",dd).style("opacity",function(){return lj=+wf.select(this).style("opacity"),0}).style("fill",function(a){return Ii(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ii(a)}).style("cursor",function(a){return Kg(a)?"pointer":null}),a.forEach(function(a){fj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=fj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(_f(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ii(a.data)}).style("cursor",function(a){return Kg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),mf(c.data.id),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,wf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Gi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),of(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Tg&&(n=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ii(a)}),l=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ii(a)})),dj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Lf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),xf.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=Si?j:i,l=Si?Q():P();return d&&(w=0,C=0,t=0,u=0),Wg&&!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=Si?u:t,void(_g?(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=hj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Si?(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=hj.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 Yg?Yg(a):xf.toggle(a)}).on("mouseover",function(a){wf.select(this).classed(f.legendItemFocused,!0),Gi||xf.focus(a),"function"==typeof Zg&&Zg(a)}).on("mouseout",function(a){wf.select(this).classed(f.legendItemFocused,!1),Gi||xf.revert(),"function"==typeof $g&&$g(a)}),o.append("text").text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Si?h:-200).attr("y",Si?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Si?i:-200).attr("y",Si?-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",function(a){return Ii(a)}).attr("x",Si?h:-200).attr("y",Si?-200:j).attr("width",10).attr("height",10),hj.selectAll("text").data(a).text(function(a){return d(wg[a])?wg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),hj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),hj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),hj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=wf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?jf(b):kf(b):Wi}),N(t),O(u),M(C),n(),R(),cf(),m(q,c)}function sf(a){return Ec(xf.data.targets,a.id)}function tf(a){return"data"in a&&Ec(xf.data.targets,a.data.id)}function uf(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 vf(a,b,c){var d=!ee(xf.data.targets);Gi=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var wf=a.d3?a.d3:a.require?a.require("d3"):void 0,xf={data:{},axis:{},legend:{}},yf={},zf=h(["bindto"],"#chart"),Af=h(["size","width"]),Bf=h(["size","height"]),Cf=h(["padding","left"],50),Df=h(["padding","right"]),Ef=h(["zoom","enabled"],!1),Ff=h(["zoom","extent"]),Gf=h(["zoom","privileged"],!1),Hf=h(["onenter"],function(){}),If=h(["onleave"],function(){}),Jf=h(["onresize"],function(){}),Kf=h(["onresized"],function(){}),Lf=h(["transition","duration"],350);g("data","data is required in config");var Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),tg=h(["data","xs"],{}),ug=h(["data","x_format"]),vg=h(["data","id_converter"],function(a){return a}),wg=h(["data","names"],{}),xg=h(["data","classes"],{}),yg=h(["data","groups"],[]),zg=h(["data","axes"],{}),Ag=h(["data","type"]),Bg=h(["data","types"],{}),Cg=h(["data","labels"],{}),Dg=h(["data","order"]),Eg=h(["data","regions"],{}),Fg=h(["data","color"]),Gg=h(["data","colors"],{}),Hg=h(["data","hide"],!1),Ig=h(["data","selection","enabled"],!1),Jg=h(["data","selection","grouped"],!1),Kg=h(["data","selection","isselectable"],function(){return!0}),Lg=h(["data","selection","multiple"],!0),Mg=h(["data","onclick"],function(){}),Ng=h(["data","onenter"],function(){}),Og=h(["data","onleave"],function(){}),Pg=h(["data","onselected"],function(){}),Qg=h(["data","onunselected"],function(){}),Rg=h(["data","ondragstart"],function(){}),Sg=h(["data","ondragend"],function(){}),Tg=h(["subchart","show"],!1),Ug=h(["subchart","size","height"],60),Vg=h(["color","pattern"],[]),Wg=h(["legend","show"],!0),Xg=h(["legend","position"],"bottom"),Yg=h(["legend","item","onclick"]),Zg=h(["legend","item","onmouseover"]),$g=h(["legend","item","onmouseout"]),_g=h(["legend","equally"],!1),ah=h(["axis","rotated"],!1),bh=h(["axis","x","show"],!0),ch=h(["axis","x","type"],"indexed"),dh=h(["axis","x","localtime"],!0),eh=h(["axis","x","categories"],[]),fh=h(["axis","x","tick","centered"],!1),gh=h(["axis","x","tick","format"]),hh=h(["axis","x","tick","culling"],{}),ih=h(["axis","x","tick","culling","max"],10),jh=h(["axis","x","tick","count"]),kh=h(["axis","x","tick","fit"],!0),lh=h(["axis","x","tick","values"],null),mh=h(["axis","x","tick","rotate"]),nh=h(["axis","x","max"],null),oh=h(["axis","x","min"],null),ph=h(["axis","x","padding"],{}),qh=h(["axis","x","height"]),rh=h(["axis","x","default"]),sh=h(["axis","x","label"],{}),th=h(["axis","y","show"],!0),uh=h(["axis","y","max"]),vh=h(["axis","y","min"]),wh=h(["axis","y","center"]),xh=h(["axis","y","label"],{}),yh=h(["axis","y","inner"],!1),zh=h(["axis","y","tick","format"]),Ah=h(["axis","y","padding"],{}),Bh=h(["axis","y","ticks"],10),Ch=h(["axis","y2","show"],!1),Dh=h(["axis","y2","max"]),Eh=h(["axis","y2","min"]),Fh=h(["axis","y2","center"]),Gh=h(["axis","y2","label"],{}),Hh=h(["axis","y2","inner"],!1),Ih=h(["axis","y2","tick","format"]),Jh=h(["axis","y2","padding"],{}),Kh=h(["axis","y2","ticks"],10),Lh=h(["grid","x","show"],!1),Mh=h(["grid","x","type"],"tick"),Nh=h(["grid","x","lines"],[]),Oh=h(["grid","y","show"],!1),Ph=h(["grid","y","lines"],[]),Qh=h(["grid","y","ticks"],10),Rh=h(["point","show"],!0),Sh=Rh?h(["point","r"],2.5):0,Th=h(["point","focus","line","enabled"],!0),Uh=h(["point","focus","expand","enabled"],!0),Vh=h(["point","focus","expand","r"],Uh?4:Sh),Wh=h(["point","focus","select","r"],8),Xh=h(["line","connect_null"],!1),Yh=h(["bar","width"]),Zh=h(["bar","width","ratio"],.6),$h=h(["pie","label","show"],!0),_h=h(["pie","label","format"]),ai=h(["pie","expand"],!0),bi=h(["pie","onclick"],function(){}),ci=h(["pie","onmouseover"],function(){}),di=h(["pie","onmouseout"],function(){}),ei=h(["donut","label","show"],!0),fi=h(["donut","label","format"]),gi=h(["donut","expand"],!0),hi=h(["donut","title"],""),ii=h(["donut","onclick"],function(){}),ji=h(["donut","onmouseover"],function(){}),ki=h(["donut","onmouseout"],function(){}),li=h(["regions"],[]),mi=h(["tooltip","show"],!0),ni=h(["tooltip","format","title"]),oi=h(["tooltip","format","value"]),pi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ni?ni:b,l=oi?oi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),qi=h(["tooltip","init","show"],!1),ri=h(["tooltip","init","x"],0),si=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ti=("string"==typeof zf?zf.replace("#",""):zf.id)+"-clip",ui=ti+"-xaxis",vi=ti+"-yaxis",wi=i(ti),xi=i(ui),yi=i(vi),zi="timeseries"===ch,Ai="categorized"===ch,Bi=!zi&&(sg||we(tg)),Ci=null,Di=!1,Ei=!1,Fi=!1,Gi=!1,Hi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ii=qe(Gg,we(Vg)?Vg:Hi,Fg),Ji=dh?wf.time.format:wf.time.format.utc,Ki=function(){var a=[[Ji("%Y/%-m/%-d"),function(){return!0}],[Ji("%-m/%-d"),function(a){return a.getMonth()}],[Ji("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ji("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ji("%I %p"),function(a){return a.getHours()}],[Ji("%I:%M"),function(a){return a.getMinutes()}],[Ji(":%S"),function(a){return a.getSeconds()}],[Ji(".%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)}}(),Li=[],Mi=[],Ni=ah?"left":"bottom",Oi=ah?yh?"top":"bottom":yh?"right":"left",Pi=ah?Hh?"bottom":"top":Hh?"left":"right",Qi=ah?"left":"bottom",Ri={main:function(){return"translate("+Mf.left+","+Mf.top+")"},context:function(){return"translate("+Nf.left+","+Nf.top+")"},legend:function(){return"translate("+Of.left+","+Of.top+")"},x:function(){return"translate(0,"+(ah?0:Rf)+")"},y:function(){return"translate(0,"+(ah?Rf:0)+")"},y2:function(){return"translate("+(ah?0:Pf)+","+(ah?1:0)+")"},subx:function(){return"translate(0,"+(ah?0:Sf)+")"},arc:function(){return"translate("+Pf/2+","+Rf/2+")"}},Si="right"===Xg,Ti=0,Ui=0,Vi=0,Wi=.15,Xi=30,Yi=ah&&!bh?0:30,Zi=5;_f=wf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var $i,_i=function(){var a=wf.svg.line().x(ah?function(a){return V(a.id)(a.value)}:Cd).y(ah?Cd:function(a){return V(a.id)(a.value)});return Xh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Xh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Eg[b.id]?Se(e,ig,V(b.id),Eg[b.id]):a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),aj=function(){var a;return a=ah?wf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):wf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?ig(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,ah?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a=wf.svg.line().x(ah?function(a){return W(a.id)(a.value)}:Fd).y(ah?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+lg(c[0].x)+" "+W(b.id)(c[0].value)}}(),cj=function(){};$i=wf.svg.brush().on("brush",_e),$i.update=function(){return gj&&gj.select("."+f.brush).call(this),this},$i.scale=function(a){return ah?this.y(a):this.x(a)},Ef&&(cj=wf.behavior.zoom().on("zoomstart",function(){cj.altDomain=wf.event.sourceEvent.altKey?ig.orgDomain():null}).on("zoom",Ef?af:null),cj.scale=function(a){return ah?this.y(a):this.x(a)},cj.orgScaleExtent=function(){var a=Ff?Ff:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},cj.updateScaleExtent=function(){var a=ac(ig.orgDomain())/ac(kj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var dj,ej,fj,gj,hj,ij,jj,kj,lj,mj={};if(xf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),xf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(xf.data.targets)&&Nb(a,!0),mf(a)},xf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);xf.revert(),b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),nf(a)},xf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=dj.selectAll(md(a)),d=c.filter(sf),e=c.filter(tf);b(d.classed(f.focused,!1)),b(e),ee(xf.data.targets)&&Ob(a),of()},xf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),dj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&pf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),dj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&qf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},xf.toggle=function(a){Gc(a)?xf.hide(a):xf.show(a)},xf.unzoom=function(){$i.clear().update(),$e({withUpdateXDomain:!0})},xf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){xg[b]=a.classes[b]}),"categories"in a&&Ai&&(eh=a.categories,og.categories(eh)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},xf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},xf.selected=function(a){return wf.merge(fj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return wf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},xf.select=function(a,b,c){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=wf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Jg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Kg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},xf.unselect=function(a,b){Ig&&fj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=wf.select(this),g="circle"===this.nodeName?Be:Ee,h=Jg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Kg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},xf.toLine=function(a){vf(a,"line")},xf.toSpline=function(a){vf(a,"spline")},xf.toBar=function(a){vf(a,"bar")},xf.toScatter=function(a){vf(a,"scatter")},xf.toArea=function(a){vf(a,"area")},xf.toAreaSpline=function(a){vf(a,"area-spline") -},xf.toPie=function(a){vf(a,"pie",{withTransform:!0})},xf.toDonut=function(a){vf(a,"donut",{withTransform:!0})},xf.groups=function(a){return c(a)?yg:(yg=a,$e(),yg)},xf.xgrids=function(a){return a?(Nh=a,$e(),Nh):Nh},xf.xgrids.add=function(a){return a?xf.xgrids(Nh.concat(a)):void 0},xf.xgrids.remove=function(a){var b=uf(a);return xf.xgrids(Nh.filter(b))},xf.ygrids=function(a){return a?(Ph=a,$e(),Ph):Ph},xf.ygrids.add=function(a){return a?xf.ygrids(Ph.concat(a)):void 0},xf.ygrids.remove=function(a){var b=uf(a);return xf.ygrids(Ph.filter(b))},xf.regions=function(a){return c(a)?li:(li=a,$e(),li)},xf.regions.add=function(a){return c(a)?li:(li=li.concat(a),$e(),li)},xf.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;dj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),li=li.filter(function(b){return b.classes.indexOf(a)<0})}),li},xf.data.get=function(a){var b=xf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},xf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},xf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){wg[b]=a[b]}),rf(Cc(xf.data.targets),{withTransition:!0}),wg):wg},xf.x=function(a){return arguments.length&&(qc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.xs=function(a){return arguments.length&&(rc(xf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),xf.data.xs},xf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},xf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(uh=+a.y),b(a.y2)&&(Dh=+a.y2)):uh=Dh=+a,$e())},xf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,$e())},xf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&xf.axis.max(a.max),"undefined"!=typeof a.min&&xf.axis.min(a.min))},xf.legend.show=function(a){pf(Dc(a)),$e({withLegend:!0})},xf.legend.hide=function(a){qf(Dc(a)),$e({withLegend:!0})},xf.resize=function(a){Af=a?a.width:null,Bf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},xf.destroy=function(){xf.data.targets=void 0,xf.data.xs={},jj.html(""),a.onresize=null},"url"in e.data)wf.xhr(e.data.url,function(a,b){var c,d=wf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=wf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return xf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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;cNf&&(Nf=0),0>Pf&&(Pf=0),Of=$g?Kf.left-Vi-Wi:Nf,Qf=$g?Pf:Sf-Lf.top-Lf.bottom,0>Of&&(Of=0),0>Qf&&(Qf=0),p(),Qi&&ee(vf.data.targets)&&(Mf.left=Nf/2+Uf)}function o(){dj.select("line."+f.xgridFocus).attr("x1",$g?0:-10).attr("x2",$g?Nf:-10).attr("y1",$g?-10:Kf.top).attr("y2",$g?-10:Pf)}function p(){Uf=Pf/2,Tf=.95*Uf,Vf=de(vf.data.targets)?.6*Tf:0}function q(){var a=$g?f.axisX:f.axisY,b=dj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=uf.select(xf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return yf?yf:x()}function s(){var a=zf?zf:y();return a>0?a:320}function t(){return ee(vf.data.targets)?0:Af?Af:$g?_g?v("x"):1:!rh||wh?1:v("y")}function u(){var a=1;return ee(vf.data.targets)?0:Bf?Bf:Qi?P()+(Ah&&!$g?v("y2"):a):Ah?Fh||$g?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||_g?"x"===a&&oh?oh:"y"!==a||rh?"y2"!==a||Ah?(jb(a).isInner?30:40)+("y2"===a?-10:0):Xi:Ug&&!Qi?10:1:0}function x(){return+uf.select(xf).style("width").replace("px","")}function y(){return+uf.select(xf).style("height").replace("px","")}function z(a){return a?-5:-(Kf.left-1)}function A(a){return a?-20:-4}function B(){return z(!$g)}function C(){return A(!$g)}function D(){return z($g)}function E(){return A($g)}function F(a){return a?Nf+2+4:Kf.left+20}function G(a){return a?(oh?oh:0)+80:Pf+8}function H(){return F(!$g)}function I(){return G(!$g)}function J(){return F($g)}function K(){return G($g)}function L(){var a,b,c,d,e,f=Ac(vf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=gg(b.x)-gg(a.x),d=zc(),e=ae(vf.data.targets)?(d-(yi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ri=a}function N(a){Si=a}function O(a){Ti=a}function P(){return Ug?Qi?Si*(Ri+1):Rf:0}function Q(){return Ug?Qi?Sf:Ti*(Ri+1):0}function R(){var a,b,c=!gg;$f=$g?1:0,_f=$g?Pf:Nf,ag=$g?0:Pf,bg=$g?Nf:1,cg=$f,dg=_f,eg=$g?0:Qf,fg=$g?Of:1,gg=T($f,_f,c?void 0:gg.domain(),function(){return mg.tickOffset()}),hg=U(ag,bg,c?void 0:hg.domain()),ig=U(ag,bg,c?void 0:ig.domain()),jg=T($f,_f,ij,function(a){return a%1?0:pg.tickOffset()}),kg=U(eg,fg,c?void 0:kg.domain()),lg=U(eg,fg,c?void 0:lg.domain()),a=$(),b=jh?jh:c?void 0:mg.tickValues(),mg=X(gg,Li,a,b),pg=X(jg,Oi,a,b),ng=Y(hg,Mi,xh,zh),og=Y(ig,Ni,Gh,Ih),c||(Yi.scale(jg),Cf&&aj.scale(gg)),S()}function S(){Wf=Gb(),Xf=Hb(),Yf=Hb(.98)}function T(a,b,d,e){var f=(xi?uf.time.scale():uf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),yi){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=uf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?ig:hg}function W(a){return"y2"===Z(a)?lg:kg}function X(a,b,c,d){var e=(yi?Eb():uf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),yi?(e.tickCentered(dh),ve(fh)&&(fh=!1)):e.tickOffset=function(){var a=Bc(vf.data.targets),b=gg(a[1])-gg(a[0]);return b/zc()/2},yi&&e.categories(ch),e}function Y(a,b,c,d){return uf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in xg?xg[a]:"y"}function $(){var a=xi?Ii:yi?Tc:function(a){return 0>a?a.toFixed(0):a};return eh&&("function"==typeof eh?a=eh:xi&&(a=function(a){return a?Hi(eh)(a):""})),a}function _(a){var b;return"y"===a?b=vh:"y2"===a?b=Eh:"x"===a&&(b=qh),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?vh=b:"y2"===a?Eh=b:"x"===a&&(qh=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",$g?"inner-top":"inner-right")}function hb(){return fb("y",$g?"inner-right":"inner-top")}function ib(){return fb("y2",$g?"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?Nf/2:Nf:b.isBottom?-Pf:b.isMiddle?-Pf/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(!$g,gb())}function rb(){return nb($g,hb())}function sb(){return nb($g,ib())}function tb(){return ob(!$g,gb())}function ub(){return ob($g,hb())}function vb(){return ob($g,ib())}function wb(){var a=gb();return $g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":oh?oh-10:"3em"}function xb(){var a=hb();return $g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return $g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!$g,gb())}function Ab(){return pb($g,hb())}function Bb(){return pb($g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return uf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){dj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),dj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),dj.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 uf.min(Object.keys(i).map(function(a){return uf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(wg.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 uf.max(Object.keys(i).map(function(a){return uf.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?Ch:th,n="y2"===c?Bh:sh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Dh:uh,r=ud()&&$g;return 0===l.length?"y2"===c?ig.domain():hg.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=vd(o,p),j=ac(hg.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&&yh&&(f=b(yh.top)?yh.top:e,g=b(yh.bottom)?yh.bottom:e),"y2"===c&&Hh&&(f=b(Hh.top)?Hh.top:e,g=b(Hh.bottom)?Hh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return mh?xi?re(mh):mh:uf.min(a,function(a){return uf.min(a.values,function(a){return a.x})})}function Zb(a){return lh?xi?re(lh):lh:uf.max(a,function(a){return uf.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 yi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof nh&&we(nh)?(e=b(nh.left)?nh.left:d,f=b(nh.right)?nh.right:d):e=f="number"==typeof nh?nh: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||0===c)&&(f=xi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=xi?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?hg:ig;return b="y"===a.axis||"y2"===a.axis?$g?Pf:"start"in a?d(a.start):Pf:$g?"end"in a?gg(xi?re(a.end):a.end):Pf:Pf,c>b?0:b-c}function ic(a){return qg&&a===qg||we(rg)&&xe(rg,a)}function jc(a){return!ic(a)}function kc(a){return qg?qg:we(rg)?rg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=vf.data.xs[b])}),c}function mc(a,b){return a in vf.data.xs&&vf.data.xs[a]&&vf.data.xs[a][b]?vf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){rg[b]=a[b]})}function oc(a){return 1===uf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=ug[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)}),vf.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=xi?a?a instanceof Date?a:re(a):re(mc(c,d)):zi&&!yi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?vf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):qg?(d=Object.keys(vf.data.xs),vf.data.xs[c]=d.length>0?vf.data.xs[d[0]]:void 0):we(rg)&&(vf.data.xs[c]=lc(f,vf.data.targets)):vf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!vf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=tg(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 zi&&yi&&0===c&&g&&(0===e&&(ch=[]),ch.push(g)),("undefined"==typeof a[b]||vf.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++})}),yg&&$d(Cc(c).filter(function(a){return!(a in zg)}),yg),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&&vf.data.targets[0].values[a-1]?vf.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(vf.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(xi?new Date(i):i);j.push(e)}return xi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ji=Ji.concat(a)}function Mc(a){Ji=Ji.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ki=Ki.concat(a)}function Oc(a){Ki=Ki.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return uf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Bg&&"desc"===Bg.toLowerCase()}function Nd(){return Bg&&"asc"===Bg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Bg&&a.sort(Bg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(vf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ki&&(gj.html(ni(a,$(),wd(k),Gi)).style("display","block"),d=gj.property("offsetWidth"),e=gj.property("offsetHeight"),k?(g=Nf/2+c[0],i=Pf/2+c[1]+20):($g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=gg(l[0].x)+20):(f=q(),g=f+t()+gg(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)),gj.style("top",i+"px").style("left",g+"px"))}function Qd(){gj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ki&&(be(vf.data.targets)||ee(vf.data.targets)||dj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr($g?"y1":"x1",Cd).attr($g?"y2":"x2",Cd))}function Sd(){dj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?gg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Wh?Wh:b?2*a.tickOffset()*Xh/b:0}function $d(a,b){Dc(a).forEach(function(a){kj[a]=b===zg[a],zg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){zg[a.id]===b&&(c=!0),a.id in zg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in zg)||"line"===zg[b]||"spline"===zg[b]||"area"===zg[b]||"area-spline"===zg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===zg[b]||"area-spline"===zg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===zg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===zg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===zg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===zg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&ei||je(a)&&$h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=sg?uf.time.format(sg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+sg)}return c}function se(a,b){var c=uf.mouse(a),d=uf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?hg:ig,d=$g?1:0,e=$g?0:1;return Math.pow(gg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Ng(b,a.node()),dj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",$g?Ud:Td).attr("cy",$g?Td:Ud).attr("stroke",function(){return Gi(b)}).attr("r",1.4*Uh).transition().duration(100).attr("r",Uh)}function Be(a,b,c){Og(b,a.node()),dj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Ng(b,a.node()),a.transition().duration(100).style("fill",function(){return uf.rgb(Gi(b)).darker(1)})}function Ee(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return Gi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?dj.selectAll("."+f.circles+ld(c)):dj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Th)}function Je(a){He(a).filter(function(){return uf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Qh)}function Ke(a){return dj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=$g?1:0,f=$g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return $g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return $g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(mg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 $g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(hj=uf.select(xf),hj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(hj.html("").classed("c3",!0),vf.data.xs={},vf.data.targets=vc(b),Fg&&Lc(Fg===!0?Cc(vf.data.targets):Fg),n(),R(),gg.domain(uf.extent(_b(vf.data.targets))),hg.domain(Xb(vf.data.targets,"y")),ig.domain(Xb(vf.data.targets,"y2")),jg.domain(gg.domain()),kg.domain(hg.domain()),lg.domain(ig.domain()),ij=gg.domain(),Yi.scale(jg),Cf&&aj.scale(gg),bj=hj.append("svg").attr("width",Nf+Kf.left+Kf.right).attr("height",Pf+Kf.top+Kf.bottom).on("mouseenter",Ff).on("mouseleave",Gf),cj=bj.append("defs"),cj.append("clipPath").attr("id",ri).append("rect").attr("width",Nf).attr("height",Pf),cj.append("clipPath").attr("id",si).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.append("clipPath").attr("id",ti).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj=bj.append("g").attr("transform",Pi.main),ej=bj.append("g").attr("transform",Pi.context),fj=bj.append("g").attr("transform",Pi.legend),Rg||ej.style("visibility","hidden"),Ug||(fj.style("visibility","hidden"),Ki=Cc(vf.data.targets)),gj=uf.select(xf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),pf(Cc(vf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),_g&&dj.append("g").attr("class",f.axisX).attr("clip-path",vi).attr("transform",Pi.x).append("text").attr("class",f.axisXLabel).attr("transform",$g?"rotate(-90)":"").style("text-anchor",zb),rh&&dj.append("g").attr("class",f.axisY).attr("clip-path",wi).attr("transform",Pi.y).append("text").attr("class",f.axisYLabel).attr("transform",$g?"":"rotate(-90)").style("text-anchor",Ab),Ah&&dj.append("g").attr("class",f.axisY2).attr("transform",Pi.y2).append("text").attr("class",f.axisY2Label).attr("transform",$g?"":"rotate(-90)").style("text-anchor",Bb),d=dj.append("g").attr("clip-path",ui).attr("class",f.grid),Jh&&d.append("g").attr("class",f.xgrids),we(Lh)&&d.append("g").attr("class",f.xgridLines),Rh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Mh&&d.append("g").attr("class",f.ygrids),we(Nh)&&d.append("g").attr("class",f.ygridLines),dj.append("g").attr("clip-path",ui).attr("class",f.regions),dj.append("g").attr("clip-path",ui).attr("class",f.chart),c=dj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Cf?$g?"ns-resize":"ew-resize":null),dj.select("."+f.chart).append("g").attr("class",f.chartBars),dj.select("."+f.chart).append("g").attr("class",f.chartLines),dj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Pi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),dj.select("."+f.chart).append("g").attr("class",f.chartTexts),Cf&&dj.insert("rect",Ef?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Nf).attr("height",Pf).style("opacity",0).style("cursor",$g?"ns-resize":"ew-resize").call(aj).on("dblclick.zoom",null),ph&&Yi.extent("function"!=typeof ph?ph:ph(_b())),ej.append("g").attr("clip-path",ui).attr("class",f.chart),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.append("g").attr("clip-path",ui).attr("class",f.brush).call(Yi).selectAll("rect").attr($g?"width":"height",$g?Of:Qf),ej.append("g").attr("class",f.axisX).attr("transform",Pi.subx).attr("clip-path",$g?"":vi),ef(vf.data.targets),$g?dj.select("."+f.axisX).style("opacity",0).call(mg):(dj.select("."+f.axisY).style("opacity",0).call(ng),dj.select("."+f.axisY2).style("opacity",0).call(og)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),oi){if(xi&&"string"==typeof pi){for(pi=re(pi),e=0;e0){d=[];for(var g in ug)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(vf.data.targets)||Gg&&(Ai=a,dj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Bi=!0,Pg())}function Ze(){ee(vf.data.targets)||Gg&&(dj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),dj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Bi=!1,Qg())}function $e(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=Vd(),W=ee(vf.data.targets),X=Ic(vf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Jf:0,Q=D?P:0,R=E?P:0,c=dj.select("."+f.axisX).style("opacity",W?0:1),g=dj.select("."+f.axisY).style("opacity",W?0:1),h=dj.select("."+f.axisY2).style("opacity",W?0:1),e=ej.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Ug&&pf(Cc(vf.data.targets),a,O),yi&&(0!==X.length&&H&&G||gg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(gg.domain(uf.extent(_b(X))),ij=gg.domain(),Cf&&aj.scale(gg).updateScaleExtent(),jg.domain(gg.domain()),Yi.scale(jg)),G&&(gg.domain(Yi.empty()?ij:Yi.extent()),Cf&&aj.scale(gg).updateScaleExtent()),jh||!ih&&!hh||(S=Kc(Jc(X),hh),mg.tickValues(S),pg.tickValues(S))),hg.domain(Xb(X,"y")),ig.domain(Xb(X,"y2")),O.axisX.call(mg),O.axisY.call(ng),O.axisY2.call(og),O.axisSubX.call(pg),G&&X.length)if(fh&&S){for(T=1;T=0&&uf.select(this).style("display",b%U?"none":"block")})}else uf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!$g&&kh&&eb(c,O.axisX,kh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),kg.domain(hg.domain()),lg.domain(ig.domain()),gj.style("display","none"),o(),dj.select("line."+f.xgridFocus).style("visibility","hidden"),Jh){if("year"===Kh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=gg.ticks(10);i=dj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",$g?0:function(a){return gg(a)-mg.tickOffset()}).attr("x2",$g?Nf:function(a){return gg(a)-mg.tickOffset()}).attr("y1",$g?function(a){return gg(a)-mg.tickOffset()}:Kf.top).attr("y2",$g?function(a){return gg(a)-mg.tickOffset()}:Pf).style("opacity",function(){return+uf.select(this).attr($g?"y1":"x1")===($g?Pf:0)?0:1}),i.exit().remove()}we(Lh)&&(k=dj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Lh),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",$g?"":"rotate(-90)").attr("dx",$g?0:-Kf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",$g?0:Dd).attr("x2",$g?Nf:Dd).attr("y1",$g?Dd:Kf.top).attr("y2",$g?Dd:Pf).style("opacity",1),k.select("text").transition().duration(P).attr("x",$g?Nf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Mh&&(m=dj.select("."+f.ygrids).selectAll("."+f.ygrid).data(hg.ticks(Oh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",$g?hg:0).attr("x2",$g?hg:Nf).attr("y1",$g?0:hg).attr("y2",$g?Pf:hg),m.exit().remove()),A&&we(Nh)&&(n=dj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Nh),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",$g?"rotate(-90)":"").attr("dx",$g?0:-Kf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",$g?Ed:0).attr("x2",$g?Ed:Nf).attr("y1",$g?0:Ed).attr("y2",$g?Pf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",$g?0:Nf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=dj.select("."+f.regions).selectAll("rect."+f.region).data(ji),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=dj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Gi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=dj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return $g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),dj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Zi).style("opacity",1),dj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",$i).style("opacity",jj),q=dj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Qh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",$g?Ud:Td).attr("cy",$g?Td:Ud),q.exit().remove(),dj.each(function(){Ei=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=uf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Ei=!1}),dj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),dj.select("."+f.chartArcsTitle).style("opacity",de(vf.data.targets)?1:0),Rg&&(null!==uf.event&&"zoom"===uf.event.type&&Yi.extent(gg.orgDomain()).update(),B&&(!$g&&kh&&eb(e,O.axisSubX,kh),Yi.empty()||Yi.extent(gg.orgDomain()).update(),K=Ne(V,!0),u=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Gi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1))),dj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),dj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",$g?Ud:Td).attr("cy",$g?Td:Ud),v=dj.select("."+f.eventRects),we(rg)&&!oc(rg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=dj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Nf).attr("height",Pf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),zi&&!yi?(z=function(a,b){var c=xc(b),d=yc(b),e=vf.data.xs[a.id][b];return(gg(d?d:e+50)-gg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=vf.data.xs[a.id][b];return(gg(d)+gg(c?c:d-50))/2}):(z=L(),y=function(a){return gg(a.x)-z/2}),x=Ac(vf.data.targets),dj.select("."+f.eventRects).datum(x?x.values:[]),w=dj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",$g?0:y).attr("y",$g?y:0).attr("width",$g?Nf:z).attr("height",$g?z:Pf),w.exit().remove()),Cc(vf.data.targets).forEach(function(a){kj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===uf.event.sourceEvent.type&&aj.altDomain?(gg.domain(aj.altDomain),void aj.scale(gg).updateScaleExtent()):(yi&&gg.orgDomain()[0]===ij[0]&&gg.domain([ij[0]-1e-10,gg.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===uf.event.sourceEvent.type&&(Ci=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){bj.attr("width",Rf).attr("height",Sf),bj.select("#"+ri).select("rect").attr("width",Nf).attr("height",Pf),bj.select("#"+si).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),bj.select("#"+ti).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),bj.select("."+f.zoomRect).attr("width",Nf).attr("height",Pf),hj.style("max-height",Sf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=dj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Gi(a)}),e=dj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Ig(a)?"pointer":null}),c=dj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Gi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return jj=+uf.select(this).style("opacity"),0}).style("fill",function(a){return Gi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Gi(a)}).style("cursor",function(a){return Ig(a)?"pointer":null}),a.forEach(function(a){dj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=dj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Zf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Gi(a.data)}).style("cursor",function(a){return Ig(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ei||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),lf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,uf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ei||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),mf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Rg&&(n=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Gi(a)}),l=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Gi(a)})),bj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Jf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),vf.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=Qi?j:i,l=Qi?Q():P();return d&&(w=0,C=0,t=0,u=0),Ug&&!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=Qi?u:t,void(Zg?(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=fj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Qi?(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=fj.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 Wg?Wg(a):vf.toggle(a)}).on("mouseover",function(a){uf.select(this).classed(f.legendItemFocused,!0),Ei||vf.focus(a),"function"==typeof Xg&&Xg(a)}).on("mouseout",function(a){uf.select(this).classed(f.legendItemFocused,!1),Ei||vf.revert(),"function"==typeof Yg&&Yg(a)}),o.append("text").text(function(a){return d(ug[a])?ug[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Qi?h:-200).attr("y",Qi?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Qi?i:-200).attr("y",Qi?-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",function(a){return Gi(a)}).attr("x",Qi?h:-200).attr("y",Qi?-200:j).attr("width",10).attr("height",10),fj.selectAll("text").data(a).text(function(a){return d(ug[a])?ug[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),fj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),fj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),fj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=uf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?jf(b):kf(b):Ui}),N(t),O(u),M(C),n(),R(),cf(),m(q,c)}function qf(a){return Ec(vf.data.targets,a.id)}function rf(a){return"data"in a&&Ec(vf.data.targets,a.data.id)}function sf(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 tf(a,b,c){var d=!ee(vf.data.targets);Ei=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var uf=a.d3?a.d3:a.require?a.require("d3"):void 0,vf={data:{},axis:{},legend:{}},wf={},xf=h(["bindto"],"#chart"),yf=h(["size","width"]),zf=h(["size","height"]),Af=h(["padding","left"],50),Bf=h(["padding","right"]),Cf=h(["zoom","enabled"],!1),Df=h(["zoom","extent"]),Ef=h(["zoom","privileged"],!1),Ff=h(["onenter"],function(){}),Gf=h(["onleave"],function(){}),Hf=h(["onresize"],function(){}),If=h(["onresized"],function(){}),Jf=h(["transition","duration"],350);g("data","data is required in config");var Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),rg=h(["data","xs"],{}),sg=h(["data","x_format"]),tg=h(["data","id_converter"],function(a){return a}),ug=h(["data","names"],{}),vg=h(["data","classes"],{}),wg=h(["data","groups"],[]),xg=h(["data","axes"],{}),yg=h(["data","type"]),zg=h(["data","types"],{}),Ag=h(["data","labels"],{}),Bg=h(["data","order"]),Cg=h(["data","regions"],{}),Dg=h(["data","color"]),Eg=h(["data","colors"],{}),Fg=h(["data","hide"],!1),Gg=h(["data","selection","enabled"],!1),Hg=h(["data","selection","grouped"],!1),Ig=h(["data","selection","isselectable"],function(){return!0}),Jg=h(["data","selection","multiple"],!0),Kg=h(["data","onclick"],function(){}),Lg=h(["data","onenter"],function(){}),Mg=h(["data","onleave"],function(){}),Ng=h(["data","onselected"],function(){}),Og=h(["data","onunselected"],function(){}),Pg=h(["data","ondragstart"],function(){}),Qg=h(["data","ondragend"],function(){}),Rg=h(["subchart","show"],!1),Sg=h(["subchart","size","height"],60),Tg=h(["color","pattern"],[]),Ug=h(["legend","show"],!0),Vg=h(["legend","position"],"bottom"),Wg=h(["legend","item","onclick"]),Xg=h(["legend","item","onmouseover"]),Yg=h(["legend","item","onmouseout"]),Zg=h(["legend","equally"],!1),$g=h(["axis","rotated"],!1),_g=h(["axis","x","show"],!0),ah=h(["axis","x","type"],"indexed"),bh=h(["axis","x","localtime"],!0),ch=h(["axis","x","categories"],[]),dh=h(["axis","x","tick","centered"],!1),eh=h(["axis","x","tick","format"]),fh=h(["axis","x","tick","culling"],{}),gh=h(["axis","x","tick","culling","max"],10),hh=h(["axis","x","tick","count"]),ih=h(["axis","x","tick","fit"],!0),jh=h(["axis","x","tick","values"],null),kh=h(["axis","x","tick","rotate"]),lh=h(["axis","x","max"],null),mh=h(["axis","x","min"],null),nh=h(["axis","x","padding"],{}),oh=h(["axis","x","height"]),ph=h(["axis","x","default"]),qh=h(["axis","x","label"],{}),rh=h(["axis","y","show"],!0),sh=h(["axis","y","max"]),th=h(["axis","y","min"]),uh=h(["axis","y","center"]),vh=h(["axis","y","label"],{}),wh=h(["axis","y","inner"],!1),xh=h(["axis","y","tick","format"]),yh=h(["axis","y","padding"],{}),zh=h(["axis","y","ticks"],10),Ah=h(["axis","y2","show"],!1),Bh=h(["axis","y2","max"]),Ch=h(["axis","y2","min"]),Dh=h(["axis","y2","center"]),Eh=h(["axis","y2","label"],{}),Fh=h(["axis","y2","inner"],!1),Gh=h(["axis","y2","tick","format"]),Hh=h(["axis","y2","padding"],{}),Ih=h(["axis","y2","ticks"],10),Jh=h(["grid","x","show"],!1),Kh=h(["grid","x","type"],"tick"),Lh=h(["grid","x","lines"],[]),Mh=h(["grid","y","show"],!1),Nh=h(["grid","y","lines"],[]),Oh=h(["grid","y","ticks"],10),Ph=h(["point","show"],!0),Qh=Ph?h(["point","r"],2.5):0,Rh=h(["point","focus","line","enabled"],!0),Sh=h(["point","focus","expand","enabled"],!0),Th=h(["point","focus","expand","r"],Sh?4:Qh),Uh=h(["point","focus","select","r"],8),Vh=h(["line","connect_null"],!1),Wh=h(["bar","width"]),Xh=h(["bar","width","ratio"],.6),Yh=h(["pie","label","show"],!0),Zh=h(["pie","label","format"]),$h=h(["pie","expand"],!0),_h=h(["pie","onclick"],function(){}),ai=h(["pie","onmouseover"],function(){}),bi=h(["pie","onmouseout"],function(){}),ci=h(["donut","label","show"],!0),di=h(["donut","label","format"]),ei=h(["donut","expand"],!0),fi=h(["donut","title"],""),gi=h(["donut","onclick"],function(){}),hi=h(["donut","onmouseover"],function(){}),ii=h(["donut","onmouseout"],function(){}),ji=h(["regions"],[]),ki=h(["tooltip","show"],!0),li=h(["tooltip","format","title"]),mi=h(["tooltip","format","value"]),ni=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=li?li:b,l=mi?mi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),oi=h(["tooltip","init","show"],!1),pi=h(["tooltip","init","x"],0),qi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ri=("string"==typeof xf?xf.replace("#",""):xf.id)+"-clip",si=ri+"-xaxis",ti=ri+"-yaxis",ui=i(ri),vi=i(si),wi=i(ti),xi="timeseries"===ah,yi="categorized"===ah,zi=!xi&&(qg||we(rg)),Ai=null,Bi=!1,Ci=!1,Di=!1,Ei=!1,Fi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Gi=qe(Eg,we(Tg)?Tg:Fi,Dg),Hi=bh?uf.time.format:uf.time.format.utc,Ii=function(){var a=[[Hi("%Y/%-m/%-d"),function(){return!0}],[Hi("%-m/%-d"),function(a){return a.getMonth()}],[Hi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Hi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Hi("%I %p"),function(a){return a.getHours()}],[Hi("%I:%M"),function(a){return a.getMinutes()}],[Hi(":%S"),function(a){return a.getSeconds()}],[Hi(".%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)}}(),Ji=[],Ki=[],Li=$g?"left":"bottom",Mi=$g?wh?"top":"bottom":wh?"right":"left",Ni=$g?Fh?"bottom":"top":Fh?"left":"right",Oi=$g?"left":"bottom",Pi={main:function(){return"translate("+Kf.left+","+Kf.top+")"},context:function(){return"translate("+Lf.left+","+Lf.top+")"},legend:function(){return"translate("+Mf.left+","+Mf.top+")"},x:function(){return"translate(0,"+($g?0:Pf)+")"},y:function(){return"translate(0,"+($g?Pf:0)+")"},y2:function(){return"translate("+($g?0:Nf)+","+($g?1:0)+")"},subx:function(){return"translate(0,"+($g?0:Qf)+")"},arc:function(){return"translate("+Nf/2+","+Pf/2+")"}},Qi="right"===Vg,Ri=0,Si=0,Ti=0,Ui=.15,Vi=30,Wi=$g&&!_g?0:30,Xi=5;Zf=uf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Yi,Zi=function(){var a=uf.svg.line().x($g?function(a){return V(a.id)(a.value)}:Cd).y($g?Cd:function(a){return V(a.id)(a.value)});return Vh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Vh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Cg[b.id]?Se(e,gg,V(b.id),Cg[b.id]):a(e)):(c=e[0]?gg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,$g?"M "+d+" "+c:"M "+c+" "+d)}}(),$i=function(){var a;return a=$g?uf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):uf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?gg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,$g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a=uf.svg.line().x($g?function(a){return W(a.id)(a.value)}:Fd).y($g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+jg(c[0].x)+" "+W(b.id)(c[0].value)}}(),aj=function(){};Yi=uf.svg.brush().on("brush",_e),Yi.update=function(){return ej&&ej.select("."+f.brush).call(this),this},Yi.scale=function(a){return $g?this.y(a):this.x(a)},Cf&&(aj=uf.behavior.zoom().on("zoomstart",function(){aj.altDomain=uf.event.sourceEvent.altKey?gg.orgDomain():null}).on("zoom",Cf?af:null),aj.scale=function(a){return $g?this.y(a):this.x(a)},aj.orgScaleExtent=function(){var a=Df?Df:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},aj.updateScaleExtent=function(){var a=ac(gg.orgDomain())/ac(ij),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var bj,cj,dj,ej,fj,gj,hj,ij,jj,kj={};if(vf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=bj.selectAll(md(a)),d=c.filter(qf),e=c.filter(rf);vf.revert(),vf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(vf.data.targets)&&Nb(a,!0),lf(a,!0)},vf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=bj.selectAll(md(a)),d=c.filter(qf),e=c.filter(rf);vf.revert(),b(d.classed(f.focused,!1)),b(e),ee(vf.data.targets)&&Ob(a),lf(a,!1)},vf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=bj.selectAll(md(a)),d=c.filter(qf),e=c.filter(rf);b(d.classed(f.focused,!1)),b(e),ee(vf.data.targets)&&Ob(a),mf()},vf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),bj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&nf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},vf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),bj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&of(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},vf.toggle=function(a){Gc(a)?vf.hide(a):vf.show(a)},vf.unzoom=function(){Yi.clear().update(),$e({withUpdateXDomain:!0})},vf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){vg[b]=a.classes[b]}),"categories"in a&&yi&&(ch=a.categories,mg.categories(ch)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},vf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},vf.selected=function(a){return uf.merge(dj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return uf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},vf.select=function(a,b,c){Gg&&dj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=uf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Hg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ig(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},vf.unselect=function(a,b){Gg&&dj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=uf.select(this),g="circle"===this.nodeName?Be:Ee,h=Hg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ig(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},vf.toLine=function(a){tf(a,"line")},vf.toSpline=function(a){tf(a,"spline")},vf.toBar=function(a){tf(a,"bar")},vf.toScatter=function(a){tf(a,"scatter")},vf.toArea=function(a){tf(a,"area")},vf.toAreaSpline=function(a){tf(a,"area-spline") +},vf.toPie=function(a){tf(a,"pie",{withTransform:!0})},vf.toDonut=function(a){tf(a,"donut",{withTransform:!0})},vf.groups=function(a){return c(a)?wg:(wg=a,$e(),wg)},vf.xgrids=function(a){return a?(Lh=a,$e(),Lh):Lh},vf.xgrids.add=function(a){return a?vf.xgrids(Lh.concat(a)):void 0},vf.xgrids.remove=function(a){var b=sf(a);return vf.xgrids(Lh.filter(b))},vf.ygrids=function(a){return a?(Nh=a,$e(),Nh):Nh},vf.ygrids.add=function(a){return a?vf.ygrids(Nh.concat(a)):void 0},vf.ygrids.remove=function(a){var b=sf(a);return vf.ygrids(Nh.filter(b))},vf.regions=function(a){return c(a)?ji:(ji=a,$e(),ji)},vf.regions.add=function(a){return c(a)?ji:(ji=ji.concat(a),$e(),ji)},vf.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;bj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ji=ji.filter(function(b){return b.classes.indexOf(a)<0})}),ji},vf.data.get=function(a){var b=vf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},vf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},vf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ug[b]=a[b]}),pf(Cc(vf.data.targets),{withTransition:!0}),ug):ug},vf.x=function(a){return arguments.length&&(qc(vf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),vf.data.xs},vf.xs=function(a){return arguments.length&&(rc(vf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),vf.data.xs},vf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},vf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(sh=+a.y),b(a.y2)&&(Bh=+a.y2)):sh=Bh=+a,$e())},vf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},vf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&vf.axis.max(a.max),"undefined"!=typeof a.min&&vf.axis.min(a.min))},vf.legend.show=function(a){nf(Dc(a)),$e({withLegend:!0})},vf.legend.hide=function(a){of(Dc(a)),$e({withLegend:!0})},vf.resize=function(a){yf=a?a.width:null,zf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},vf.destroy=function(){vf.data.targets=void 0,vf.data.xs={},hj.html(""),a.onresize=null},"url"in e.data)uf.xhr(e.data.url,function(a,b){var c,d=uf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=uf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return vf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From a96966859972ea5b3cd19d6bcce01c097ea47642 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 22:32:36 +0900 Subject: [PATCH 20/38] Add sample for data.hide - #151 --- htdocs/samples/data_hide.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 htdocs/samples/data_hide.html diff --git a/htdocs/samples/data_hide.html b/htdocs/samples/data_hide.html new file mode 100644 index 0000000..b7db333 --- /dev/null +++ b/htdocs/samples/data_hide.html @@ -0,0 +1,24 @@ + + + + + +
+ + + + + + From 3b4c50085a7dcdace4b80c9545366d0121775b88 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 22:34:36 +0900 Subject: [PATCH 21/38] Fix sample --- htdocs/samples/data_hide.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/samples/data_hide.html b/htdocs/samples/data_hide.html index b7db333..fb3469b 100644 --- a/htdocs/samples/data_hide.html +++ b/htdocs/samples/data_hide.html @@ -16,7 +16,7 @@ ['data3', 300, 200, 160, 400, 250, 250] ], // hide: ['data1', 'data3'] - hide: false // hide all data + hide: true // hide all data } }); From 54c456e1af6e4a644744982c31dfd815a19858a3 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 22:59:32 +0900 Subject: [PATCH 22/38] Refactor point radius - #179 --- c3.js | 38 +++++++++++++++++++++++++------------- c3.min.js | 6 +++--- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/c3.js b/c3.js index 45e6624..04fdab1 100644 --- a/c3.js +++ b/c3.js @@ -217,11 +217,11 @@ // point - point of each data var __point_show = getConfig(['point', 'show'], true), - __point_r = __point_show ? getConfig(['point', 'r'], 2.5) : 0, + __point_r = getConfig(['point', 'r'], 2.5), __point_focus_line_enabled = getConfig(['point', 'focus', 'line', 'enabled'], true), __point_focus_expand_enabled = getConfig(['point', 'focus', 'expand', 'enabled'], true), - __point_focus_expand_r = getConfig(['point', 'focus', 'expand', 'r'], __point_focus_expand_enabled ? 4 : __point_r), - __point_select_r = getConfig(['point', 'focus', 'select', 'r'], 8); + __point_focus_expand_r = getConfig(['point', 'focus', 'expand', 'r']), + __point_select_r = getConfig(['point', 'focus', 'select', 'r']); var __line_connect_null = getConfig(['line', 'connect_null'], false); @@ -2244,9 +2244,9 @@ .attr("cx", __axis_rotated ? circleY : circleX) .attr("cy", __axis_rotated ? circleX : circleY) .attr("stroke", function () { return color(d); }) - .attr("r", __point_select_r * 1.4) + .attr("r", pointSelectR(d) * 1.4) .transition().duration(100) - .attr("r", __point_select_r); + .attr("r", pointSelectR); } function unselectPoint(target, d, i) { __data_onunselected(d, target.node()); @@ -2275,6 +2275,18 @@ return data.filter(function (d) { return isValue(d.value); }); } + //-- Point --// + + function pointR(d) { + return __point_show ? (typeof __point_r === 'function' ? __point_r(d) : __point_r) : 0; + } + function pointExpandedR(d) { + return __point_focus_expand_enabled ? (__point_focus_expand_r ? __point_focus_expand_r : pointR(d) * 1.75) : pointR(d); + } + function pointSelectR(d) { + return __point_select_r ? __point_select_r : pointR(d) * 4; + } + //-- Shape --// function getCircles(i, id) { @@ -2283,13 +2295,13 @@ function expandCircles(i, id) { getCircles(i, id) .classed(CLASS.EXPANDED, true) - .attr('r', __point_focus_expand_r); + .attr('r', pointExpandedR); } function unexpandCircles(i) { getCircles(i) .filter(function () { return d3.select(this).classed(CLASS.EXPANDED); }) .classed(CLASS.EXPANDED, false) - .attr('r', __point_r); + .attr('r', pointR); } function getBars(i) { return main.selectAll('.' + CLASS.bar + (isValue(i) ? '-' + i : '')); @@ -2899,12 +2911,12 @@ .filter(function (d) { return __data_selection_isselectable(d); }) .each(function () { var _this = d3.select(this).classed(CLASS.EXPANDED, true); - if (this.nodeName === 'circle') { _this.attr('r', __point_focus_expand_r); } + if (this.nodeName === 'circle') { _this.attr('r', pointExpandedR); } svg.select('.' + CLASS.eventRect + '-' + i).style('cursor', null); }) - .filter(function () { + .filter(function (d) { if (this.nodeName === 'circle') { - return isWithinCircle(this, __point_select_r); + return isWithinCircle(this, pointSelectR(d)); } else if (this.nodeName === 'path') { return isWithinBar(this); @@ -2914,7 +2926,7 @@ var _this = d3.select(this); if (! _this.classed(CLASS.EXPANDED)) { _this.classed(CLASS.EXPANDED, true); - if (this.nodeName === 'circle') { _this.attr('r', __point_select_r); } + if (this.nodeName === 'circle') { _this.attr('r', pointSelectR); } } svg.select('.' + CLASS.eventRect + '-' + i).style('cursor', 'pointer'); }); @@ -3027,7 +3039,7 @@ isSelected = shape.classed(CLASS.SELECTED); var isWithin = false, toggle; if (target.nodeName === 'circle') { - isWithin = isWithinCircle(target, __point_select_r * 1.5); + isWithin = isWithinCircle(target, pointSelectR(d) * 1.5); toggle = togglePoint; } else if (target.nodeName === 'path') { @@ -3425,7 +3437,7 @@ mainCircle.enter().append("circle") .attr("class", classCircle) .style('opacity', 0) - .attr("r", __point_r); + .attr("r", pointR); mainCircle .style("opacity", initialOpacity) .transition().duration(duration) diff --git a/c3.min.js b/c3.min.js index fd57c23..789e8a8 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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;cNf&&(Nf=0),0>Pf&&(Pf=0),Of=$g?Kf.left-Vi-Wi:Nf,Qf=$g?Pf:Sf-Lf.top-Lf.bottom,0>Of&&(Of=0),0>Qf&&(Qf=0),p(),Qi&&ee(vf.data.targets)&&(Mf.left=Nf/2+Uf)}function o(){dj.select("line."+f.xgridFocus).attr("x1",$g?0:-10).attr("x2",$g?Nf:-10).attr("y1",$g?-10:Kf.top).attr("y2",$g?-10:Pf)}function p(){Uf=Pf/2,Tf=.95*Uf,Vf=de(vf.data.targets)?.6*Tf:0}function q(){var a=$g?f.axisX:f.axisY,b=dj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=uf.select(xf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return yf?yf:x()}function s(){var a=zf?zf:y();return a>0?a:320}function t(){return ee(vf.data.targets)?0:Af?Af:$g?_g?v("x"):1:!rh||wh?1:v("y")}function u(){var a=1;return ee(vf.data.targets)?0:Bf?Bf:Qi?P()+(Ah&&!$g?v("y2"):a):Ah?Fh||$g?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||_g?"x"===a&&oh?oh:"y"!==a||rh?"y2"!==a||Ah?(jb(a).isInner?30:40)+("y2"===a?-10:0):Xi:Ug&&!Qi?10:1:0}function x(){return+uf.select(xf).style("width").replace("px","")}function y(){return+uf.select(xf).style("height").replace("px","")}function z(a){return a?-5:-(Kf.left-1)}function A(a){return a?-20:-4}function B(){return z(!$g)}function C(){return A(!$g)}function D(){return z($g)}function E(){return A($g)}function F(a){return a?Nf+2+4:Kf.left+20}function G(a){return a?(oh?oh:0)+80:Pf+8}function H(){return F(!$g)}function I(){return G(!$g)}function J(){return F($g)}function K(){return G($g)}function L(){var a,b,c,d,e,f=Ac(vf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=gg(b.x)-gg(a.x),d=zc(),e=ae(vf.data.targets)?(d-(yi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ri=a}function N(a){Si=a}function O(a){Ti=a}function P(){return Ug?Qi?Si*(Ri+1):Rf:0}function Q(){return Ug?Qi?Sf:Ti*(Ri+1):0}function R(){var a,b,c=!gg;$f=$g?1:0,_f=$g?Pf:Nf,ag=$g?0:Pf,bg=$g?Nf:1,cg=$f,dg=_f,eg=$g?0:Qf,fg=$g?Of:1,gg=T($f,_f,c?void 0:gg.domain(),function(){return mg.tickOffset()}),hg=U(ag,bg,c?void 0:hg.domain()),ig=U(ag,bg,c?void 0:ig.domain()),jg=T($f,_f,ij,function(a){return a%1?0:pg.tickOffset()}),kg=U(eg,fg,c?void 0:kg.domain()),lg=U(eg,fg,c?void 0:lg.domain()),a=$(),b=jh?jh:c?void 0:mg.tickValues(),mg=X(gg,Li,a,b),pg=X(jg,Oi,a,b),ng=Y(hg,Mi,xh,zh),og=Y(ig,Ni,Gh,Ih),c||(Yi.scale(jg),Cf&&aj.scale(gg)),S()}function S(){Wf=Gb(),Xf=Hb(),Yf=Hb(.98)}function T(a,b,d,e){var f=(xi?uf.time.scale():uf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),yi){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=uf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?ig:hg}function W(a){return"y2"===Z(a)?lg:kg}function X(a,b,c,d){var e=(yi?Eb():uf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),yi?(e.tickCentered(dh),ve(fh)&&(fh=!1)):e.tickOffset=function(){var a=Bc(vf.data.targets),b=gg(a[1])-gg(a[0]);return b/zc()/2},yi&&e.categories(ch),e}function Y(a,b,c,d){return uf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in xg?xg[a]:"y"}function $(){var a=xi?Ii:yi?Tc:function(a){return 0>a?a.toFixed(0):a};return eh&&("function"==typeof eh?a=eh:xi&&(a=function(a){return a?Hi(eh)(a):""})),a}function _(a){var b;return"y"===a?b=vh:"y2"===a?b=Eh:"x"===a&&(b=qh),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?vh=b:"y2"===a?Eh=b:"x"===a&&(qh=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",$g?"inner-top":"inner-right")}function hb(){return fb("y",$g?"inner-right":"inner-top")}function ib(){return fb("y2",$g?"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?Nf/2:Nf:b.isBottom?-Pf:b.isMiddle?-Pf/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(!$g,gb())}function rb(){return nb($g,hb())}function sb(){return nb($g,ib())}function tb(){return ob(!$g,gb())}function ub(){return ob($g,hb())}function vb(){return ob($g,ib())}function wb(){var a=gb();return $g?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":oh?oh-10:"3em"}function xb(){var a=hb();return $g?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return $g?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!$g,gb())}function Ab(){return pb($g,hb())}function Bb(){return pb($g,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return uf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){dj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),dj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),dj.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 uf.min(Object.keys(i).map(function(a){return uf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(wg.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 uf.max(Object.keys(i).map(function(a){return uf.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?Ch:th,n="y2"===c?Bh:sh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Dh:uh,r=ud()&&$g;return 0===l.length?"y2"===c?ig.domain():hg.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=vd(o,p),j=ac(hg.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&&yh&&(f=b(yh.top)?yh.top:e,g=b(yh.bottom)?yh.bottom:e),"y2"===c&&Hh&&(f=b(Hh.top)?Hh.top:e,g=b(Hh.bottom)?Hh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return mh?xi?re(mh):mh:uf.min(a,function(a){return uf.min(a.values,function(a){return a.x})})}function Zb(a){return lh?xi?re(lh):lh:uf.max(a,function(a){return uf.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 yi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof nh&&we(nh)?(e=b(nh.left)?nh.left:d,f=b(nh.right)?nh.right:d):e=f="number"==typeof nh?nh: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||0===c)&&(f=xi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=xi?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?hg:ig;return b="y"===a.axis||"y2"===a.axis?$g?Pf:"start"in a?d(a.start):Pf:$g?"end"in a?gg(xi?re(a.end):a.end):Pf:Pf,c>b?0:b-c}function ic(a){return qg&&a===qg||we(rg)&&xe(rg,a)}function jc(a){return!ic(a)}function kc(a){return qg?qg:we(rg)?rg[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=vf.data.xs[b])}),c}function mc(a,b){return a in vf.data.xs&&vf.data.xs[a]&&vf.data.xs[a][b]?vf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){rg[b]=a[b]})}function oc(a){return 1===uf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=ug[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)}),vf.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=xi?a?a instanceof Date?a:re(a):re(mc(c,d)):zi&&!yi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?vf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):qg?(d=Object.keys(vf.data.xs),vf.data.xs[c]=d.length>0?vf.data.xs[d[0]]:void 0):we(rg)&&(vf.data.xs[c]=lc(f,vf.data.targets)):vf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!vf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=tg(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 zi&&yi&&0===c&&g&&(0===e&&(ch=[]),ch.push(g)),("undefined"==typeof a[b]||vf.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++})}),yg&&$d(Cc(c).filter(function(a){return!(a in zg)}),yg),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&&vf.data.targets[0].values[a-1]?vf.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(vf.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(xi?new Date(i):i);j.push(e)}return xi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Ji=Ji.concat(a)}function Mc(a){Ji=Ji.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ki=Ki.concat(a)}function Oc(a){Ki=Ki.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return uf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Bg&&"desc"===Bg.toLowerCase()}function Nd(){return Bg&&"asc"===Bg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Bg&&a.sort(Bg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(vf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ki&&(gj.html(ni(a,$(),wd(k),Gi)).style("display","block"),d=gj.property("offsetWidth"),e=gj.property("offsetHeight"),k?(g=Nf/2+c[0],i=Pf/2+c[1]+20):($g?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=gg(l[0].x)+20):(f=q(),g=f+t()+gg(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)),gj.style("top",i+"px").style("left",g+"px"))}function Qd(){gj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ki&&(be(vf.data.targets)||ee(vf.data.targets)||dj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr($g?"y1":"x1",Cd).attr($g?"y2":"x2",Cd))}function Sd(){dj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?gg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Wh?Wh:b?2*a.tickOffset()*Xh/b:0}function $d(a,b){Dc(a).forEach(function(a){kj[a]=b===zg[a],zg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){zg[a.id]===b&&(c=!0),a.id in zg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in zg)||"line"===zg[b]||"spline"===zg[b]||"area"===zg[b]||"area-spline"===zg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===zg[b]||"area-spline"===zg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===zg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===zg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===zg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===zg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&ei||je(a)&&$h}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=sg?uf.time.format(sg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+sg)}return c}function se(a,b){var c=uf.mouse(a),d=uf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?hg:ig,d=$g?1:0,e=$g?0:1;return Math.pow(gg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Ng(b,a.node()),dj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",$g?Ud:Td).attr("cy",$g?Td:Ud).attr("stroke",function(){return Gi(b)}).attr("r",1.4*Uh).transition().duration(100).attr("r",Uh)}function Be(a,b,c){Og(b,a.node()),dj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Ng(b,a.node()),a.transition().duration(100).style("fill",function(){return uf.rgb(Gi(b)).darker(1)})}function Ee(a,b){Og(b,a.node()),a.transition().duration(100).style("fill",function(){return Gi(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a,c){return(c?dj.selectAll("."+f.circles+ld(c)):dj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Ie(a,b){He(a,b).classed(f.EXPANDED,!0).attr("r",Th)}function Je(a){He(a).filter(function(){return uf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Qh)}function Ke(a){return dj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Le(a){Ke(a).classed(f.EXPANDED,!0)}function Me(a){Ke(a).classed(f.EXPANDED,!1)}function Ne(a,b){var c=Re(a,b);return function(a,b){var d=c(a,b),e=$g?1:0,f=$g?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 Oe(a,b){var c=Re(a,!1),d=b?Pe:Qe;return function(a,b){return d(c(a,b),a,this)}}function Pe(a,b){var c;return $g?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Qe(a,b,c){var d=c.getBoundingClientRect();return $g?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Re(a,b){var c=a.__max__+1,d=Zd(mg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 $g&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Se(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 Te(b){var c,d,e;if(hj=uf.select(xf),hj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(hj.html("").classed("c3",!0),vf.data.xs={},vf.data.targets=vc(b),Fg&&Lc(Fg===!0?Cc(vf.data.targets):Fg),n(),R(),gg.domain(uf.extent(_b(vf.data.targets))),hg.domain(Xb(vf.data.targets,"y")),ig.domain(Xb(vf.data.targets,"y2")),jg.domain(gg.domain()),kg.domain(hg.domain()),lg.domain(ig.domain()),ij=gg.domain(),Yi.scale(jg),Cf&&aj.scale(gg),bj=hj.append("svg").attr("width",Nf+Kf.left+Kf.right).attr("height",Pf+Kf.top+Kf.bottom).on("mouseenter",Ff).on("mouseleave",Gf),cj=bj.append("defs"),cj.append("clipPath").attr("id",ri).append("rect").attr("width",Nf).attr("height",Pf),cj.append("clipPath").attr("id",si).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),cj.append("clipPath").attr("id",ti).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),dj=bj.append("g").attr("transform",Pi.main),ej=bj.append("g").attr("transform",Pi.context),fj=bj.append("g").attr("transform",Pi.legend),Rg||ej.style("visibility","hidden"),Ug||(fj.style("visibility","hidden"),Ki=Cc(vf.data.targets)),gj=uf.select(xf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),pf(Cc(vf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),_g&&dj.append("g").attr("class",f.axisX).attr("clip-path",vi).attr("transform",Pi.x).append("text").attr("class",f.axisXLabel).attr("transform",$g?"rotate(-90)":"").style("text-anchor",zb),rh&&dj.append("g").attr("class",f.axisY).attr("clip-path",wi).attr("transform",Pi.y).append("text").attr("class",f.axisYLabel).attr("transform",$g?"":"rotate(-90)").style("text-anchor",Ab),Ah&&dj.append("g").attr("class",f.axisY2).attr("transform",Pi.y2).append("text").attr("class",f.axisY2Label).attr("transform",$g?"":"rotate(-90)").style("text-anchor",Bb),d=dj.append("g").attr("clip-path",ui).attr("class",f.grid),Jh&&d.append("g").attr("class",f.xgrids),we(Lh)&&d.append("g").attr("class",f.xgridLines),Rh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Mh&&d.append("g").attr("class",f.ygrids),we(Nh)&&d.append("g").attr("class",f.ygridLines),dj.append("g").attr("clip-path",ui).attr("class",f.regions),dj.append("g").attr("clip-path",ui).attr("class",f.chart),c=dj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Cf?$g?"ns-resize":"ew-resize":null),dj.select("."+f.chart).append("g").attr("class",f.chartBars),dj.select("."+f.chart).append("g").attr("class",f.chartLines),dj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Pi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),dj.select("."+f.chart).append("g").attr("class",f.chartTexts),Cf&&dj.insert("rect",Ef?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Nf).attr("height",Pf).style("opacity",0).style("cursor",$g?"ns-resize":"ew-resize").call(aj).on("dblclick.zoom",null),ph&&Yi.extent("function"!=typeof ph?ph:ph(_b())),ej.append("g").attr("clip-path",ui).attr("class",f.chart),ej.select("."+f.chart).append("g").attr("class",f.chartBars),ej.select("."+f.chart).append("g").attr("class",f.chartLines),ej.append("g").attr("clip-path",ui).attr("class",f.brush).call(Yi).selectAll("rect").attr($g?"width":"height",$g?Of:Qf),ej.append("g").attr("class",f.axisX).attr("transform",Pi.subx).attr("clip-path",$g?"":vi),ef(vf.data.targets),$g?dj.select("."+f.axisX).style("opacity",0).call(mg):(dj.select("."+f.axisY).style("opacity",0).call(ng),dj.select("."+f.axisY2).style("opacity",0).call(og)),n(),R(),cf(),m(!1),$e({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),oi){if(xi&&"string"==typeof pi){for(pi=re(pi),e=0;e0){d=[];for(var g in ug)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 Ye(a){ee(vf.data.targets)||Gg&&(Ai=a,dj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Bi=!0,Pg())}function Ze(){ee(vf.data.targets)||Gg&&(dj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),dj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Bi=!1,Qg())}function $e(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=Vd(),W=ee(vf.data.targets),X=Ic(vf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Jf:0,Q=D?P:0,R=E?P:0,c=dj.select("."+f.axisX).style("opacity",W?0:1),g=dj.select("."+f.axisY).style("opacity",W?0:1),h=dj.select("."+f.axisY2).style("opacity",W?0:1),e=ej.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Ug&&pf(Cc(vf.data.targets),a,O),yi&&(0!==X.length&&H&&G||gg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(gg.domain(uf.extent(_b(X))),ij=gg.domain(),Cf&&aj.scale(gg).updateScaleExtent(),jg.domain(gg.domain()),Yi.scale(jg)),G&&(gg.domain(Yi.empty()?ij:Yi.extent()),Cf&&aj.scale(gg).updateScaleExtent()),jh||!ih&&!hh||(S=Kc(Jc(X),hh),mg.tickValues(S),pg.tickValues(S))),hg.domain(Xb(X,"y")),ig.domain(Xb(X,"y2")),O.axisX.call(mg),O.axisY.call(ng),O.axisY2.call(og),O.axisSubX.call(pg),G&&X.length)if(fh&&S){for(T=1;T=0&&uf.select(this).style("display",b%U?"none":"block")})}else uf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!$g&&kh&&eb(c,O.axisX,kh),J=Ne(V),M=Oe(V,!0),N=Oe(V,!1),Db(),kg.domain(hg.domain()),lg.domain(ig.domain()),gj.style("display","none"),o(),dj.select("line."+f.xgridFocus).style("visibility","hidden"),Jh){if("year"===Kh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=gg.ticks(10);i=dj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",$g?0:function(a){return gg(a)-mg.tickOffset()}).attr("x2",$g?Nf:function(a){return gg(a)-mg.tickOffset()}).attr("y1",$g?function(a){return gg(a)-mg.tickOffset()}:Kf.top).attr("y2",$g?function(a){return gg(a)-mg.tickOffset()}:Pf).style("opacity",function(){return+uf.select(this).attr($g?"y1":"x1")===($g?Pf:0)?0:1}),i.exit().remove()}we(Lh)&&(k=dj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Lh),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",$g?"":"rotate(-90)").attr("dx",$g?0:-Kf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",$g?0:Dd).attr("x2",$g?Nf:Dd).attr("y1",$g?Dd:Kf.top).attr("y2",$g?Dd:Pf).style("opacity",1),k.select("text").transition().duration(P).attr("x",$g?Nf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Mh&&(m=dj.select("."+f.ygrids).selectAll("."+f.ygrid).data(hg.ticks(Oh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",$g?hg:0).attr("x2",$g?hg:Nf).attr("y1",$g?0:hg).attr("y2",$g?Pf:hg),m.exit().remove()),A&&we(Nh)&&(n=dj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Nh),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",$g?"rotate(-90)":"").attr("dx",$g?0:-Kf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",$g?Ed:0).attr("x2",$g?Ed:Nf).attr("y1",$g?0:Ed).attr("y2",$g?Pf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",$g?0:Nf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=dj.select("."+f.regions).selectAll("rect."+f.region).data(ji),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=dj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Gi(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=dj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return $g?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),dj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",Zi).style("opacity",1),dj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",$i).style("opacity",jj),q=dj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",Qh),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",$g?Ud:Td).attr("cy",$g?Td:Ud),q.exit().remove(),dj.each(function(){Ei=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=uf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Ei=!1}),dj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),dj.select("."+f.chartArcsTitle).style("opacity",de(vf.data.targets)?1:0),Rg&&(null!==uf.event&&"zoom"===uf.event.type&&Yi.extent(gg.orgDomain()).update(),B&&(!$g&&kh&&eb(e,O.axisSubX,kh),Yi.empty()||Yi.extent(gg.orgDomain()).update(),K=Ne(V,!0),u=ej.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Gi(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),ej.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",_i).style("opacity",1))),dj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),dj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",$g?Ud:Td).attr("cy",$g?Td:Ud),v=dj.select("."+f.eventRects),we(rg)&&!oc(rg)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=dj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ve(w.enter()),w.attr("x",0).attr("y",0).attr("width",Nf).attr("height",Pf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),zi&&!yi?(z=function(a,b){var c=xc(b),d=yc(b),e=vf.data.xs[a.id][b];return(gg(d?d:e+50)-gg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=vf.data.xs[a.id][b];return(gg(d)+gg(c?c:d-50))/2}):(z=L(),y=function(a){return gg(a.x)-z/2}),x=Ac(vf.data.targets),dj.select("."+f.eventRects).datum(x?x.values:[]),w=dj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ue(w.enter()),w.attr("class",fd).attr("x",$g?0:y).attr("y",$g?y:0).attr("width",$g?Nf:z).attr("height",$g?z:Pf),w.exit().remove()),Cc(vf.data.targets).forEach(function(a){kj[a]=!0})}function _e(){$e({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function af(){return"mousemove"===uf.event.sourceEvent.type&&aj.altDomain?(gg.domain(aj.altDomain),void aj.scale(gg).updateScaleExtent()):(yi&&gg.orgDomain()[0]===ij[0]&&gg.domain([ij[0]-1e-10,gg.orgDomain()[1]]),$e({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===uf.event.sourceEvent.type&&(Ci=!0)))}function bf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function cf(){bj.attr("width",Rf).attr("height",Sf),bj.select("#"+ri).select("rect").attr("width",Nf).attr("height",Pf),bj.select("#"+si).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),bj.select("#"+ti).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),bj.select("."+f.zoomRect).attr("width",Nf).attr("height",Pf),hj.style("max-height",Sf+"px")}function df(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(),cf(),m(a.withTransition),$e(a)}function ef(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=dj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Gi(a)}),e=dj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Ig(a)?"pointer":null}),c=dj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Gi(a)}),b.append("path").attr("class",dd).style("opacity",function(){return jj=+uf.select(this).style("opacity"),0}).style("fill",function(a){return Gi(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Gi(a)}).style("cursor",function(a){return Ig(a)?"pointer":null}),a.forEach(function(a){dj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=dj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Zf(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Gi(a.data)}).style("cursor",function(a){return Ig(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ei||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),lf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,uf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ei||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),mf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Rg&&(n=ej.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Gi(a)}),l=ej.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Gi(a)})),bj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Jf).style("opacity",1)}function ff(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),vf.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=Qi?j:i,l=Qi?Q():P();return d&&(w=0,C=0,t=0,u=0),Ug&&!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=Qi?u:t,void(Zg?(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=fj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Qi?(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=fj.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 Wg?Wg(a):vf.toggle(a)}).on("mouseover",function(a){uf.select(this).classed(f.legendItemFocused,!0),Ei||vf.focus(a),"function"==typeof Xg&&Xg(a)}).on("mouseout",function(a){uf.select(this).classed(f.legendItemFocused,!1),Ei||vf.revert(),"function"==typeof Yg&&Yg(a)}),o.append("text").text(function(a){return d(ug[a])?ug[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Qi?h:-200).attr("y",Qi?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Qi?i:-200).attr("y",Qi?-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",function(a){return Gi(a)}).attr("x",Qi?h:-200).attr("y",Qi?-200:j).attr("width",10).attr("height",10),fj.selectAll("text").data(a).text(function(a){return d(ug[a])?ug[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),fj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),fj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),fj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=uf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?jf(b):kf(b):Ui}),N(t),O(u),M(C),n(),R(),cf(),m(q,c)}function qf(a){return Ec(vf.data.targets,a.id)}function rf(a){return"data"in a&&Ec(vf.data.targets,a.data.id)}function sf(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 tf(a,b,c){var d=!ee(vf.data.targets);Ei=!1,$d(a,b),df(c||{withTransitionForAxis:d})}var uf=a.d3?a.d3:a.require?a.require("d3"):void 0,vf={data:{},axis:{},legend:{}},wf={},xf=h(["bindto"],"#chart"),yf=h(["size","width"]),zf=h(["size","height"]),Af=h(["padding","left"],50),Bf=h(["padding","right"]),Cf=h(["zoom","enabled"],!1),Df=h(["zoom","extent"]),Ef=h(["zoom","privileged"],!1),Ff=h(["onenter"],function(){}),Gf=h(["onleave"],function(){}),Hf=h(["onresize"],function(){}),If=h(["onresized"],function(){}),Jf=h(["transition","duration"],350);g("data","data is required in config");var Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),rg=h(["data","xs"],{}),sg=h(["data","x_format"]),tg=h(["data","id_converter"],function(a){return a}),ug=h(["data","names"],{}),vg=h(["data","classes"],{}),wg=h(["data","groups"],[]),xg=h(["data","axes"],{}),yg=h(["data","type"]),zg=h(["data","types"],{}),Ag=h(["data","labels"],{}),Bg=h(["data","order"]),Cg=h(["data","regions"],{}),Dg=h(["data","color"]),Eg=h(["data","colors"],{}),Fg=h(["data","hide"],!1),Gg=h(["data","selection","enabled"],!1),Hg=h(["data","selection","grouped"],!1),Ig=h(["data","selection","isselectable"],function(){return!0}),Jg=h(["data","selection","multiple"],!0),Kg=h(["data","onclick"],function(){}),Lg=h(["data","onenter"],function(){}),Mg=h(["data","onleave"],function(){}),Ng=h(["data","onselected"],function(){}),Og=h(["data","onunselected"],function(){}),Pg=h(["data","ondragstart"],function(){}),Qg=h(["data","ondragend"],function(){}),Rg=h(["subchart","show"],!1),Sg=h(["subchart","size","height"],60),Tg=h(["color","pattern"],[]),Ug=h(["legend","show"],!0),Vg=h(["legend","position"],"bottom"),Wg=h(["legend","item","onclick"]),Xg=h(["legend","item","onmouseover"]),Yg=h(["legend","item","onmouseout"]),Zg=h(["legend","equally"],!1),$g=h(["axis","rotated"],!1),_g=h(["axis","x","show"],!0),ah=h(["axis","x","type"],"indexed"),bh=h(["axis","x","localtime"],!0),ch=h(["axis","x","categories"],[]),dh=h(["axis","x","tick","centered"],!1),eh=h(["axis","x","tick","format"]),fh=h(["axis","x","tick","culling"],{}),gh=h(["axis","x","tick","culling","max"],10),hh=h(["axis","x","tick","count"]),ih=h(["axis","x","tick","fit"],!0),jh=h(["axis","x","tick","values"],null),kh=h(["axis","x","tick","rotate"]),lh=h(["axis","x","max"],null),mh=h(["axis","x","min"],null),nh=h(["axis","x","padding"],{}),oh=h(["axis","x","height"]),ph=h(["axis","x","default"]),qh=h(["axis","x","label"],{}),rh=h(["axis","y","show"],!0),sh=h(["axis","y","max"]),th=h(["axis","y","min"]),uh=h(["axis","y","center"]),vh=h(["axis","y","label"],{}),wh=h(["axis","y","inner"],!1),xh=h(["axis","y","tick","format"]),yh=h(["axis","y","padding"],{}),zh=h(["axis","y","ticks"],10),Ah=h(["axis","y2","show"],!1),Bh=h(["axis","y2","max"]),Ch=h(["axis","y2","min"]),Dh=h(["axis","y2","center"]),Eh=h(["axis","y2","label"],{}),Fh=h(["axis","y2","inner"],!1),Gh=h(["axis","y2","tick","format"]),Hh=h(["axis","y2","padding"],{}),Ih=h(["axis","y2","ticks"],10),Jh=h(["grid","x","show"],!1),Kh=h(["grid","x","type"],"tick"),Lh=h(["grid","x","lines"],[]),Mh=h(["grid","y","show"],!1),Nh=h(["grid","y","lines"],[]),Oh=h(["grid","y","ticks"],10),Ph=h(["point","show"],!0),Qh=Ph?h(["point","r"],2.5):0,Rh=h(["point","focus","line","enabled"],!0),Sh=h(["point","focus","expand","enabled"],!0),Th=h(["point","focus","expand","r"],Sh?4:Qh),Uh=h(["point","focus","select","r"],8),Vh=h(["line","connect_null"],!1),Wh=h(["bar","width"]),Xh=h(["bar","width","ratio"],.6),Yh=h(["pie","label","show"],!0),Zh=h(["pie","label","format"]),$h=h(["pie","expand"],!0),_h=h(["pie","onclick"],function(){}),ai=h(["pie","onmouseover"],function(){}),bi=h(["pie","onmouseout"],function(){}),ci=h(["donut","label","show"],!0),di=h(["donut","label","format"]),ei=h(["donut","expand"],!0),fi=h(["donut","title"],""),gi=h(["donut","onclick"],function(){}),hi=h(["donut","onmouseover"],function(){}),ii=h(["donut","onmouseout"],function(){}),ji=h(["regions"],[]),ki=h(["tooltip","show"],!0),li=h(["tooltip","format","title"]),mi=h(["tooltip","format","value"]),ni=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=li?li:b,l=mi?mi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),oi=h(["tooltip","init","show"],!1),pi=h(["tooltip","init","x"],0),qi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ri=("string"==typeof xf?xf.replace("#",""):xf.id)+"-clip",si=ri+"-xaxis",ti=ri+"-yaxis",ui=i(ri),vi=i(si),wi=i(ti),xi="timeseries"===ah,yi="categorized"===ah,zi=!xi&&(qg||we(rg)),Ai=null,Bi=!1,Ci=!1,Di=!1,Ei=!1,Fi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Gi=qe(Eg,we(Tg)?Tg:Fi,Dg),Hi=bh?uf.time.format:uf.time.format.utc,Ii=function(){var a=[[Hi("%Y/%-m/%-d"),function(){return!0}],[Hi("%-m/%-d"),function(a){return a.getMonth()}],[Hi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Hi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Hi("%I %p"),function(a){return a.getHours()}],[Hi("%I:%M"),function(a){return a.getMinutes()}],[Hi(":%S"),function(a){return a.getSeconds()}],[Hi(".%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)}}(),Ji=[],Ki=[],Li=$g?"left":"bottom",Mi=$g?wh?"top":"bottom":wh?"right":"left",Ni=$g?Fh?"bottom":"top":Fh?"left":"right",Oi=$g?"left":"bottom",Pi={main:function(){return"translate("+Kf.left+","+Kf.top+")"},context:function(){return"translate("+Lf.left+","+Lf.top+")"},legend:function(){return"translate("+Mf.left+","+Mf.top+")"},x:function(){return"translate(0,"+($g?0:Pf)+")"},y:function(){return"translate(0,"+($g?Pf:0)+")"},y2:function(){return"translate("+($g?0:Nf)+","+($g?1:0)+")"},subx:function(){return"translate(0,"+($g?0:Qf)+")"},arc:function(){return"translate("+Nf/2+","+Pf/2+")"}},Qi="right"===Vg,Ri=0,Si=0,Ti=0,Ui=.15,Vi=30,Wi=$g&&!_g?0:30,Xi=5;Zf=uf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var Yi,Zi=function(){var a=uf.svg.line().x($g?function(a){return V(a.id)(a.value)}:Cd).y($g?Cd:function(a){return V(a.id)(a.value)});return Vh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Vh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Cg[b.id]?Se(e,gg,V(b.id),Cg[b.id]):a(e)):(c=e[0]?gg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,$g?"M "+d+" "+c:"M "+c+" "+d)}}(),$i=function(){var a;return a=$g?uf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):uf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?gg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,$g?"M "+d+" "+c:"M "+c+" "+d)}}(),_i=function(){var a=uf.svg.line().x($g?function(a){return W(a.id)(a.value)}:Fd).y($g?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+jg(c[0].x)+" "+W(b.id)(c[0].value)}}(),aj=function(){};Yi=uf.svg.brush().on("brush",_e),Yi.update=function(){return ej&&ej.select("."+f.brush).call(this),this},Yi.scale=function(a){return $g?this.y(a):this.x(a)},Cf&&(aj=uf.behavior.zoom().on("zoomstart",function(){aj.altDomain=uf.event.sourceEvent.altKey?gg.orgDomain():null}).on("zoom",Cf?af:null),aj.scale=function(a){return $g?this.y(a):this.x(a)},aj.orgScaleExtent=function(){var a=Df?Df:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},aj.updateScaleExtent=function(){var a=ac(gg.orgDomain())/ac(ij),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var bj,cj,dj,ej,fj,gj,hj,ij,jj,kj={};if(vf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=bj.selectAll(md(a)),d=c.filter(qf),e=c.filter(rf);vf.revert(),vf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(vf.data.targets)&&Nb(a,!0),lf(a,!0)},vf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=bj.selectAll(md(a)),d=c.filter(qf),e=c.filter(rf);vf.revert(),b(d.classed(f.focused,!1)),b(e),ee(vf.data.targets)&&Ob(a),lf(a,!1)},vf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=bj.selectAll(md(a)),d=c.filter(qf),e=c.filter(rf);b(d.classed(f.focused,!1)),b(e),ee(vf.data.targets)&&Ob(a),mf()},vf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),bj.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&nf(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},vf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),bj.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&of(a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},vf.toggle=function(a){Gc(a)?vf.hide(a):vf.show(a)},vf.unzoom=function(){Yi.clear().update(),$e({withUpdateXDomain:!0})},vf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){vg[b]=a.classes[b]}),"categories"in a&&yi&&(ch=a.categories,mg.categories(ch)),"cacheIds"in a&&bc(a.cacheIds)?void ff(dc(a.cacheIds),a.done):void("unload"in a?hf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){gf(a)}):gf(a))},vf.unload=function(a,b){hf(Dc(a),function(){$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},vf.selected=function(a){return uf.merge(dj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return uf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},vf.select=function(a,b,c){Gg&&dj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=uf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Hg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Ig(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},vf.unselect=function(a,b){Gg&&dj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=uf.select(this),g="circle"===this.nodeName?Be:Ee,h=Hg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Ig(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},vf.toLine=function(a){tf(a,"line")},vf.toSpline=function(a){tf(a,"spline")},vf.toBar=function(a){tf(a,"bar")},vf.toScatter=function(a){tf(a,"scatter")},vf.toArea=function(a){tf(a,"area")},vf.toAreaSpline=function(a){tf(a,"area-spline") -},vf.toPie=function(a){tf(a,"pie",{withTransform:!0})},vf.toDonut=function(a){tf(a,"donut",{withTransform:!0})},vf.groups=function(a){return c(a)?wg:(wg=a,$e(),wg)},vf.xgrids=function(a){return a?(Lh=a,$e(),Lh):Lh},vf.xgrids.add=function(a){return a?vf.xgrids(Lh.concat(a)):void 0},vf.xgrids.remove=function(a){var b=sf(a);return vf.xgrids(Lh.filter(b))},vf.ygrids=function(a){return a?(Nh=a,$e(),Nh):Nh},vf.ygrids.add=function(a){return a?vf.ygrids(Nh.concat(a)):void 0},vf.ygrids.remove=function(a){var b=sf(a);return vf.ygrids(Nh.filter(b))},vf.regions=function(a){return c(a)?ji:(ji=a,$e(),ji)},vf.regions.add=function(a){return c(a)?ji:(ji=ji.concat(a),$e(),ji)},vf.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;bj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),ji=ji.filter(function(b){return b.classes.indexOf(a)<0})}),ji},vf.data.get=function(a){var b=vf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},vf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},vf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){ug[b]=a[b]}),pf(Cc(vf.data.targets),{withTransition:!0}),ug):ug},vf.x=function(a){return arguments.length&&(qc(vf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),vf.data.xs},vf.xs=function(a){return arguments.length&&(rc(vf.data.targets,a),$e({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),vf.data.xs},vf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},vf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(sh=+a.y),b(a.y2)&&(Bh=+a.y2)):sh=Bh=+a,$e())},vf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(th=+a.y),b(a.y2)&&(Ch=+a.y2)):th=Ch=+a,$e())},vf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&vf.axis.max(a.max),"undefined"!=typeof a.min&&vf.axis.min(a.min))},vf.legend.show=function(a){nf(Dc(a)),$e({withLegend:!0})},vf.legend.hide=function(a){of(Dc(a)),$e({withLegend:!0})},vf.resize=function(a){yf=a?a.width:null,zf=a?a.height:null,df({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},vf.destroy=function(){vf.data.targets=void 0,vf.data.xs={},hj.html(""),a.onresize=null},"url"in e.data)uf.xhr(e.data.url,function(a,b){var c,d=uf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=uf.csv.parse(b.response),Te(c)});else if("rows"in e.data)Te(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Te(uc(e.data.columns))}return vf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?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||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){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=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),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?yh=b:"y2"===a?Hh=b:"x"===a&&(th=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",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"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?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/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(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.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 xf.max(Object.keys(i).map(function(a){return xf.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?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.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=vd(o,p),j=ac(kg.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&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.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 Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh: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||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?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?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[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)}),yf.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=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(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 Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.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++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),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&&yf.data.targets[0].values[a-1]?yf.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(yf.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(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(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)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 bh&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(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=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else xf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),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",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),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",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(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(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.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=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!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=Ti?u:t,void(ah?(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=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(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=ij.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 Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-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",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"],{}),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"],{}),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline")},yf.toPie=function(a){wf(a,"pie",{withTransform:!0}) +},yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From f8c309f4f633d43a6447b1c6d234b417b4ec5d9a Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 23:03:27 +0900 Subject: [PATCH 23/38] Add sample for point.r - #179 --- htdocs/samples/point_r.html | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 htdocs/samples/point_r.html diff --git a/htdocs/samples/point_r.html b/htdocs/samples/point_r.html new file mode 100644 index 0000000..46ee3ec --- /dev/null +++ b/htdocs/samples/point_r.html @@ -0,0 +1,28 @@ + + + + + +
+ + + + + + From 18675fe75962bc00a6065ec3ed7d52d777caaf9e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 00:00:28 +0900 Subject: [PATCH 24/38] Fix bug about same x check - #181 --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 04fdab1..ca882f1 100644 --- a/c3.js +++ b/c3.js @@ -1903,7 +1903,7 @@ return closest; } function filterSameX(targets, x) { - return d3.merge(targets.map(function (t) { return t.values; })).filter(function (v) { return v.x === x; }); + return d3.merge(targets.map(function (t) { return t.values; })).filter(function (v) { return v.x - x === 0; }); } function getPathBox(path) { diff --git a/c3.min.js b/c3.min.js index 789e8a8..e8bd1ea 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?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||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){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=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),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?yh=b:"y2"===a?Hh=b:"x"===a&&(th=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",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"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?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/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(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.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 xf.max(Object.keys(i).map(function(a){return xf.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?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.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=vd(o,p),j=ac(kg.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&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.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 Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh: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||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?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?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[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)}),yf.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=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(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 Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.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++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),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&&yf.data.targets[0].values[a-1]?yf.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(yf.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(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(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)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 bh&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;eQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?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||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){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=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),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?yh=b:"y2"===a?Hh=b:"x"===a&&(th=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",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"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?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/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(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.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 xf.max(Object.keys(i).map(function(a){return xf.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?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.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=vd(o,p),j=ac(kg.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&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.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 Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh: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||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?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?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[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)}),yf.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=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(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 Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.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++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),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&&yf.data.targets[0].values[a-1]?yf.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(yf.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(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(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)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 bh&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(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=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else xf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),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",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),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",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(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(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.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=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!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=Ti?u:t,void(ah?(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=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(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=ij.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 Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-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",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"],{}),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"],{}),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio,a[g].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline")},yf.toPie=function(a){wf(a,"pie",{withTransform:!0}) },yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From b10fec74e21273be10a7eda0f31e926aa8d50a91 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 14:24:41 +0900 Subject: [PATCH 25/38] Fix overlap of grid on axis - #187 --- c3.js | 54 +++++++++++++++++++++++++++--------------------------- c3.min.js | 2 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/c3.js b/c3.js index b924849..3214410 100644 --- a/c3.js +++ b/c3.js @@ -2649,6 +2649,33 @@ /*-- Main Region --*/ + // Grids + grid = main.append('g') + .attr("clip-path", clipPath) + .attr('class', CLASS.grid); + + // X-Grid + if (__grid_x_show) { + grid.append("g").attr("class", CLASS.xgrids); + } + if (notEmpty(__grid_x_lines)) { + grid.append('g').attr("class", CLASS.xgridLines); + } + if (__point_focus_line_enabled) { + grid.append('g') + .attr("class", CLASS.xgridFocus) + .append('line') + .attr('class', CLASS.xgridFocus); + } + + // Y-Grid + if (__grid_y_show) { + grid.append('g').attr('class', CLASS.ygrids); + } + if (notEmpty(__grid_y_lines)) { + grid.append('g').attr('class', CLASS.ygridLines); + } + // Add Axis if (__axis_x_show) { main.append("g") @@ -2683,33 +2710,6 @@ .style("text-anchor", textAnchorForY2AxisLabel); } - // Grids - grid = main.append('g') - .attr("clip-path", clipPath) - .attr('class', CLASS.grid); - - // X-Grid - if (__grid_x_show) { - grid.append("g").attr("class", CLASS.xgrids); - } - if (notEmpty(__grid_x_lines)) { - grid.append('g').attr("class", CLASS.xgridLines); - } - if (__point_focus_line_enabled) { - grid.append('g') - .attr("class", CLASS.xgridFocus) - .append('line') - .attr('class', CLASS.xgridFocus); - } - - // Y-Grid - if (__grid_y_show) { - grid.append('g').attr('class', CLASS.ygrids); - } - if (notEmpty(__grid_y_lines)) { - grid.append('g').attr('class', CLASS.ygridLines); - } - // Regions main.append('g') .attr("clip-path", clipPath) diff --git a/c3.min.js b/c3.min.js index eb29e4c..b6f53b1 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?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||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){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=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),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?yh=b:"y2"===a?Hh=b:"x"===a&&(th=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",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"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?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/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(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.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 xf.max(Object.keys(i).map(function(a){return xf.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?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.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=vd(o,p),j=ac(kg.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&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.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 Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh: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||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?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?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[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)}),yf.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=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(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 Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.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++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),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&&yf.data.targets[0].values[a-1]?yf.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(yf.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(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(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)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 bh&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;eQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?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||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){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=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),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?yh=b:"y2"===a?Hh=b:"x"===a&&(th=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",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"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?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/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(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.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 xf.max(Object.keys(i).map(function(a){return xf.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?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.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=vd(o,p),j=ac(kg.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&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.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 Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh: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||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?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?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[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)}),yf.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=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(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 Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.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++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),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&&yf.data.targets[0].values[a-1]?yf.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(yf.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(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(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)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 bh&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(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=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else xf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),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",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),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",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(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(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.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=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!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=Ti?u:t,void(ah?(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=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(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=ij.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 Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-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",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"],{}),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"],{}),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi: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+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") },yf.toPie=function(a){wf(a,"pie",{withTransform:!0})},yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From fe21f1e7c4a7254e675e051b1b7134e47c18889c Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 15:20:21 +0900 Subject: [PATCH 26/38] Fix bar stack - #192 --- c3.js | 14 +++++++------- c3.min.js | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/c3.js b/c3.js index 3214410..b19d548 100644 --- a/c3.js +++ b/c3.js @@ -193,7 +193,7 @@ __axis_y_label = getConfig(['axis', 'y', 'label'], {}), __axis_y_inner = getConfig(['axis', 'y', 'inner'], false), __axis_y_tick_format = getConfig(['axis', 'y', 'tick', 'format']), - __axis_y_padding = getConfig(['axis', 'y', 'padding'], {}), + __axis_y_padding = getConfig(['axis', 'y', 'padding']), __axis_y_ticks = getConfig(['axis', 'y', 'ticks'], 10), __axis_y2_show = getConfig(['axis', 'y2', 'show'], false), __axis_y2_max = getConfig(['axis', 'y2', 'max']), @@ -202,7 +202,7 @@ __axis_y2_label = getConfig(['axis', 'y2', 'label'], {}), __axis_y2_inner = getConfig(['axis', 'y2', 'inner'], false), __axis_y2_tick_format = getConfig(['axis', 'y2', 'tick', 'format']), - __axis_y2_padding = getConfig(['axis', 'y2', 'padding'], {}), + __axis_y2_padding = getConfig(['axis', 'y2', 'padding']), __axis_y2_ticks = getConfig(['axis', 'y2', 'ticks'], 10); // grid @@ -1781,7 +1781,7 @@ } function getDataLabelWidth(min, max) { var widths = [], paddingCoef = 1.3; - d3.select('svg').selectAll('.dummy') + selectChart.select('svg').selectAll('.dummy') .data([min, max]) .enter().append('text') .text(function (d) { return d; }) @@ -2408,17 +2408,17 @@ function generateGetBarPoints(barIndices, isSub) { var barTargetsNum = barIndices.__max__ + 1, barW = getBarW(xAxis, barTargetsNum), - x = getBarX(barW, barTargetsNum, barIndices, !!isSub), - y = getBarY(!!isSub), + barX = getBarX(barW, barTargetsNum, barIndices, !!isSub), + barY = getBarY(!!isSub), barOffset = getBarOffset(barIndices, !!isSub), yScale = isSub ? getSubYScale : getYScale; return function (d, i) { var y0 = yScale(d.id)(0), offset = barOffset(d, i) || y0, // offset is for stacked bar chart - posX = x(d), posY = y(d); + posX = barX(d), posY = barY(d); // fix posY not to overflow opposite quadrant if (__axis_rotated) { - if ((d.value > 0 && posY < offset) || (d.value < 0 && posY > offset)) { posY = offset; } + if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; } } // 4 points that make a bar return [ diff --git a/c3.min.js b/c3.min.js index b6f53b1..bf1e359 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?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||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){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=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),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?yh=b:"y2"===a?Hh=b:"x"===a&&(th=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",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"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?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/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(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.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 xf.max(Object.keys(i).map(function(a){return xf.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?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.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=vd(o,p),j=ac(kg.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&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.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 Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh: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||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?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?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[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)}),yf.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=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(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 Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.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++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),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&&yf.data.targets[0].values[a-1]?yf.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(yf.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(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(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)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 bh&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(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=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else xf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),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",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),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",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(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(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.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=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!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=Ti?u:t,void(ah?(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=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(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=ij.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 Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-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",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"],{}),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"],{}),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi: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+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") +!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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?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||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){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=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]);return b/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),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?yh=b:"y2"===a?Hh=b:"x"===a&&(th=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",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"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?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/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(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.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 xf.max(Object.keys(i).map(function(a){return xf.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?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.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=vd(o,p),j=ac(kg.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&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.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 Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh: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||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?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?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[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)}),yf.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=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(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 Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.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++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),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&&yf.data.targets[0].values[a-1]?yf.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(yf.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(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(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)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 bh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(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=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else xf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),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",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),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",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(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(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.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=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!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=Ti?u:t,void(ah?(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=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(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=ij.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 Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-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",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"]),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"]),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi: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+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") },yf.toPie=function(a){wf(a,"pie",{withTransform:!0})},yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 4679fda580b17fd995f33d0a029a37fb70d7e46a Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 15:53:07 +0900 Subject: [PATCH 27/38] Fix sample --- htdocs/samples/simple.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/samples/simple.html b/htdocs/samples/simple.html index 31918eb..dc83518 100644 --- a/htdocs/samples/simple.html +++ b/htdocs/samples/simple.html @@ -6,7 +6,7 @@
- + + + + + From fdbfc05e6a27ddf3736461ac8b6b31eae96b3c86 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 16:12:38 +0900 Subject: [PATCH 30/38] Fix global x tick culling - #186 --- c3.js | 4 ++-- c3.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index 349f144..e3a8be3 100644 --- a/c3.js +++ b/c3.js @@ -3238,14 +3238,14 @@ break; } } - d3.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) { + svg.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) { var index = tickValues.indexOf(e); if (index >= 0) { d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block'); } }); } else { - d3.selectAll('.' + CLASS.axisX + ' .tick text').style('display', 'block'); + svg.selectAll('.' + CLASS.axisX + ' .tick text').style('display', 'block'); } } diff --git a/c3.min.js b/c3.min.js index d9d7633..9bc9bc2 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?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||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),0===c?bh?Sf:Qf:(d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){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=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]),c=b?b:bh?Sf:Qf;return c/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),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?yh=b:"y2"===a?Hh=b:"x"===a&&(th=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",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"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?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/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(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.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 xf.max(Object.keys(i).map(function(a){return xf.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?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.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=vd(o,p),j=ac(kg.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&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.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 Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh: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=Ai?new Date(.5*c.getTime()):-.5,d=Ai?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?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?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[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)}),yf.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=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(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 Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.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++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),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&&yf.data.targets[0].values[a-1]?yf.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(yf.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(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(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)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 bh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(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=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else xf.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),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",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),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",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(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(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.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=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!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=Ti?u:t,void(ah?(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=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(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=ij.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 Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-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",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"]),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"]),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi: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+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") +}jj.html(qi(yf.data.targets.map(function(a){return pc(a.values[si])}),$(),wd(ee(yf.data.targets)),Ji)),jj.style("top",ti.top).style("left",ti.left).style("display","block")}null==a.onresize&&(a.onresize=ef()),a.onresize.add&&(a.onresize.add(Kf),a.onresize.add(function(){gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Lf))}function Xe(a){a.append("rect").attr("class",fd).style("cursor",Jg&&Kg?"pointer":null).on("mouseover",function(a,b){if(!Ei&&!ee(yf.data.targets)){var c,d,e=yf.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(xg).length>0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(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=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else ej.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),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",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),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",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(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(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.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=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!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=Ti?u:t,void(ah?(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=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(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=ij.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 Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-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",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"]),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"]),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi: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+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") },yf.toPie=function(a){wf(a,"pie",{withTransform:!0})},yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 9516a9a99bd2c5f0a6b09c22006f668823d2f72f Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 16:13:24 +0900 Subject: [PATCH 31/38] Add samples --- htdocs/samples/axes_x_tick_culling.html | 39 +++++++++++++++++++++++++ htdocs/samples/grids.html | 32 ++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 htdocs/samples/axes_x_tick_culling.html create mode 100644 htdocs/samples/grids.html diff --git a/htdocs/samples/axes_x_tick_culling.html b/htdocs/samples/axes_x_tick_culling.html new file mode 100644 index 0000000..f0f54ca --- /dev/null +++ b/htdocs/samples/axes_x_tick_culling.html @@ -0,0 +1,39 @@ + + + + + +
+ + + + + + diff --git a/htdocs/samples/grids.html b/htdocs/samples/grids.html new file mode 100644 index 0000000..04c06da --- /dev/null +++ b/htdocs/samples/grids.html @@ -0,0 +1,32 @@ + + + + + +
+ + + + + + From 271ddb556983f7950c6bb32d049828678835a182 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 1 May 2014 16:36:55 +0900 Subject: [PATCH 32/38] Refactor clip path --- c3.js | 25 ++++--------------------- c3.min.js | 2 +- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/c3.js b/c3.js index e3a8be3..9b0bbeb 100644 --- a/c3.js +++ b/c3.js @@ -2602,32 +2602,15 @@ // Define svgs svg = selectChart.append("svg") - .attr("width", width + margin.left + margin.right) - .attr("height", height + margin.top + margin.bottom) .on('mouseenter', __onenter) .on('mouseleave', __onleave); // Define defs defs = svg.append("defs"); - defs.append("clipPath") - .attr("id", clipId) - .append("rect") - .attr("width", width) - .attr("height", height); - defs.append("clipPath") - .attr("id", clipIdForXAxis) - .append("rect") - .attr("x", getXAxisClipX) - .attr("y", getXAxisClipY) - .attr("width", getXAxisClipWidth) - .attr("height", getXAxisClipHeight); - defs.append("clipPath") - .attr("id", clipIdForYAxis) - .append("rect") - .attr("x", getYAxisClipX) - .attr("y", getYAxisClipY) - .attr("width", getYAxisClipWidth) - .attr("height", getYAxisClipHeight); + defs.append("clipPath").attr("id", clipId).append("rect"); + defs.append("clipPath").attr("id", clipIdForXAxis).append("rect"); + defs.append("clipPath").attr("id", clipIdForYAxis).append("rect"); + updateSvgSize(); // Define regions main = svg.append("g").attr("transform", translate.main); diff --git a/c3.min.js b/c3.min.js index 9bc9bc2..77cbfda 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?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||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),0===c?bh?Sf:Qf:(d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){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=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]),c=b?b:bh?Sf:Qf;return c/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),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?yh=b:"y2"===a?Hh=b:"x"===a&&(th=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",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"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?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/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(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.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 xf.max(Object.keys(i).map(function(a){return xf.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?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.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=vd(o,p),j=ac(kg.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&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.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 Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh: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=Ai?new Date(.5*c.getTime()):-.5,d=Ai?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?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?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[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)}),yf.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=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(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 Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.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++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),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&&yf.data.targets[0].values[a-1]?yf.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(yf.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(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(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)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 bh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").attr("width",Qf+Nf.left+Nf.right).attr("height",Sf+Nf.top+Nf.bottom).on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect").attr("width",Qf).attr("height",Sf),fj.append("clipPath").attr("id",vi).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),fj.append("clipPath").attr("id",wi).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;eQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?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||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),0===c?bh?Sf:Qf:(d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){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=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]),c=b?b:bh?Sf:Qf;return c/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),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?yh=b:"y2"===a?Hh=b:"x"===a&&(th=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",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"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?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/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(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.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 xf.max(Object.keys(i).map(function(a){return xf.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?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.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=vd(o,p),j=ac(kg.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&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.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 Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh: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=Ai?new Date(.5*c.getTime()):-.5,d=Ai?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?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?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[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)}),yf.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=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(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 Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.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++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),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&&yf.data.targets[0].values[a-1]?yf.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(yf.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(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(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)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 bh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect"),fj.append("clipPath").attr("id",vi).append("rect"),fj.append("clipPath").attr("id",wi).append("rect"),ff(),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(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=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else ej.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),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",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),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",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(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(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.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=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!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=Ti?u:t,void(ah?(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=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(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=ij.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 Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-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",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"]),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"]),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi: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+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") },yf.toPie=function(a){wf(a,"pie",{withTransform:!0})},yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From 0bbdad66d201bfb6b9697de4bd1601e5904a2260 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 10:10:48 +0900 Subject: [PATCH 33/38] Modify structure of element and enable selection of pie - #158 --- c3.js | 256 +++++++++++++++++++++++++++++++----------------------- c3.min.js | 6 +- 2 files changed, 150 insertions(+), 112 deletions(-) diff --git a/c3.js b/c3.js index 9b0bbeb..ff845e5 100644 --- a/c3.js +++ b/c3.js @@ -33,12 +33,15 @@ 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', @@ -1738,13 +1741,16 @@ function classTexts(d) { return generateClass(CLASS.texts, d.id); } function classShape(d, i) { return generateClass(CLASS.shape, i); } function classShapes(d) { return generateClass(CLASS.shapes, d.id); } - function classLine(d) { return classShapes(d) + generateClass(CLASS.line, d.id); } + function classLine(d) { return classShape(d) + generateClass(CLASS.line, d.id); } + function classLines(d) { return classShapes(d) + generateClass(CLASS.lines, d.id); } function classCircle(d, i) { return classShape(d, i) + generateClass(CLASS.circle, i); } function classCircles(d) { return classShapes(d) + generateClass(CLASS.circles, d.id); } function classBar(d, i) { return classShape(d, i) + generateClass(CLASS.bar, i); } function classBars(d) { return classShapes(d) + generateClass(CLASS.bars, d.id); } - function classArc(d) { return classShapes(d.data) + generateClass(CLASS.arc, d.data.id); } - function classArea(d) { return classShapes(d) + generateClass(CLASS.area, d.id); } + function classArc(d) { return classShape(d.data) + generateClass(CLASS.arc, d.data.id); } + function classArcs(d) { return classShapes(d.data) + generateClass(CLASS.arcs, d.data.id); } + function classArea(d) { return classShape(d) + generateClass(CLASS.area, d.id); } + function classAreas(d) { return classShapes(d) + generateClass(CLASS.areas, d.id); } function classRegion(d, i) { return generateClass(CLASS.region, i) + ' ' + ('class' in d ? d.class : ''); } function classEvent(d, i) { return generateClass(CLASS.eventRect, i); } function classTarget(id) { @@ -2130,10 +2136,13 @@ function isArcType(d) { return isPieType(d) || isDonutType(d); } - /* not used function lineData(d) { - return isLineType(d) ? d.values : []; + return isLineType(d) ? [d] : []; + } + function arcData(d) { + return isArcType(d.data) ? [d] : []; } + /* not used function scatterData(d) { return isScatterType(d) ? d.values : []; } @@ -2270,7 +2279,7 @@ function selectBar(target, d) { __data_onselected(d, target.node()); - target.transition().duration(100).style("fill", function () { return d3.rgb(color(d)).darker(1); }); + target.transition().duration(100).style("fill", function () { return d3.rgb(color(d)).brighter(0.75); }); } function unselectBar(target, d) { __data_onunselected(d, target.node()); @@ -2279,6 +2288,9 @@ function toggleBar(selected, target, d, i) { selected ? selectBar(target, d, i) : unselectBar(target, d, i); } + function toggleArc(selected, target, d, i) { + toggleBar(selected, target, d.data, i); + } function filterRemoveNull(data) { return data.filter(function (d) { return isValue(d.value); }); @@ -3026,17 +3038,20 @@ .call(zoom).on("dblclick.zoom", null); } - function toggleShape(target, d, i) { - var shape = d3.select(target), - isSelected = shape.classed(CLASS.SELECTED); - var isWithin = false, toggle; - if (target.nodeName === 'circle') { - isWithin = isWithinCircle(target, pointSelectR(d) * 1.5); + function toggleShape(that, d, i) { + var shape = d3.select(that), isSelected = shape.classed(CLASS.SELECTED), isWithin, toggle; + if (that.nodeName === 'circle') { + isWithin = isWithinCircle(that, pointSelectR(d) * 1.5); toggle = togglePoint; } - else if (target.nodeName === 'path') { - isWithin = isWithinBar(target); - toggle = toggleBar; + else if (that.nodeName === 'path') { + if (shape.classed(CLASS.bar)) { + isWithin = isWithinBar(that); + toggle = toggleBar; + } else { // would be arc + isWithin = true; + toggle = toggleArc; + } } if (__data_selection_grouped || isWithin) { if (__data_selection_enabled && __data_selection_isselectable(d)) { @@ -3049,7 +3064,7 @@ shape.classed(CLASS.SELECTED, !isSelected); toggle(!isSelected, shape, d, i); } - __data_onclick(d, target); + __data_onclick(d, that); } } @@ -3133,7 +3148,7 @@ function redraw(options) { var xaxis, subxaxis, yaxis, y2axis, xgrid, xgridData, xgridLines, xgridLine, ygrid, ygridLines, ygridLine; - var mainCircle, mainBar, mainRegion, mainText, contextBar, eventRect, eventRectUpdate; + var mainLine, mainArea, mainCircle, mainBar, mainArc, mainRegion, mainText, contextLine, contextBar, eventRect, eventRectUpdate; var barIndices = getBarIndices(), maxDataCountTarget; var rectX, rectW; var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; @@ -3380,11 +3395,9 @@ mainBar = main.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar) .data(barData); mainBar.enter().append('path') - .attr('d', drawBar) + .attr("class", classBar) .style("stroke", 'none') - .style("opacity", 0) - .style("fill", function (d) { return color(d); }) - .attr("class", classBar); + .style("fill", color); mainBar .style("opacity", initialOpacity) .transition().duration(duration) @@ -3394,41 +3407,40 @@ .style('opacity', 0) .remove(); - mainText = main.selectAll('.' + CLASS.texts).selectAll('.' + CLASS.text) - .data(barOrLineData); - mainText.enter().append('text') - .attr("class", classText) - .attr('text-anchor', function (d) { return __axis_rotated ? (d.value < 0 ? 'end' : 'start') : 'middle'; }) - .style("stroke", 'none') - .style("fill-opacity", 0); - mainText - .text(function (d) { return formatByAxisId(d.id)(d.value); }) - .style("fill-opacity", initialOpacityForText) - .transition().duration(duration) - .attr('x', xForText) - .attr('y', yForText) - .style("fill-opacity", opacityForText); - mainText.exit() - .transition().duration(durationForExit) - .style('fill-opacity', 0) - .remove(); - // lines and cricles - main.selectAll('.' + CLASS.line) + mainLine = main.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line) + .data(lineData); + mainLine.enter().append('path') + .attr('class', classLine) + .style("stroke", color); + mainLine .style("opacity", initialOpacity) .transition().duration(duration) .attr("d", lineOnMain) .style("opacity", 1); - main.selectAll('.' + CLASS.area) + mainLine.exit().transition().duration(durationForExit) + .style('opacity', 0) + .remove(); + + mainArea = main.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area) + .data(lineData); + mainArea.enter().append('path') + .attr("class", classArea) + .style("fill", color) + .style("opacity", function () { orgAreaOpacity = +d3.select(this).style('opacity'); return 0; }); + mainArea .style("opacity", 0) .transition().duration(duration) .attr("d", areaOnMain) .style("opacity", orgAreaOpacity); + mainArea.exit().transition().duration(durationForExit) + .style('opacity', 0) + .remove(); + mainCircle = main.selectAll('.' + CLASS.circles).selectAll('.' + CLASS.circle) .data(lineOrScatterData); mainCircle.enter().append("circle") .attr("class", classCircle) - .style('opacity', 0) .attr("r", pointR); mainCircle .style("opacity", initialOpacity) @@ -3438,10 +3450,74 @@ .attr("cy", __axis_rotated ? circleX : circleY); mainCircle.exit().remove(); + mainText = main.selectAll('.' + CLASS.texts).selectAll('.' + CLASS.text) + .data(barOrLineData); + mainText.enter().append('text') + .attr("class", classText) + .attr('text-anchor', function (d) { return __axis_rotated ? (d.value < 0 ? 'end' : 'start') : 'middle'; }) + .style("stroke", 'none') + .style("fill-opacity", 0); + mainText + .text(function (d) { return formatByAxisId(d.id)(d.value); }) + .style("fill-opacity", initialOpacityForText) + .transition().duration(duration) + .attr('x', xForText) + .attr('y', yForText) + .style("fill-opacity", opacityForText); + mainText.exit() + .transition().duration(durationForExit) + .style('fill-opacity', 0) + .remove(); + // arc - main.each(function () { transiting = true; }).selectAll('.' + CLASS.chartArc).select('.' + CLASS.arc) + mainArc = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arc) + .data(arcData); + mainArc.enter().append('path') + .attr("class", classArc) + .style("fill", function (d) { return color(d.data); }) + .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }) + .style("opacity", 0) + .each(function (d) { this._current = d; }) + .on('mouseover', function (d, i) { + var updated, arcData, callback; + if (transiting) { // skip while transiting + return; + } + updated = updateAngle(d); + arcData = convertToArcData(updated); + callback = getArcOnMouseOver(); + // transitions + expandArc(updated.data.id); + toggleFocusLegend(updated.data.id, true); + callback(arcData, i); + }) + .on('mousemove', function (d) { + var updated = updateAngle(d), arcData = convertToArcData(updated), selectedData = [arcData]; + showTooltip(selectedData, d3.mouse(this)); + }) + .on('mouseout', function (d, i) { + var updated, arcData, callback; + if (transiting) { // skip while transiting + return; + } + updated = updateAngle(d); + arcData = convertToArcData(updated); + callback = getArcOnMouseOut(); + // transitions + unexpandArc(updated.data.id); + revertLegend(); + hideTooltip(); + callback(arcData, i); + }) + .on('click', function (d, i) { + var updated = updateAngle(d), arcData = convertToArcData(updated), callback = getArcOnClick(); + toggleShape(this, d, i); + callback(arcData, i); + }); + mainArc .attr("transform", withTransform ? "scale(0)" : "") .style("opacity", function (d) { return d === this._current ? 0 : 1; }) + .each(function () { transiting = true; }) .transition().duration(duration) .attrTween("d", function (d) { var updated = updateAngle(d), interpolate; @@ -3465,6 +3541,9 @@ .call(endall, function () { transiting = false; }); + mainArc.exit().transition().duration(durationForExit) + .style('opacity', 0) + .remove(); main.selectAll('.' + CLASS.chartArc).select('text') .attr("transform", transformForArcLabel) .style("opacity", 0) @@ -3498,10 +3577,9 @@ contextBar = context.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar) .data(barData); contextBar.enter().append('path') - .attr('d', drawBarOnSub) + .attr("class", classBar) .style("stroke", 'none') - .style("fill", function (d) { return color(d); }) - .attr("class", classBar); + .style("fill", color); contextBar .style("opacity", initialOpacity) .transition().duration(duration) @@ -3511,11 +3589,19 @@ .style('opacity', 0) .remove(); // lines - context.selectAll('.' + CLASS.line) + contextLine = context.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line) + .data(lineData); + contextLine.enter().append('path') + .attr('class', classLine) + .style('stroke', color); + contextLine .style("opacity", initialOpacity) .transition().duration(duration) .attr("d", lineOnSub) .style('opacity', 1); + contextLine.exit().transition().duration(duration) + .style('opacity', 0) + .remove(); } } @@ -3707,34 +3793,28 @@ // Bars for each data mainBarEnter.append('g') .attr("class", classBars) - .style("stroke", "none") .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }); //-- Line --// - mainLineUpdate = main.select('.' + CLASS.chartLines) - .selectAll('.' + CLASS.chartLine) + mainLineUpdate = main.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine) .data(targets) - .attr('class', classChartLine); + .attr('class', classChartLine); mainLineEnter = mainLineUpdate.enter().append('g') .attr('class', classChartLine) .style('opacity', 0) .style("pointer-events", "none"); // Lines for each data - mainLineEnter.append("path") - .attr("class", classLine) - .style("opacity", 0) - .style("stroke", function (d) { return color(d); }); + mainLineEnter.append('g') + .attr("class", classLines); // Areas - mainLineEnter.append("path") - .attr("class", classArea) - .style("opacity", function () { orgAreaOpacity = +d3.select(this).style('opacity'); return 0; }) - .style("fill", function (d) { return color(d); }); + mainLineEnter.append('g') + .attr('class', classAreas); // Circles for each data point on lines mainLineEnter.append('g') .attr("class", function (d) { return generateClass(CLASS.selectedCircles, d.id); }); mainLineEnter.append('g') .attr("class", classCircles) - .style("fill", function (d) { return color(d); }) + .style("fill", color) .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }); // Update date for selected circles targets.forEach(function (t) { @@ -3751,47 +3831,8 @@ .attr("class", classChartArc); mainPieEnter = mainPieUpdate.enter().append("g") .attr("class", classChartArc); - mainPieEnter.append("path") - .attr("class", classArc) - .style("opacity", 0) - .style("fill", function (d) { return color(d.data); }) - .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }) - .each(function (d) { this._current = d; }) - .on('mouseover', function (d, i) { - var updated, arcData, callback; - if (transiting) { // skip while transiting - return; - } - updated = updateAngle(d); - arcData = convertToArcData(updated); - callback = getArcOnMouseOver(); - // transitions - expandArc(updated.data.id); - toggleFocusLegend(updated.data.id, true); - callback(arcData, i); - }) - .on('mousemove', function (d) { - var updated = updateAngle(d), arcData = convertToArcData(updated), selectedData = [arcData]; - showTooltip(selectedData, d3.mouse(this)); - }) - .on('mouseout', function (d, i) { - var updated, arcData, callback; - if (transiting) { // skip while transiting - return; - } - updated = updateAngle(d); - arcData = convertToArcData(updated); - callback = getArcOnMouseOut(); - // transitions - unexpandArc(updated.data.id); - revertLegend(); - hideTooltip(); - callback(arcData, i); - }) - .on('click', function (d, i) { - var updated = updateAngle(d), arcData = convertToArcData(updated), callback = getArcOnClick(); - callback(arcData, i); - }); + mainPieEnter.append('g') + .attr('class', classArcs); mainPieEnter.append("text") .attr("dy", ".35em") .style("opacity", 0) @@ -3812,8 +3853,7 @@ .attr('class', classChartBar); // Bars for each data contextBarEnter.append('g') - .attr("class", classBars) - .style("fill", function (d) { return color(d); }); + .attr("class", classBars); //-- Line --// contextLineUpdate = context.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine) @@ -3823,10 +3863,8 @@ .style('opacity', 0) .attr('class', classChartLine); // Lines for each data - contextLineEnter.append("path") - .attr("class", classLine) - .style("opacity", 0) - .style("stroke", function (d) { return color(d); }); + contextLineEnter.append('g') + .attr("class", classLines); } /*-- Show --*/ @@ -4292,7 +4330,7 @@ return d3.merge( main.selectAll('.' + CLASS.shapes + getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS.shape) .filter(function () { return d3.select(this).classed(CLASS.SELECTED); }) - .map(function (d) { return d.map(function (_d) { return _d.__data__; }); }) + .map(function (d) { return d.map(function (d) { var data = d.__data__; return data.data ? data.data : data; }); }) ); }; diff --git a/c3.min.js b/c3.min.js index 77cbfda..4db0ab2 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.33"},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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",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;cQf&&(Qf=0),0>Sf&&(Sf=0),Rf=bh?Nf.left-Yi-Zi:Qf,Tf=bh?Sf:Vf-Of.top-Of.bottom,0>Rf&&(Rf=0),0>Tf&&(Tf=0),p(),Ti&&ee(yf.data.targets)&&(Pf.left=Qf/2+Xf)}function o(){gj.select("line."+f.xgridFocus).attr("x1",bh?0:-10).attr("x2",bh?Qf:-10).attr("y1",bh?-10:Nf.top).attr("y2",bh?-10:Sf)}function p(){Xf=Sf/2,Wf=.95*Xf,Yf=de(yf.data.targets)?.6*Wf:0}function q(){var a=bh?f.axisX:f.axisY,b=gj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=xf.select(Af).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Bf?Bf:x()}function s(){var a=Cf?Cf:y();return a>0?a:320}function t(){return ee(yf.data.targets)?0:Df?Df:bh?ch?v("x"):1:!uh||zh?1:v("y")}function u(){var a=1;return ee(yf.data.targets)?0:Ef?Ef:Ti?P()+(Dh&&!bh?v("y2"):a):Dh?Ih||bh?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||ch?"x"===a&&rh?rh:"y"!==a||uh?"y2"!==a||Dh?(jb(a).isInner?30:40)+("y2"===a?-10:0):$i:Xg&&!Ti?10:1:0}function x(){return+xf.select(Af).style("width").replace("px","")}function y(){return+xf.select(Af).style("height").replace("px","")}function z(a){return a?-5:-(Nf.left-1)}function A(a){return a?-20:-4}function B(){return z(!bh)}function C(){return A(!bh)}function D(){return z(bh)}function E(){return A(bh)}function F(a){return a?Qf+2+4:Nf.left+20}function G(a){return a?(rh?rh:0)+80:Sf+8}function H(){return F(!bh)}function I(){return G(!bh)}function J(){return F(bh)}function K(){return G(bh)}function L(){var a,b,c,d,e,f=Ac(yf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=jg(b.x)-jg(a.x),0===c?bh?Sf:Qf:(d=zc(),e=ae(yf.data.targets)?(d-(Bi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){Ui=a}function N(a){Vi=a}function O(a){Wi=a}function P(){return Xg?Ti?Vi*(Ui+1):Uf:0}function Q(){return Xg?Ti?Vf:Wi*(Ui+1):0}function R(){var a,b,c=!jg;bg=bh?1:0,cg=bh?Sf:Qf,dg=bh?0:Sf,eg=bh?Qf:1,fg=bg,gg=cg,hg=bh?0:Tf,ig=bh?Rf:1,jg=T(bg,cg,c?void 0:jg.domain(),function(){return pg.tickOffset()}),kg=U(dg,eg,c?void 0:kg.domain()),lg=U(dg,eg,c?void 0:lg.domain()),mg=T(bg,cg,lj,function(a){return a%1?0:sg.tickOffset()}),ng=U(hg,ig,c?void 0:ng.domain()),og=U(hg,ig,c?void 0:og.domain()),a=$(),b=mh?mh:c?void 0:pg.tickValues(),pg=X(jg,Oi,a,b),sg=X(mg,Ri,a,b),qg=Y(kg,Pi,Ah,Ch),rg=Y(lg,Qi,Jh,Lh),c||(_i.scale(mg),Ff&&dj.scale(jg)),S()}function S(){Zf=Gb(),$f=Hb(),_f=Hb(.98)}function T(a,b,d,e){var f=(Ai?xf.time.scale():xf.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Bi){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=xf.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?lg:kg}function W(a){return"y2"===Z(a)?og:ng}function X(a,b,c,d){var e=(Bi?Eb():xf.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Bi?(e.tickCentered(gh),ve(ih)&&(ih=!1)):e.tickOffset=function(){var a=Bc(yf.data.targets),b=jg(a[1])-jg(a[0]),c=b?b:bh?Sf:Qf;return c/zc()/2},Bi&&e.categories(fh),e}function Y(a,b,c,d){return xf.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Ag?Ag[a]:"y"}function $(){var a=Ai?Li:Bi?Tc:function(a){return 0>a?a.toFixed(0):a};return hh&&("function"==typeof hh?a=hh:Ai&&(a=function(a){return a?Ki(hh)(a):""})),a}function _(a){var b;return"y"===a?b=yh:"y2"===a?b=Hh:"x"===a&&(b=th),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?yh=b:"y2"===a?Hh=b:"x"===a&&(th=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",bh?"inner-top":"inner-right")}function hb(){return fb("y",bh?"inner-right":"inner-top")}function ib(){return fb("y2",bh?"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?Qf/2:Qf:b.isBottom?-Sf:b.isMiddle?-Sf/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(!bh,gb())}function rb(){return nb(bh,hb())}function sb(){return nb(bh,ib())}function tb(){return ob(!bh,gb())}function ub(){return ob(bh,hb())}function vb(){return ob(bh,ib())}function wb(){var a=gb();return bh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":rh?rh-10:"3em"}function xb(){var a=hb();return bh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return bh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!bh,gb())}function Ab(){return pb(bh,hb())}function Bb(){return pb(bh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return xf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){gj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),gj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),gj.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 xf.min(Object.keys(i).map(function(a){return xf.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(zg.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 xf.max(Object.keys(i).map(function(a){return xf.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?Fh:wh,n="y2"===c?Eh:vh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Gh:xh,r=ud()&&bh;return 0===l.length?"y2"===c?lg.domain():kg.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=vd(o,p),j=ac(kg.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&&Bh&&(f=b(Bh.top)?Bh.top:e,g=b(Bh.bottom)?Bh.bottom:e),"y2"===c&&Kh&&(f=b(Kh.top)?Kh.top:e,g=b(Kh.bottom)?Kh.bottom:e),ae(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return ph?Ai?re(ph):ph:xf.min(a,function(a){return xf.min(a.values,function(a){return a.x})})}function Zb(a){return oh?Ai?re(oh):oh:xf.max(a,function(a){return xf.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 Bi?d=0:ae(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof qh&&we(qh)?(e=b(qh.left)?qh.left:d,f=b(qh.right)?qh.right:d):e=f="number"==typeof qh?qh: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=Ai?new Date(.5*c.getTime()):-.5,d=Ai?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ai?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ai?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?kg:lg;return b="y"===a.axis||"y2"===a.axis?bh?Sf:"start"in a?d(a.start):Sf:bh?"end"in a?jg(Ai?re(a.end):a.end):Sf:Sf,c>b?0:b-c}function ic(a){return tg&&a===tg||we(ug)&&xe(ug,a)}function jc(a){return!ic(a)}function kc(a){return tg?tg:we(ug)?ug[a]:null}function lc(a,b){var c,d=b&&we(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=yf.data.xs[b])}),c}function mc(a,b){return a in yf.data.xs&&yf.data.xs[a]&&yf.data.xs[a][b]?yf.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){ug[b]=a[b]})}function oc(a){return 1===xf.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=xg[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)}),yf.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=Ai?a?a instanceof Date?a:re(a):re(mc(c,d)):Ci&&!Bi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?yf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):tg?(d=Object.keys(yf.data.xs),yf.data.xs[c]=d.length>0?yf.data.xs[d[0]]:void 0):we(ug)&&(yf.data.xs[c]=lc(f,yf.data.targets)):yf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!yf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=wg(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 Ci&&Bi&&0===c&&g&&(0===e&&(fh=[]),fh.push(g)),("undefined"==typeof a[b]||yf.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++})}),Bg&&$d(Cc(c).filter(function(a){return!(a in Cg)}),Bg),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&&yf.data.targets[0].values[a-1]?yf.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(yf.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(Ai?new Date(i):i);j.push(e)}return Ai||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Mi=Mi.concat(a)}function Mc(a){Mi=Mi.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ni=Ni.concat(a)}function Oc(a){Ni=Ni.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(Gd(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Gd(a,g))),Jd(e,b)):Hd(a,b,f,g)}function Id(a,b){var c;return c=a.map(function(a){return Hd(a.values,b)}),Jd(c,b)}function Jd(a,b){var c,d;return a.forEach(function(a){var e=ye(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Kd(a,b){return xf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Ld(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 Md(){return Eg&&"desc"===Eg.toLowerCase()}function Nd(){return Eg&&"asc"===Eg.toLowerCase()}function Od(a){var b=Nd(),c=Md();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 Eg&&a.sort(Eg),a}function Pd(a,c){var d,e,f,g,h,i,j,k=ee(yf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ni&&(jj.html(qi(a,$(),wd(k),Ji)).style("display","block"),d=jj.property("offsetWidth"),e=jj.property("offsetHeight"),k?(g=Qf/2+c[0],i=Sf/2+c[1]+20):(bh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=jg(l[0].x)+20):(f=q(),g=f+t()+jg(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)),jj.style("top",i+"px").style("left",g+"px"))}function Qd(){jj.style("display","none")}function Rd(a){var c=a.filter(function(a){return a&&b(a.value)});ni&&(be(yf.data.targets)||ee(yf.data.targets)||gj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(bh?"y1":"x1",Cd).attr(bh?"y2":"x2",Cd))}function Sd(){gj.select("line."+f.xgridFocus).style("visibility","hidden")}function Td(a){return a.x||0===a.x?jg(a.x):null}function Ud(a){return V(a.id)(a.value)}function Vd(){var a,b,d={},e=0;return Ic(Fc(he)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Zd(a,b){return"number"==typeof Zh?Zh:b?2*a.tickOffset()*$h/b:0}function $d(a,b){Dc(a).forEach(function(a){nj[a]=b===Cg[a],Cg[a]=b})}function _d(a,b){var c=!1;return a.forEach(function(a){Cg[a.id]===b&&(c=!0),a.id in Cg||"line"!==b||(c=!0)}),c}function ae(a){return _d(a,"bar")}function be(a){return _d(a,"scatter")}function ce(a){return _d(a,"pie")}function de(a){return _d(a,"donut")}function ee(a){return ce(a)||de(a)}function fe(a){var b="string"==typeof a?a:a.id;return!(b in Cg)||"line"===Cg[b]||"spline"===Cg[b]||"area"===Cg[b]||"area-spline"===Cg[b]}function ge(a){var b="string"==typeof a?a:a.id;return"spline"===Cg[b]||"area-spline"===Cg[b]}function he(a){var b="string"==typeof a?a:a.id;return"bar"===Cg[b]}function ie(a){var b="string"==typeof a?a:a.id;return"scatter"===Cg[b]}function je(a){var b="string"==typeof a?a:a.id;return"pie"===Cg[b]}function ke(a){var b="string"==typeof a?a:a.id;return"donut"===Cg[b]}function le(a){return je(a)||ke(a)}function me(a){return he(a)?a.values:[]}function ne(a){return fe(a)||ie(a)?a.values:[]}function oe(a){return he(a)||fe(a)?a.values:[]}function pe(a){return ke(a)&&hi||je(a)&&bi}function qe(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?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 re(b){var c;try{c=vg?xf.time.format(vg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+vg)}return c}function se(a,b){var c=xf.mouse(a),d=xf.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 xe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ye(a,b){var c="y"===Z(a.id)?kg:lg,d=bh?1:0,e=bh?0:1;return Math.pow(jg(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function ze(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ae(a,b,c){Qg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Uc(f.selectedCircle,c)}).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud).attr("stroke",function(){return Ji(b)}).attr("r",1.4*Je(b)).transition().duration(100).attr("r",Je)}function Be(a,b,c){Rg(b,a.node()),gj.select("."+f.selectedCircles+ld(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Ce(a,b,c,d){a?Ae(b,c,d):Be(b,c,d)}function De(a,b){Qg(b,a.node()),a.transition().duration(100).style("fill",function(){return xf.rgb(Ji(b)).darker(1)})}function Ee(a,b){Rg(b,a.node()),a.transition().duration(100).style("fill",function(){return Ji(b)})}function Fe(a,b,c,d){a?De(b,c,d):Ee(b,c,d)}function Ge(a){return a.filter(function(a){return b(a.value)})}function He(a){return Sh?"function"==typeof Th?Th(a):Th:0}function Ie(a){return Vh?Wh?Wh:1.75*He(a):He(a)}function Je(a){return Xh?Xh:4*He(a)}function Ke(a,c){return(c?gj.selectAll("."+f.circles+ld(c)):gj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Le(a,b){Ke(a,b).classed(f.EXPANDED,!0).attr("r",Ie)}function Me(a){Ke(a).filter(function(){return xf.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",He)}function Ne(a){return gj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Oe(a){Ne(a).classed(f.EXPANDED,!0)}function Pe(a){Ne(a).classed(f.EXPANDED,!1)}function Qe(a,b){var c=Ue(a,b);return function(a,b){var d=c(a,b),e=bh?1:0,f=bh?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 Re(a,b){var c=Ue(a,!1),d=b?Se:Te;return function(a,b){return d(c(a,b),a,this)}}function Se(a,b){var c;return bh?(c=he(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Te(a,b,c){var d=c.getBoundingClientRect();return bh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:he(b)?-3:-6)}function Ue(a,b){var c=a.__max__+1,d=Zd(pg,c),e=Wd(d,c,a,!!b),f=Xd(!!b),g=Yd(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 bh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ve(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 We(b){var c,d,e;if(kj=xf.select(Af),kj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(kj.html("").classed("c3",!0),yf.data.xs={},yf.data.targets=vc(b),Ig&&Lc(Ig===!0?Cc(yf.data.targets):Ig),n(),R(),jg.domain(xf.extent(_b(yf.data.targets))),kg.domain(Xb(yf.data.targets,"y")),lg.domain(Xb(yf.data.targets,"y2")),mg.domain(jg.domain()),ng.domain(kg.domain()),og.domain(lg.domain()),lj=jg.domain(),_i.scale(mg),Ff&&dj.scale(jg),ej=kj.append("svg").on("mouseenter",If).on("mouseleave",Jf),fj=ej.append("defs"),fj.append("clipPath").attr("id",ui).append("rect"),fj.append("clipPath").attr("id",vi).append("rect"),fj.append("clipPath").attr("id",wi).append("rect"),ff(),gj=ej.append("g").attr("transform",Si.main),hj=ej.append("g").attr("transform",Si.context),ij=ej.append("g").attr("transform",Si.legend),Ug||hj.style("visibility","hidden"),Xg||(ij.style("visibility","hidden"),Ni=Cc(yf.data.targets)),jj=xf.select(Af).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),sf(Cc(yf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=gj.append("g").attr("clip-path",xi).attr("class",f.grid),Mh&&d.append("g").attr("class",f.xgrids),we(Oh)&&d.append("g").attr("class",f.xgridLines),Uh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Ph&&d.append("g").attr("class",f.ygrids),we(Qh)&&d.append("g").attr("class",f.ygridLines),ch&&gj.append("g").attr("class",f.axisX).attr("clip-path",yi).attr("transform",Si.x).append("text").attr("class",f.axisXLabel).attr("transform",bh?"rotate(-90)":"").style("text-anchor",zb),uh&&gj.append("g").attr("class",f.axisY).attr("clip-path",zi).attr("transform",Si.y).append("text").attr("class",f.axisYLabel).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Ab),Dh&&gj.append("g").attr("class",f.axisY2).attr("transform",Si.y2).append("text").attr("class",f.axisY2Label).attr("transform",bh?"":"rotate(-90)").style("text-anchor",Bb),gj.append("g").attr("clip-path",xi).attr("class",f.regions),gj.append("g").attr("clip-path",xi).attr("class",f.chart),c=gj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Ff?bh?"ns-resize":"ew-resize":null),gj.select("."+f.chart).append("g").attr("class",f.chartBars),gj.select("."+f.chart).append("g").attr("class",f.chartLines),gj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Si.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),gj.select("."+f.chart).append("g").attr("class",f.chartTexts),Ff&&gj.insert("rect",Hf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Qf).attr("height",Sf).style("opacity",0).style("cursor",bh?"ns-resize":"ew-resize").call(dj).on("dblclick.zoom",null),sh&&_i.extent("function"!=typeof sh?sh:sh(_b())),hj.append("g").attr("clip-path",xi).attr("class",f.chart),hj.select("."+f.chart).append("g").attr("class",f.chartBars),hj.select("."+f.chart).append("g").attr("class",f.chartLines),hj.append("g").attr("clip-path",xi).attr("class",f.brush).call(_i).selectAll("rect").attr(bh?"width":"height",bh?Rf:Tf),hj.append("g").attr("class",f.axisX).attr("transform",Si.subx).attr("clip-path",bh?"":yi),hf(yf.data.targets),bh?gj.select("."+f.axisX).style("opacity",0).call(pg):(gj.select("."+f.axisY).style("opacity",0).call(qg),gj.select("."+f.axisY2).style("opacity",0).call(rg)),n(),R(),ff(),m(!1),bf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),ri){if(Ai&&"string"==typeof si){for(si=re(si),e=0;e0){d=[];for(var g in xg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Ld(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Fe,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 _e(a){ee(yf.data.targets)||Jg&&(Di=a,gj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ei=!0,Sg())}function af(){ee(yf.data.targets)||Jg&&(gj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),gj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ei=!1,Tg())}function bf(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=Vd(),W=ee(yf.data.targets),X=Ic(yf.data.targets);if(a=d(a)?a:{},A=d(a.withY)?a.withY:!0,B=d(a.withSubchart)?a.withSubchart:!0,C=d(a.withTransition)?a.withTransition:!0,F=d(a.withTransform)?a.withTransform:!1,G=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,H=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,I=d(a.withLegend)?a.withLegend:!1,D=d(a.withTransitionForExit)?a.withTransitionForExit:C,E=d(a.withTransitionForAxis)?a.withTransitionForAxis:C,P=C?Mf:0,Q=D?P:0,R=E?P:0,c=gj.select("."+f.axisX).style("opacity",W?0:1),g=gj.select("."+f.axisY).style("opacity",W?0:1),h=gj.select("."+f.axisY2).style("opacity",W?0:1),e=hj.select("."+f.axisX).style("opacity",W?0:1),O={axisX:c.transition().duration(R),axisY:g.transition().duration(R),axisY2:h.transition().duration(R),axisSubX:e.transition().duration(R)},I&&Xg&&sf(Cc(yf.data.targets),a,O),Bi&&(0!==X.length&&H&&G||jg.domain([0,c.selectAll(".tick").size()])),X.length&&(H&&(jg.domain(xf.extent(_b(X))),lj=jg.domain(),Ff&&dj.scale(jg).updateScaleExtent(),mg.domain(jg.domain()),_i.scale(mg)),G&&(jg.domain(_i.empty()?lj:_i.extent()),Ff&&dj.scale(jg).updateScaleExtent()),mh||!lh&&!kh||(S=Kc(Jc(X),kh),pg.tickValues(S),sg.tickValues(S))),kg.domain(Xb(X,"y")),lg.domain(Xb(X,"y2")),O.axisX.call(pg),O.axisY.call(qg),O.axisY2.call(rg),O.axisSubX.call(sg),G&&X.length)if(ih&&S){for(T=1;T=0&&xf.select(this).style("display",b%U?"none":"block")})}else ej.selectAll("."+f.axisX+" .tick text").style("display","block");if(!bh&&nh&&eb(c,O.axisX,nh),J=Qe(V),M=Re(V,!0),N=Re(V,!1),Db(),ng.domain(kg.domain()),og.domain(lg.domain()),jj.style("display","none"),o(),gj.select("line."+f.xgridFocus).style("visibility","hidden"),Mh){if("year"===Nh){j=[];for(var Y=_b(),Z=Y[0].getFullYear(),$=Y[1].getFullYear(),_=Z;$>=_;_++)j.push(new Date(_+"-01-01 00:00:00"))}else j=jg.ticks(10);i=gj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",bh?0:function(a){return jg(a)-pg.tickOffset()}).attr("x2",bh?Qf:function(a){return jg(a)-pg.tickOffset()}).attr("y1",bh?function(a){return jg(a)-pg.tickOffset()}:Nf.top).attr("y2",bh?function(a){return jg(a)-pg.tickOffset()}:Sf).style("opacity",function(){return+xf.select(this).attr(bh?"y1":"x1")===(bh?Sf:0)?0:1}),i.exit().remove()}we(Oh)&&(k=gj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Oh),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",bh?"":"rotate(-90)").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(P).attr("x1",bh?0:Dd).attr("x2",bh?Qf:Dd).attr("y1",bh?Dd:Nf.top).attr("y2",bh?Dd:Sf).style("opacity",1),k.select("text").transition().duration(P).attr("x",bh?Qf:0).attr("y",Dd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(P).style("opacity",0).remove()),A&&Ph&&(m=gj.select("."+f.ygrids).selectAll("."+f.ygrid).data(kg.ticks(Rh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",bh?kg:0).attr("x2",bh?kg:Qf).attr("y1",bh?0:kg).attr("y2",bh?Sf:kg),m.exit().remove()),A&&we(Qh)&&(n=gj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Qh),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",bh?"rotate(-90)":"").attr("dx",bh?0:-Nf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(P).attr("x1",bh?Ed:0).attr("x2",bh?Ed:Qf).attr("y1",bh?0:Ed).attr("y2",bh?Sf:Ed).style("opacity",1),n.select("text").transition().duration(P).attr("x",bh?0:Qf).attr("y",Ed).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(P).style("opacity",0).remove()),s=gj.select("."+f.regions).selectAll("rect."+f.region).data(mi),s.enter().append("rect").style("fill-opacity",0),s.attr("class",ed).attr("x",ec).attr("y",fc).attr("width",gc).attr("height",hc).transition().duration(P).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(P).style("fill-opacity",0).remove(),r=gj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),r.enter().append("path").attr("d",J).style("stroke","none").style("opacity",0).style("fill",function(a){return Ji(a)}).attr("class",ad),r.style("opacity",qd).transition().duration(P).attr("d",J).style("opacity",1),r.exit().transition().duration(Q).style("opacity",0).remove(),t=gj.selectAll("."+f.texts).selectAll("."+f.text).data(oe),t.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return bh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),t.text(function(a){return Bd(a.id)(a.value)}).style("fill-opacity",rd).transition().duration(P).attr("x",M).attr("y",N).style("fill-opacity",td),t.exit().transition().duration(Q).style("fill-opacity",0).remove(),gj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",aj).style("opacity",1),gj.selectAll("."+f.area).style("opacity",0).transition().duration(P).attr("d",bj).style("opacity",mj),q=gj.selectAll("."+f.circles).selectAll("."+f.circle).data(ne),q.enter().append("circle").attr("class",$c).style("opacity",0).attr("r",He),q.style("opacity",qd).transition().duration(P).style("opacity",sd).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),q.exit().remove(),gj.each(function(){Hi=!0}).selectAll("."+f.chartArc).select("."+f.arc).attr("transform",F?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(P).attrTween("d",function(a){var b,c=Fb(a);return c?(b=xf.interpolate(this._current,c),this._current=b(0),function(a){return Ib(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",F?"scale(1)":"").style("opacity",1).call(ze,function(){Hi=!1}),gj.selectAll("."+f.chartArc).select("text").attr("transform",Jb).style("opacity",0).transition().duration(P).text(Mb).style("opacity",function(a){return Gc(a.data.id)&&le(a.data)?1:0}),gj.select("."+f.chartArcsTitle).style("opacity",de(yf.data.targets)?1:0),Ug&&(null!==xf.event&&"zoom"===xf.event.type&&_i.extent(jg.orgDomain()).update(),B&&(!bh&&nh&&eb(e,O.axisSubX,nh),_i.empty()||_i.extent(jg.orgDomain()).update(),K=Qe(V,!0),u=hj.selectAll("."+f.bars).selectAll("."+f.bar).data(me),u.enter().append("path").attr("d",K).style("stroke","none").style("fill",function(a){return Ji(a)}).attr("class",ad),u.style("opacity",qd).transition().duration(P).attr("d",K).style("opacity",1),u.exit().transition().duration(P).style("opacity",0).remove(),hj.selectAll("."+f.line).style("opacity",qd).transition().duration(P).attr("d",cj).style("opacity",1))),gj.selectAll("."+f.selectedCircles).filter(function(a){return he(a)}).selectAll("circle").remove(),gj.selectAll("."+f.selectedCircle).transition().duration(P).attr("cx",bh?Ud:Td).attr("cy",bh?Td:Ud),v=gj.select("."+f.eventRects),we(ug)&&!oc(ug)?(v.classed(f.eventRectsMultiple)||v.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),Ye(w.enter()),w.attr("x",0).attr("y",0).attr("width",Qf).attr("height",Sf)):(v.classed(f.eventRectsSingle)||v.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ci&&!Bi?(z=function(a,b){var c=xc(b),d=yc(b),e=yf.data.xs[a.id][b];return(jg(d?d:e+50)-jg(c?c:e-50))/2},y=function(a,b){var c=xc(b),d=yf.data.xs[a.id][b];return(jg(d)+jg(c?c:d-50))/2}):(z=L(),y=function(a){return jg(a.x)-z/2}),x=Ac(yf.data.targets),gj.select("."+f.eventRects).datum(x?x.values:[]),w=gj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Xe(w.enter()),w.attr("class",fd).attr("x",bh?0:y).attr("y",bh?y:0).attr("width",bh?Qf:z).attr("height",bh?z:Sf),w.exit().remove()),Cc(yf.data.targets).forEach(function(a){nj[a]=!0})}function cf(){bf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function df(){return"mousemove"===xf.event.sourceEvent.type&&dj.altDomain?(jg.domain(dj.altDomain),void dj.scale(jg).updateScaleExtent()):(Bi&&jg.orgDomain()[0]===lj[0]&&jg.domain([lj[0]-1e-10,jg.orgDomain()[1]]),bf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===xf.event.sourceEvent.type&&(Fi=!0)))}function ef(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ff(){ej.attr("width",Uf).attr("height",Vf),ej.select("#"+ui).select("rect").attr("width",Qf).attr("height",Sf),ej.select("#"+vi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),ej.select("#"+wi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),ej.select("."+f.zoomRect).attr("width",Qf).attr("height",Sf),kj.style("max-height",Vf+"px")}function gf(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(),ff(),m(a.withTransition),bf(a)}function hf(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=gj.select("."+f.chartTexts).selectAll("."+f.chartText).data(a).attr("class",hd),j=i.enter().append("g").attr("class",hd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Wc).style("fill",function(a){return Ji(a)}),e=gj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),d=e.enter().append("g").attr("class",jd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",bd).style("stroke","none").style("cursor",function(a){return Lg(a)?"pointer":null}),c=gj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),b=c.enter().append("g").attr("class",id).style("opacity",0).style("pointer-events","none"),b.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)}),b.append("path").attr("class",dd).style("opacity",function(){return mj=+xf.select(this).style("opacity"),0}).style("fill",function(a){return Ji(a)}),b.append("g").attr("class",function(a){return Uc(f.selectedCircles,a.id)}),b.append("g").attr("class",_c).style("fill",function(a){return Ji(a)}).style("cursor",function(a){return Lg(a)?"pointer":null}),a.forEach(function(a){gj.selectAll("."+f.selectedCircles+ld(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=gj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(ag(a)).attr("class",kd),g=h.enter().append("g").attr("class",kd),g.append("path").attr("class",cd).style("opacity",0).style("fill",function(a){return Ji(a.data)}).style("cursor",function(a){return Lg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),of(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Pd(d,xf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Hi||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),pf(),Qd(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Ug&&(n=hj.select("."+f.chartBars).selectAll("."+f.chartBar).data(a).attr("class",jd),m=n.enter().append("g").style("opacity",0).attr("class",jd),m.append("g").attr("class",bd).style("fill",function(a){return Ji(a)}),l=hj.select("."+f.chartLines).selectAll("."+f.chartLine).data(a).attr("class",id),k=l.enter().append("g").style("opacity",0).attr("class",id),k.append("path").attr("class",Zc).style("opacity",0).style("stroke",function(a){return Ji(a)})),ej.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Mf).style("opacity",1)}function jf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?$d(a.id,b.types[a.id]):$d(a.id,b.type)}),yf.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=Ti?j:i,l=Ti?Q():P();return d&&(w=0,C=0,t=0,u=0),Xg&&!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=Ti?u:t,void(ah?(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=ij.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Ti?(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=ij.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 Zg?Zg(a):yf.toggle(a)}).on("mouseover",function(a){xf.select(this).classed(f.legendItemFocused,!0),Hi||yf.focus(a),"function"==typeof $g&&$g(a)}).on("mouseout",function(a){xf.select(this).classed(f.legendItemFocused,!1),Hi||yf.revert(),"function"==typeof _g&&_g(a)}),o.append("text").text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Ti?h:-200).attr("y",Ti?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Ti?i:-200).attr("y",Ti?-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",function(a){return Ji(a)}).attr("x",Ti?h:-200).attr("y",Ti?-200:j).attr("width",10).attr("height",10),ij.selectAll("text").data(a).text(function(a){return d(xg[a])?xg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),ij.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),ij.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),ij.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=xf.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?mf(b):nf(b):Xi}),N(t),O(u),M(C),n(),R(),ff(),m(q,c)}function tf(a){return Ec(yf.data.targets,a.id)}function uf(a){return"data"in a&&Ec(yf.data.targets,a.data.id)}function vf(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 wf(a,b,c){var d=!ee(yf.data.targets);Hi=!1,$d(a,b),gf(c||{withTransitionForAxis:d})}var xf=a.d3?a.d3:a.require?a.require("d3"):void 0,yf={data:{},axis:{},legend:{}},zf={},Af=h(["bindto"],"#chart"),Bf=h(["size","width"]),Cf=h(["size","height"]),Df=h(["padding","left"],50),Ef=h(["padding","right"]),Ff=h(["zoom","enabled"],!1),Gf=h(["zoom","extent"]),Hf=h(["zoom","privileged"],!1),If=h(["onenter"],function(){}),Jf=h(["onleave"],function(){}),Kf=h(["onresize"],function(){}),Lf=h(["onresized"],function(){}),Mf=h(["transition","duration"],350);g("data","data is required in config");var Nf,Of,Pf,Qf,Rf,Sf,Tf,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=h(["data","x"]),ug=h(["data","xs"],{}),vg=h(["data","x_format"]),wg=h(["data","id_converter"],function(a){return a}),xg=h(["data","names"],{}),yg=h(["data","classes"],{}),zg=h(["data","groups"],[]),Ag=h(["data","axes"],{}),Bg=h(["data","type"]),Cg=h(["data","types"],{}),Dg=h(["data","labels"],{}),Eg=h(["data","order"]),Fg=h(["data","regions"],{}),Gg=h(["data","color"]),Hg=h(["data","colors"],{}),Ig=h(["data","hide"],!1),Jg=h(["data","selection","enabled"],!1),Kg=h(["data","selection","grouped"],!1),Lg=h(["data","selection","isselectable"],function(){return!0}),Mg=h(["data","selection","multiple"],!0),Ng=h(["data","onclick"],function(){}),Og=h(["data","onenter"],function(){}),Pg=h(["data","onleave"],function(){}),Qg=h(["data","onselected"],function(){}),Rg=h(["data","onunselected"],function(){}),Sg=h(["data","ondragstart"],function(){}),Tg=h(["data","ondragend"],function(){}),Ug=h(["subchart","show"],!1),Vg=h(["subchart","size","height"],60),Wg=h(["color","pattern"],[]),Xg=h(["legend","show"],!0),Yg=h(["legend","position"],"bottom"),Zg=h(["legend","item","onclick"]),$g=h(["legend","item","onmouseover"]),_g=h(["legend","item","onmouseout"]),ah=h(["legend","equally"],!1),bh=h(["axis","rotated"],!1),ch=h(["axis","x","show"],!0),dh=h(["axis","x","type"],"indexed"),eh=h(["axis","x","localtime"],!0),fh=h(["axis","x","categories"],[]),gh=h(["axis","x","tick","centered"],!1),hh=h(["axis","x","tick","format"]),ih=h(["axis","x","tick","culling"],{}),jh=h(["axis","x","tick","culling","max"],10),kh=h(["axis","x","tick","count"]),lh=h(["axis","x","tick","fit"],!0),mh=h(["axis","x","tick","values"],null),nh=h(["axis","x","tick","rotate"]),oh=h(["axis","x","max"],null),ph=h(["axis","x","min"],null),qh=h(["axis","x","padding"],{}),rh=h(["axis","x","height"]),sh=h(["axis","x","default"]),th=h(["axis","x","label"],{}),uh=h(["axis","y","show"],!0),vh=h(["axis","y","max"]),wh=h(["axis","y","min"]),xh=h(["axis","y","center"]),yh=h(["axis","y","label"],{}),zh=h(["axis","y","inner"],!1),Ah=h(["axis","y","tick","format"]),Bh=h(["axis","y","padding"]),Ch=h(["axis","y","ticks"],10),Dh=h(["axis","y2","show"],!1),Eh=h(["axis","y2","max"]),Fh=h(["axis","y2","min"]),Gh=h(["axis","y2","center"]),Hh=h(["axis","y2","label"],{}),Ih=h(["axis","y2","inner"],!1),Jh=h(["axis","y2","tick","format"]),Kh=h(["axis","y2","padding"]),Lh=h(["axis","y2","ticks"],10),Mh=h(["grid","x","show"],!1),Nh=h(["grid","x","type"],"tick"),Oh=h(["grid","x","lines"],[]),Ph=h(["grid","y","show"],!1),Qh=h(["grid","y","lines"],[]),Rh=h(["grid","y","ticks"],10),Sh=h(["point","show"],!0),Th=h(["point","r"],2.5),Uh=h(["point","focus","line","enabled"],!0),Vh=h(["point","focus","expand","enabled"],!0),Wh=h(["point","focus","expand","r"]),Xh=h(["point","focus","select","r"]),Yh=h(["line","connect_null"],!1),Zh=h(["bar","width"]),$h=h(["bar","width","ratio"],.6),_h=h(["pie","label","show"],!0),ai=h(["pie","label","format"]),bi=h(["pie","expand"],!0),ci=h(["pie","onclick"],function(){}),di=h(["pie","onmouseover"],function(){}),ei=h(["pie","onmouseout"],function(){}),fi=h(["donut","label","show"],!0),gi=h(["donut","label","format"]),hi=h(["donut","expand"],!0),ii=h(["donut","title"],""),ji=h(["donut","onclick"],function(){}),ki=h(["donut","onmouseover"],function(){}),li=h(["donut","onmouseout"],function(){}),mi=h(["regions"],[]),ni=h(["tooltip","show"],!0),oi=h(["tooltip","format","title"]),pi=h(["tooltip","format","value"]),qi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=oi?oi:b,l=pi?pi: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+""}),ri=h(["tooltip","init","show"],!1),si=h(["tooltip","init","x"],0),ti=h(["tooltip","init","position"],{top:"0px",left:"50px"}),ui=("string"==typeof Af?Af.replace("#",""):Af.id)+"-clip",vi=ui+"-xaxis",wi=ui+"-yaxis",xi=i(ui),yi=i(vi),zi=i(wi),Ai="timeseries"===dh,Bi="categorized"===dh,Ci=!Ai&&(tg||we(ug)),Di=null,Ei=!1,Fi=!1,Gi=!1,Hi=!1,Ii=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ji=qe(Hg,we(Wg)?Wg:Ii,Gg),Ki=eh?xf.time.format:xf.time.format.utc,Li=function(){var a=[[Ki("%Y/%-m/%-d"),function(){return!0}],[Ki("%-m/%-d"),function(a){return a.getMonth()}],[Ki("%-m/%-d"),function(a){return 1!==a.getDate()}],[Ki("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Ki("%I %p"),function(a){return a.getHours()}],[Ki("%I:%M"),function(a){return a.getMinutes()}],[Ki(":%S"),function(a){return a.getSeconds()}],[Ki(".%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)}}(),Mi=[],Ni=[],Oi=bh?"left":"bottom",Pi=bh?zh?"top":"bottom":zh?"right":"left",Qi=bh?Ih?"bottom":"top":Ih?"left":"right",Ri=bh?"left":"bottom",Si={main:function(){return"translate("+Nf.left+","+Nf.top+")"},context:function(){return"translate("+Of.left+","+Of.top+")"},legend:function(){return"translate("+Pf.left+","+Pf.top+")"},x:function(){return"translate(0,"+(bh?0:Sf)+")"},y:function(){return"translate(0,"+(bh?Sf:0)+")"},y2:function(){return"translate("+(bh?0:Qf)+","+(bh?1:0)+")"},subx:function(){return"translate(0,"+(bh?0:Tf)+")"},arc:function(){return"translate("+Qf/2+","+Sf/2+")"}},Ti="right"===Yg,Ui=0,Vi=0,Wi=0,Xi=.15,Yi=30,Zi=bh&&!ch?0:30,$i=5;ag=xf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var _i,aj=function(){var a=xf.svg.line().x(bh?function(a){return V(a.id)(a.value)}:Cd).y(bh?Cd:function(a){return V(a.id)(a.value)});return Yh||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=Yh?Ge(b.values):b.values;return fe(b)?(a.interpolate(ge(b)?"cardinal":"linear"),Fg[b.id]?Ve(e,jg,V(b.id),Fg[b.id]):a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),bj=function(){var a;return a=bh?xf.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Cd):xf.svg.area().x(Cd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Ge(b.values);return _d([b],"area")||_d([b],"area-spline")?(a.interpolate(ge(b)?"cardinal":"linear"),a(e)):(c=e[0]?jg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,bh?"M "+d+" "+c:"M "+c+" "+d)}}(),cj=function(){var a=xf.svg.line().x(bh?function(a){return W(a.id)(a.value)}:Fd).y(bh?Fd:function(a){return W(a.id)(a.value)});return function(b){var c=Ge(b.values);return fe(b)?a(c):"M "+mg(c[0].x)+" "+W(b.id)(c[0].value)}}(),dj=function(){};_i=xf.svg.brush().on("brush",cf),_i.update=function(){return hj&&hj.select("."+f.brush).call(this),this},_i.scale=function(a){return bh?this.y(a):this.x(a)},Ff&&(dj=xf.behavior.zoom().on("zoomstart",function(){dj.altDomain=xf.event.sourceEvent.altKey?jg.orgDomain():null}).on("zoom",Ff?df:null),dj.scale=function(a){return bh?this.y(a):this.x(a)},dj.orgScaleExtent=function(){var a=Gf?Gf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},dj.updateScaleExtent=function(){var a=ac(jg.orgDomain())/ac(lj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var ej,fj,gj,hj,ij,jj,kj,lj,mj,nj={};if(yf.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),yf.defocus(),b(d.classed(f.focused,!0)),b(e),ee(yf.data.targets)&&Nb(a,!0),of(a,!0)},yf.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);yf.revert(),b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),of(a,!1)},yf.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=ej.selectAll(md(a)),d=c.filter(tf),e=c.filter(uf);b(d.classed(f.focused,!1)),b(e),ee(yf.data.targets)&&Ob(a),pf()},yf.show=function(a,b){a=Dc(a),b=b||{},Mc(a),ej.selectAll(nd(a)).transition().style("opacity",1),b.withLegend&&qf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),ej.selectAll(nd(a)).transition().style("opacity",0),b.withLegend&&rf(a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},yf.toggle=function(a){Gc(a)?yf.hide(a):yf.show(a)},yf.unzoom=function(){_i.clear().update(),bf({withUpdateXDomain:!0})},yf.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){yg[b]=a.classes[b]}),"categories"in a&&Bi&&(fh=a.categories,pg.categories(fh)),"cacheIds"in a&&bc(a.cacheIds)?void jf(dc(a.cacheIds),a.done):void("unload"in a?lf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){kf(a)}):kf(a))},yf.unload=function(a,b){lf(Dc(a),function(){bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},yf.selected=function(a){return xf.merge(gj.selectAll("."+f.shapes+ld(a)).selectAll("."+f.shape).filter(function(){return xf.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},yf.select=function(a,b,c){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=xf.select(this),i="circle"===this.nodeName?Ae:De,j="circle"===this.nodeName?Be:Ee,k=Kg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Lg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},yf.unselect=function(a,b){Jg&&gj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=xf.select(this),g="circle"===this.nodeName?Be:Ee,h=Kg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&Lg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},yf.toLine=function(a){wf(a,"line")},yf.toSpline=function(a){wf(a,"spline")},yf.toBar=function(a){wf(a,"bar")},yf.toScatter=function(a){wf(a,"scatter")},yf.toArea=function(a){wf(a,"area")},yf.toAreaSpline=function(a){wf(a,"area-spline") -},yf.toPie=function(a){wf(a,"pie",{withTransform:!0})},yf.toDonut=function(a){wf(a,"donut",{withTransform:!0})},yf.groups=function(a){return c(a)?zg:(zg=a,bf(),zg)},yf.xgrids=function(a){return a?(Oh=a,bf(),Oh):Oh},yf.xgrids.add=function(a){return a?yf.xgrids(Oh.concat(a)):void 0},yf.xgrids.remove=function(a){var b=vf(a);return yf.xgrids(Oh.filter(b))},yf.ygrids=function(a){return a?(Qh=a,bf(),Qh):Qh},yf.ygrids.add=function(a){return a?yf.ygrids(Qh.concat(a)):void 0},yf.ygrids.remove=function(a){var b=vf(a);return yf.ygrids(Qh.filter(b))},yf.regions=function(a){return c(a)?mi:(mi=a,bf(),mi)},yf.regions.add=function(a){return c(a)?mi:(mi=mi.concat(a),bf(),mi)},yf.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;ej.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),mi=mi.filter(function(b){return b.classes.indexOf(a)<0})}),mi},yf.data.get=function(a){var b=yf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},yf.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},yf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){xg[b]=a[b]}),sf(Cc(yf.data.targets),{withTransition:!0}),xg):xg},yf.x=function(a){return arguments.length&&(qc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.xs=function(a){return arguments.length&&(rc(yf.data.targets,a),bf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),yf.data.xs},yf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},yf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(vh=+a.y),b(a.y2)&&(Eh=+a.y2)):vh=Eh=+a,bf())},yf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(wh=+a.y),b(a.y2)&&(Fh=+a.y2)):wh=Fh=+a,bf())},yf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&yf.axis.max(a.max),"undefined"!=typeof a.min&&yf.axis.min(a.min))},yf.legend.show=function(a){qf(Dc(a)),bf({withLegend:!0})},yf.legend.hide=function(a){rf(Dc(a)),bf({withLegend:!0})},yf.resize=function(a){Bf=a?a.width:null,Cf=a?a.height:null,gf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},yf.destroy=function(){yf.data.targets=void 0,yf.data.xs={},kj.html(""),a.onresize=null},"url"in e.data)xf.xhr(e.data.url,function(a,b){var c,d=xf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=xf.csv.parse(b.response),We(c)});else if("rows"in e.data)We(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");We(uc(e.data.columns))}return yf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},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;cWf&&(Wf=0),0>Yf&&(Yf=0),Xf=hh?Tf.left-cj-dj:Wf,Zf=hh?Yf:_f-Uf.top-Uf.bottom,0>Xf&&(Xf=0),0>Zf&&(Zf=0),p(),Zi&&he(Ef.data.targets)&&(Vf.left=Wf/2+bg)}function o(){mj.select("line."+f.xgridFocus).attr("x1",hh?0:-10).attr("x2",hh?Wf:-10).attr("y1",hh?-10:Tf.top).attr("y2",hh?-10:Yf)}function p(){bg=Yf/2,ag=.95*bg,cg=ge(Ef.data.targets)?.6*ag:0}function q(){var a=hh?f.axisX:f.axisY,b=mj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Df.select(Gf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Hf?Hf:x()}function s(){var a=If?If:y();return a>0?a:320}function t(){return he(Ef.data.targets)?0:Jf?Jf:hh?ih?v("x"):1:!Ah||Fh?1:v("y")}function u(){var a=1;return he(Ef.data.targets)?0:Kf?Kf:Zi?P()+(Jh&&!hh?v("y2"):a):Jh?Oh||hh?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||ih?"x"===a&&xh?xh:"y"!==a||Ah?"y2"!==a||Jh?(jb(a).isInner?30:40)+("y2"===a?-10:0):ej:bh&&!Zi?10:1:0}function x(){return+Df.select(Gf).style("width").replace("px","")}function y(){return+Df.select(Gf).style("height").replace("px","")}function z(a){return a?-5:-(Tf.left-1)}function A(a){return a?-20:-4}function B(){return z(!hh)}function C(){return A(!hh)}function D(){return z(hh)}function E(){return A(hh)}function F(a){return a?Wf+2+4:Tf.left+20}function G(a){return a?(xh?xh:0)+80:Yf+8}function H(){return F(!hh)}function I(){return G(!hh)}function J(){return F(hh)}function K(){return G(hh)}function L(){var a,b,c,d,e,f=Ac(Ef.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=pg(b.x)-pg(a.x),0===c?hh?Yf:Wf:(d=zc(),e=de(Ef.data.targets)?(d-(Hi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){$i=a}function N(a){_i=a}function O(a){aj=a}function P(){return bh?Zi?_i*($i+1):$f:0}function Q(){return bh?Zi?_f:aj*($i+1):0}function R(){var a,b,c=!pg;hg=hh?1:0,ig=hh?Yf:Wf,jg=hh?0:Yf,kg=hh?Wf:1,lg=hg,mg=ig,ng=hh?0:Zf,og=hh?Xf:1,pg=T(hg,ig,c?void 0:pg.domain(),function(){return vg.tickOffset()}),qg=U(jg,kg,c?void 0:qg.domain()),rg=U(jg,kg,c?void 0:rg.domain()),sg=T(hg,ig,rj,function(a){return a%1?0:yg.tickOffset()}),tg=U(ng,og,c?void 0:tg.domain()),ug=U(ng,og,c?void 0:ug.domain()),a=$(),b=sh?sh:c?void 0:vg.tickValues(),vg=X(pg,Ui,a,b),yg=X(sg,Xi,a,b),wg=Y(qg,Vi,Gh,Ih),xg=Y(rg,Wi,Ph,Rh),c||(fj.scale(sg),Lf&&jj.scale(pg)),S()}function S(){dg=Gb(),eg=Hb(),fg=Hb(.98)}function T(a,b,d,e){var f=(Gi?Df.time.scale():Df.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Hi){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=Df.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?rg:qg}function W(a){return"y2"===Z(a)?ug:tg}function X(a,b,c,d){var e=(Hi?Eb():Df.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Hi?(e.tickCentered(mh),Ae(oh)&&(oh=!1)):e.tickOffset=function(){var a=Bc(Ef.data.targets),b=pg(a[1])-pg(a[0]),c=b?b:hh?Yf:Wf;return c/zc()/2},Hi&&e.categories(lh),e}function Y(a,b,c,d){return Df.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Gg?Gg[a]:"y"}function $(){var a=Gi?Ri:Hi?Tc:function(a){return 0>a?a.toFixed(0):a};return nh&&("function"==typeof nh?a=nh:Gi&&(a=function(a){return a?Qi(nh)(a):""})),a}function _(a){var b;return"y"===a?b=Eh:"y2"===a?b=Nh:"x"===a&&(b=zh),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?Eh=b:"y2"===a?Nh=b:"x"===a&&(zh=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",hh?"inner-top":"inner-right")}function hb(){return fb("y",hh?"inner-right":"inner-top")}function ib(){return fb("y2",hh?"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?Wf/2:Wf:b.isBottom?-Yf:b.isMiddle?-Yf/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(!hh,gb())}function rb(){return nb(hh,hb())}function sb(){return nb(hh,ib())}function tb(){return ob(!hh,gb())}function ub(){return ob(hh,hb())}function vb(){return ob(hh,ib())}function wb(){var a=gb();return hh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":xh?xh-10:"3em"}function xb(){var a=hb();return hh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return hh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!hh,gb())}function Ab(){return pb(hh,hb())}function Bb(){return pb(hh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Df.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){mj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),mj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),mj.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 Df.min(Object.keys(i).map(function(a){return Df.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Fg.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 Df.max(Object.keys(i).map(function(a){return Df.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?Lh:Ch,n="y2"===c?Kh:Bh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Mh:Dh,r=xd()&&hh;return 0===l.length?"y2"===c?rg.domain():qg.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(qg.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&&Hh&&(f=b(Hh.top)?Hh.top:e,g=b(Hh.bottom)?Hh.bottom:e),"y2"===c&&Qh&&(f=b(Qh.top)?Qh.top:e,g=b(Qh.bottom)?Qh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return vh?Gi?we(vh):vh:Df.min(a,function(a){return Df.min(a.values,function(a){return a.x})})}function Zb(a){return uh?Gi?we(uh):uh:Df.max(a,function(a){return Df.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 Hi?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof wh&&Be(wh)?(e=b(wh.left)?wh.left:d,f=b(wh.right)?wh.right:d):e=f="number"==typeof wh?wh: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=Gi?new Date(.5*c.getTime()):-.5,d=Gi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Gi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Gi?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?qg:rg;return b="y"===a.axis||"y2"===a.axis?hh?Yf:"start"in a?d(a.start):Yf:hh?"end"in a?pg(Gi?we(a.end):a.end):Yf:Yf,c>b?0:b-c}function ic(a){return zg&&a===zg||Be(Ag)&&Ce(Ag,a)}function jc(a){return!ic(a)}function kc(a){return zg?zg:Be(Ag)?Ag[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ef.data.xs[b])}),c}function mc(a,b){return a in Ef.data.xs&&Ef.data.xs[a]&&Ef.data.xs[a][b]?Ef.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Ag[b]=a[b]})}function oc(a){return 1===Df.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Dg[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)}),Ef.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=Gi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ii&&!Hi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ef.data.xs[c]=a.map(function(a){return a[f]}).filter(b):zg?(d=Object.keys(Ef.data.xs),Ef.data.xs[c]=d.length>0?Ef.data.xs[d[0]]:void 0):Be(Ag)&&(Ef.data.xs[c]=lc(f,Ef.data.targets)):Ef.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ef.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Cg(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 Ii&&Hi&&0===c&&g&&(0===e&&(lh=[]),lh.push(g)),("undefined"==typeof a[b]||Ef.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++})}),Hg&&be(Cc(c).filter(function(a){return!(a in Ig)}),Hg),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&&Ef.data.targets[0].values[a-1]?Ef.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(Ef.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(Gi?new Date(i):i);j.push(e)}return Gi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Si=Si.concat(a)}function Mc(a){Si=Si.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ti=Ti.concat(a)}function Oc(a){Ti=Ti.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 Df.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 Kg&&"desc"===Kg.toLowerCase()}function Qd(){return Kg&&"asc"===Kg.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 Kg&&a.sort(Kg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ef.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ti&&(pj.html(wi(a,$(),zd(k),Pi)).style("display","block"),d=pj.property("offsetWidth"),e=pj.property("offsetHeight"),k?(g=Wf/2+c[0],i=Yf/2+c[1]+20):(hh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=pg(l[0].x)+20):(f=q(),g=f+t()+pg(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)),pj.style("top",i+"px").style("left",g+"px"))}function Td(){pj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ti&&(ee(Ef.data.targets)||he(Ef.data.targets)||mj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(hh?"y1":"x1",Fd).attr(hh?"y2":"x2",Fd))}function Vd(){mj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?pg(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 di?di:b?2*a.tickOffset()*ei/b:0}function be(a,b){Dc(a).forEach(function(a){tj[a]=b===Ig[a],Ig[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Ig[a.id]===b&&(c=!0),a.id in Ig||"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 Ig)||"line"===Ig[b]||"spline"===Ig[b]||"area"===Ig[b]||"area-spline"===Ig[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Ig[b]||"area-spline"===Ig[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Ig[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Ig[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Ig[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Ig[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)&&ni||me(a)&&hi}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):g in a?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=Bg?Df.time.format(Bg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Bg)}return c}function xe(a,b){var c=Df.mouse(a),d=Df.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)?qg:rg,d=hh?1:0,e=hh?0:1;return Math.pow(pg(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){Wg(b,a.node()),mj.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",hh?Xd:Wd).attr("cy",hh?Wd:Xd).attr("stroke",function(){return Pi(b)}).attr("r",1.4*Pe(b)).transition().duration(100).attr("r",Pe)}function Ge(a,b,c){Xg(b,a.node()),mj.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){Wg(b,a.node()),a.transition().duration(100).style("fill",function(){return Df.rgb(Pi(b)).brighter(.75)})}function Je(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Pi(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 a.filter(function(a){return b(a.value)})}function Ne(a){return Yh?"function"==typeof Zh?Zh(a):Zh:0}function Oe(a){return _h?ai?ai:1.75*Ne(a):Ne(a)}function Pe(a){return bi?bi:4*Ne(a)}function Qe(a,c){return(c?mj.selectAll("."+f.circles+od(c)):mj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Re(a,b){Qe(a,b).classed(f.EXPANDED,!0).attr("r",Oe)}function Se(a){Qe(a).filter(function(){return Df.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ne)}function Te(a){return mj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ue(a){Te(a).classed(f.EXPANDED,!0)}function Ve(a){Te(a).classed(f.EXPANDED,!1)}function We(a,b){var c=$e(a,b);return function(a,b){var d=c(a,b),e=hh?1:0,f=hh?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 Xe(a,b){var c=$e(a,!1),d=b?Ye:Ze;return function(a,b){return d(c(a,b),a,this)}}function Ye(a,b){var c;return hh?(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 Ze(a,b,c){var d=c.getBoundingClientRect();return hh?(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(vg,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 hh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function _e(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 af(b){var c,d,e;if(qj=Df.select(Gf),qj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(qj.html("").classed("c3",!0),Ef.data.xs={},Ef.data.targets=vc(b),Og&&Lc(Og===!0?Cc(Ef.data.targets):Og),n(),R(),pg.domain(Df.extent(_b(Ef.data.targets))),qg.domain(Xb(Ef.data.targets,"y")),rg.domain(Xb(Ef.data.targets,"y2")),sg.domain(pg.domain()),tg.domain(qg.domain()),ug.domain(rg.domain()),rj=pg.domain(),fj.scale(sg),Lf&&jj.scale(pg),kj=qj.append("svg").on("mouseenter",Of).on("mouseleave",Pf),lj=kj.append("defs"),lj.append("clipPath").attr("id",Ai).append("rect"),lj.append("clipPath").attr("id",Bi).append("rect"),lj.append("clipPath").attr("id",Ci).append("rect"),mf(),mj=kj.append("g").attr("transform",Yi.main),nj=kj.append("g").attr("transform",Yi.context),oj=kj.append("g").attr("transform",Yi.legend),$g||nj.style("visibility","hidden"),bh||(oj.style("visibility","hidden"),Ti=Cc(Ef.data.targets)),pj=Df.select(Gf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),yf(Cc(Ef.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=mj.append("g").attr("clip-path",Di).attr("class",f.grid),Sh&&d.append("g").attr("class",f.xgrids),Be(Uh)&&d.append("g").attr("class",f.xgridLines),$h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Vh&&d.append("g").attr("class",f.ygrids),Be(Wh)&&d.append("g").attr("class",f.ygridLines),ih&&mj.append("g").attr("class",f.axisX).attr("clip-path",Ei).attr("transform",Yi.x).append("text").attr("class",f.axisXLabel).attr("transform",hh?"rotate(-90)":"").style("text-anchor",zb),Ah&&mj.append("g").attr("class",f.axisY).attr("clip-path",Fi).attr("transform",Yi.y).append("text").attr("class",f.axisYLabel).attr("transform",hh?"":"rotate(-90)").style("text-anchor",Ab),Jh&&mj.append("g").attr("class",f.axisY2).attr("transform",Yi.y2).append("text").attr("class",f.axisY2Label).attr("transform",hh?"":"rotate(-90)").style("text-anchor",Bb),mj.append("g").attr("clip-path",Di).attr("class",f.regions),mj.append("g").attr("clip-path",Di).attr("class",f.chart),c=mj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Lf?hh?"ns-resize":"ew-resize":null),mj.select("."+f.chart).append("g").attr("class",f.chartBars),mj.select("."+f.chart).append("g").attr("class",f.chartLines),mj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Yi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),mj.select("."+f.chart).append("g").attr("class",f.chartTexts),Lf&&mj.insert("rect",Nf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Wf).attr("height",Yf).style("opacity",0).style("cursor",hh?"ns-resize":"ew-resize").call(jj).on("dblclick.zoom",null),yh&&fj.extent("function"!=typeof yh?yh:yh(_b())),nj.append("g").attr("clip-path",Di).attr("class",f.chart),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.append("g").attr("clip-path",Di).attr("class",f.brush).call(fj).selectAll("rect").attr(hh?"width":"height",hh?Xf:Zf),nj.append("g").attr("class",f.axisX).attr("transform",Yi.subx).attr("clip-path",hh?"":Ei),of(Ef.data.targets),hh?mj.select("."+f.axisX).style("opacity",0).call(vg):(mj.select("."+f.axisY).style("opacity",0).call(wg),mj.select("."+f.axisY2).style("opacity",0).call(xg)),n(),R(),mf(),m(!1),hf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),xi){if(Gi&&"string"==typeof yi){for(yi=we(yi),e=0;e0){d=[];for(var g in Dg)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 ff(a){he(Ef.data.targets)||Pg&&(Ji=a,mj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ki=!0,Yg())}function gf(){he(Ef.data.targets)||Pg&&(mj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),mj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ki=!1,Zg())}function hf(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(Ef.data.targets),_=Ic(Ef.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?Sf:0,U=H?T:0,V=I?T:0,c=mj.select("."+f.axisX).style("opacity",$?0:1),g=mj.select("."+f.axisY).style("opacity",$?0:1),h=mj.select("."+f.axisY2).style("opacity",$?0:1),e=nj.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&&bh&&yf(Cc(Ef.data.targets),a,S),Hi&&(0!==_.length&&M&&K||pg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(pg.domain(Df.extent(_b(_))),rj=pg.domain(),Lf&&jj.scale(pg).updateScaleExtent(),sg.domain(pg.domain()),fj.scale(sg)),K&&(pg.domain(fj.empty()?rj:fj.extent()),Lf&&jj.scale(pg).updateScaleExtent()),sh||!rh&&!qh||(W=Kc(Jc(_),qh),vg.tickValues(W),yg.tickValues(W))),qg.domain(Xb(_,"y")),rg.domain(Xb(_,"y2")),S.axisX.call(vg),S.axisY.call(wg),S.axisY2.call(xg),S.axisSubX.call(yg),K&&_.length)if(oh&&W){for(X=1;X=0&&Df.select(this).style("display",b%Y?"none":"block")})}else kj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!hh&&th&&eb(c,S.axisX,th),O=We(Z),Q=Xe(Z,!0),R=Xe(Z,!1),Db(),tg.domain(qg.domain()),ug.domain(rg.domain()),pj.style("display","none"),o(),mj.select("line."+f.xgridFocus).style("visibility","hidden"),Sh){if("year"===Th){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=pg.ticks(10);i=mj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",hh?0:function(a){return pg(a)-vg.tickOffset()}).attr("x2",hh?Wf:function(a){return pg(a)-vg.tickOffset()}).attr("y1",hh?function(a){return pg(a)-vg.tickOffset()}:Tf.top).attr("y2",hh?function(a){return pg(a)-vg.tickOffset()}:Yf).style("opacity",function(){return+Df.select(this).attr(hh?"y1":"x1")===(hh?Yf:0)?0:1}),i.exit().remove()}Be(Uh)&&(k=mj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Uh),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",hh?"":"rotate(-90)").attr("dx",hh?0:-Tf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",hh?0:Gd).attr("x2",hh?Wf:Gd).attr("y1",hh?Gd:Tf.top).attr("y2",hh?Gd:Yf).style("opacity",1),k.select("text").transition().duration(T).attr("x",hh?Wf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Vh&&(m=mj.select("."+f.ygrids).selectAll("."+f.ygrid).data(qg.ticks(Xh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",hh?qg:0).attr("x2",hh?qg:Wf).attr("y1",hh?0:qg).attr("y2",hh?Yf:qg),m.exit().remove()),E&&Be(Wh)&&(n=mj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Wh),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",hh?"rotate(-90)":"").attr("dx",hh?0:-Tf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",hh?Hd:0).attr("x2",hh?Hd:Wf).attr("y1",hh?0:Hd).attr("y2",hh?Yf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",hh?0:Wf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=mj.select("."+f.regions).selectAll("rect."+f.region).data(si),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=mj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Pi),t.style("opacity",td).transition().duration(T).attr("d",O).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=mj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Pi),q.style("opacity",td).transition().duration(T).attr("d",gj).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=mj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Pi).style("opacity",function(){return sj=+Df.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",hj).style("opacity",sj),r.exit().transition().duration(U).style("opacity",0).remove(),s=mj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Ne),s.style("opacity",td).transition().duration(T).style("opacity",vd).attr("cx",hh?Xd:Wd).attr("cy",hh?Wd:Xd),s.exit().remove(),w=mj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return hh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=mj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Pi(a.data)}).style("cursor",function(a){return Rg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ni||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),uf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Df.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ni||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),vf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();df(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ni=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Df.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("opacity",1).call(Ee,function(){Ni=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),mj.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}),mj.select("."+f.chartArcsTitle).style("opacity",ge(Ef.data.targets)?1:0),$g&&(null!==Df.event&&"zoom"===Df.event.type&&fj.extent(pg.orgDomain()).update(),F&&(!hh&&th&&eb(e,S.axisSubX,th),fj.empty()||fj.extent(pg.orgDomain()).update(),P=We(Z,!0),y=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Pi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Pi),x.style("opacity",td).transition().duration(T).attr("d",ij).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),mj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),mj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",hh?Xd:Wd).attr("cy",hh?Wd:Xd),z=mj.select("."+f.eventRects),Be(Ag)&&!oc(Ag)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=mj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),cf(A.enter()),A.attr("x",0).attr("y",0).attr("width",Wf).attr("height",Yf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ii&&!Hi?(D=function(a,b){var c=xc(b),d=yc(b),e=Ef.data.xs[a.id][b];return(pg(d?d:e+50)-pg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ef.data.xs[a.id][b];return(pg(d)+pg(c?c:d-50))/2}):(D=L(),C=function(a){return pg(a.x)-D/2}),B=Ac(Ef.data.targets),mj.select("."+f.eventRects).datum(B?B.values:[]),A=mj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),bf(A.enter()),A.attr("class",id).attr("x",hh?0:C).attr("y",hh?C:0).attr("width",hh?Wf:D).attr("height",hh?D:Yf),A.exit().remove()),Cc(Ef.data.targets).forEach(function(a){tj[a]=!0})}function jf(){hf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function kf(){return"mousemove"===Df.event.sourceEvent.type&&jj.altDomain?(pg.domain(jj.altDomain),void jj.scale(pg).updateScaleExtent()):(Hi&&pg.orgDomain()[0]===rj[0]&&pg.domain([rj[0]-1e-10,pg.orgDomain()[1]]),hf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Df.event.sourceEvent.type&&(Li=!0)))}function lf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function mf(){kj.attr("width",$f).attr("height",_f),kj.select("#"+Ai).select("rect").attr("width",Wf).attr("height",Yf),kj.select("#"+Bi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),kj.select("#"+Ci).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),kj.select("."+f.zoomRect).attr("width",Wf).attr("height",Yf),qj.style("max-height",_f+"px")}function nf(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(),mf(),m(a.withTransition),hf(a)}function of(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=mj.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).style("fill",function(a){return Pi(a)}),e=mj.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 Rg(a)?"pointer":null}),c=mj.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("fill",Pi).style("cursor",function(a){return Rg(a)?"pointer":null}),a.forEach(function(a){mj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=mj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(gg(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=nj.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=nj.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)),kj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Sf).style("opacity",1)}function pf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ef.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=Zi?j:i,l=Zi?Q():P();return d&&(w=0,C=0,t=0,u=0),bh&&!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=Zi?u:t,void(gh?(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=oj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Zi?(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=oj.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 dh?dh(a):Ef.toggle(a)}).on("mouseover",function(a){Df.select(this).classed(f.legendItemFocused,!0),Ni||Ef.focus(a),"function"==typeof eh&&eh(a)}).on("mouseout",function(a){Df.select(this).classed(f.legendItemFocused,!1),Ni||Ef.revert(),"function"==typeof fh&&fh(a)}),o.append("text").text(function(a){return d(Dg[a])?Dg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Zi?h:-200).attr("y",Zi?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Zi?i:-200).attr("y",Zi?-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",function(a){return Pi(a)}).attr("x",Zi?h:-200).attr("y",Zi?-200:j).attr("width",10).attr("height",10),oj.selectAll("text").data(a).text(function(a){return d(Dg[a])?Dg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),oj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),oj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),oj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Df.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?sf(b):tf(b):bj}),N(t),O(u),M(C),n(),R(),mf(),m(q,c)}function zf(a){return Ec(Ef.data.targets,a.id)}function Af(a){return"data"in a&&Ec(Ef.data.targets,a.data.id)}function Bf(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 Cf(a,b,c){var d=!he(Ef.data.targets);Ni=!1,be(a,b),nf(c||{withTransitionForAxis:d})}var Df=a.d3?a.d3:a.require?a.require("d3"):void 0,Ef={data:{},axis:{},legend:{}},Ff={},Gf=h(["bindto"],"#chart"),Hf=h(["size","width"]),If=h(["size","height"]),Jf=h(["padding","left"],50),Kf=h(["padding","right"]),Lf=h(["zoom","enabled"],!1),Mf=h(["zoom","extent"]),Nf=h(["zoom","privileged"],!1),Of=h(["onenter"],function(){}),Pf=h(["onleave"],function(){}),Qf=h(["onresize"],function(){}),Rf=h(["onresized"],function(){}),Sf=h(["transition","duration"],350);g("data","data is required in config");var Tf,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=h(["data","x"]),Ag=h(["data","xs"],{}),Bg=h(["data","x_format"]),Cg=h(["data","id_converter"],function(a){return a}),Dg=h(["data","names"],{}),Eg=h(["data","classes"],{}),Fg=h(["data","groups"],[]),Gg=h(["data","axes"],{}),Hg=h(["data","type"]),Ig=h(["data","types"],{}),Jg=h(["data","labels"],{}),Kg=h(["data","order"]),Lg=h(["data","regions"],{}),Mg=h(["data","color"]),Ng=h(["data","colors"],{}),Og=h(["data","hide"],!1),Pg=h(["data","selection","enabled"],!1),Qg=h(["data","selection","grouped"],!1),Rg=h(["data","selection","isselectable"],function(){return!0}),Sg=h(["data","selection","multiple"],!0),Tg=h(["data","onclick"],function(){}),Ug=h(["data","onenter"],function(){}),Vg=h(["data","onleave"],function(){}),Wg=h(["data","onselected"],function(){}),Xg=h(["data","onunselected"],function(){}),Yg=h(["data","ondragstart"],function(){}),Zg=h(["data","ondragend"],function(){}),$g=h(["subchart","show"],!1),_g=h(["subchart","size","height"],60),ah=h(["color","pattern"],[]),bh=h(["legend","show"],!0),ch=h(["legend","position"],"bottom"),dh=h(["legend","item","onclick"]),eh=h(["legend","item","onmouseover"]),fh=h(["legend","item","onmouseout"]),gh=h(["legend","equally"],!1),hh=h(["axis","rotated"],!1),ih=h(["axis","x","show"],!0),jh=h(["axis","x","type"],"indexed"),kh=h(["axis","x","localtime"],!0),lh=h(["axis","x","categories"],[]),mh=h(["axis","x","tick","centered"],!1),nh=h(["axis","x","tick","format"]),oh=h(["axis","x","tick","culling"],{}),ph=h(["axis","x","tick","culling","max"],10),qh=h(["axis","x","tick","count"]),rh=h(["axis","x","tick","fit"],!0),sh=h(["axis","x","tick","values"],null),th=h(["axis","x","tick","rotate"]),uh=h(["axis","x","max"],null),vh=h(["axis","x","min"],null),wh=h(["axis","x","padding"],{}),xh=h(["axis","x","height"]),yh=h(["axis","x","default"]),zh=h(["axis","x","label"],{}),Ah=h(["axis","y","show"],!0),Bh=h(["axis","y","max"]),Ch=h(["axis","y","min"]),Dh=h(["axis","y","center"]),Eh=h(["axis","y","label"],{}),Fh=h(["axis","y","inner"],!1),Gh=h(["axis","y","tick","format"]),Hh=h(["axis","y","padding"]),Ih=h(["axis","y","ticks"],10),Jh=h(["axis","y2","show"],!1),Kh=h(["axis","y2","max"]),Lh=h(["axis","y2","min"]),Mh=h(["axis","y2","center"]),Nh=h(["axis","y2","label"],{}),Oh=h(["axis","y2","inner"],!1),Ph=h(["axis","y2","tick","format"]),Qh=h(["axis","y2","padding"]),Rh=h(["axis","y2","ticks"],10),Sh=h(["grid","x","show"],!1),Th=h(["grid","x","type"],"tick"),Uh=h(["grid","x","lines"],[]),Vh=h(["grid","y","show"],!1),Wh=h(["grid","y","lines"],[]),Xh=h(["grid","y","ticks"],10),Yh=h(["point","show"],!0),Zh=h(["point","r"],2.5),$h=h(["point","focus","line","enabled"],!0),_h=h(["point","focus","expand","enabled"],!0),ai=h(["point","focus","expand","r"]),bi=h(["point","focus","select","r"]),ci=h(["line","connect_null"],!1),di=h(["bar","width"]),ei=h(["bar","width","ratio"],.6),fi=h(["pie","label","show"],!0),gi=h(["pie","label","format"]),hi=h(["pie","expand"],!0),ii=h(["pie","onclick"],function(){}),ji=h(["pie","onmouseover"],function(){}),ki=h(["pie","onmouseout"],function(){}),li=h(["donut","label","show"],!0),mi=h(["donut","label","format"]),ni=h(["donut","expand"],!0),oi=h(["donut","title"],""),pi=h(["donut","onclick"],function(){}),qi=h(["donut","onmouseover"],function(){}),ri=h(["donut","onmouseout"],function(){}),si=h(["regions"],[]),ti=h(["tooltip","show"],!0),ui=h(["tooltip","format","title"]),vi=h(["tooltip","format","value"]),wi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ui?ui:b,l=vi?vi: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+""}),xi=h(["tooltip","init","show"],!1),yi=h(["tooltip","init","x"],0),zi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Ai=("string"==typeof Gf?Gf.replace("#",""):Gf.id)+"-clip",Bi=Ai+"-xaxis",Ci=Ai+"-yaxis",Di=i(Ai),Ei=i(Bi),Fi=i(Ci),Gi="timeseries"===jh,Hi="categorized"===jh,Ii=!Gi&&(zg||Be(Ag)),Ji=null,Ki=!1,Li=!1,Mi=!1,Ni=!1,Oi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Pi=ve(Ng,Be(ah)?ah:Oi,Mg),Qi=kh?Df.time.format:Df.time.format.utc,Ri=function(){var a=[[Qi("%Y/%-m/%-d"),function(){return!0}],[Qi("%-m/%-d"),function(a){return a.getMonth()}],[Qi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Qi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Qi("%I %p"),function(a){return a.getHours()}],[Qi("%I:%M"),function(a){return a.getMinutes()}],[Qi(":%S"),function(a){return a.getSeconds()}],[Qi(".%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)}}(),Si=[],Ti=[],Ui=hh?"left":"bottom",Vi=hh?Fh?"top":"bottom":Fh?"right":"left",Wi=hh?Oh?"bottom":"top":Oh?"left":"right",Xi=hh?"left":"bottom",Yi={main:function(){return"translate("+Tf.left+","+Tf.top+")"},context:function(){return"translate("+Uf.left+","+Uf.top+")"},legend:function(){return"translate("+Vf.left+","+Vf.top+")"},x:function(){return"translate(0,"+(hh?0:Yf)+")"},y:function(){return"translate(0,"+(hh?Yf:0)+")"},y2:function(){return"translate("+(hh?0:Wf)+","+(hh?1:0)+")"},subx:function(){return"translate(0,"+(hh?0:Zf)+")"},arc:function(){return"translate("+Wf/2+","+Yf/2+")"}},Zi="right"===ch,$i=0,_i=0,aj=0,bj=.15,cj=30,dj=hh&&!ih?0:30,ej=5;gg=Df.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var fj,gj=function(){var a=Df.svg.line().x(hh?function(a){return V(a.id)(a.value)}:Fd).y(hh?Fd:function(a){return V(a.id)(a.value)});return ci||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ci?Me(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Lg[b.id]?_e(e,pg,V(b.id),Lg[b.id]):a(e)):(c=e[0]?pg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,hh?"M "+d+" "+c:"M "+c+" "+d)}}(),hj=function(){var a;return a=hh?Df.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Df.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=Me(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?pg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,hh?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a=Df.svg.line().x(hh?function(a){return W(a.id)(a.value)}:Id).y(hh?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Me(b.values);return ie(b)?a(c):"M "+sg(c[0].x)+" "+W(b.id)(c[0].value)}}(),jj=function(){};fj=Df.svg.brush().on("brush",jf),fj.update=function(){return nj&&nj.select("."+f.brush).call(this),this},fj.scale=function(a){return hh?this.y(a):this.x(a)},Lf&&(jj=Df.behavior.zoom().on("zoomstart",function(){jj.altDomain=Df.event.sourceEvent.altKey?pg.orgDomain():null}).on("zoom",Lf?kf:null),jj.scale=function(a){return hh?this.y(a):this.x(a)},jj.orgScaleExtent=function(){var a=Mf?Mf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},jj.updateScaleExtent=function(){var a=ac(pg.orgDomain())/ac(rj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var kj,lj,mj,nj,oj,pj,qj,rj,sj,tj={};if(Ef.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=kj.selectAll(pd(a)),d=c.filter(zf),e=c.filter(Af);Ef.revert(),Ef.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ef.data.targets)&&Nb(a,!0),uf(a,!0)},Ef.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=kj.selectAll(pd(a)),d=c.filter(zf),e=c.filter(Af);Ef.revert(),b(d.classed(f.focused,!1)),b(e),he(Ef.data.targets)&&Ob(a),uf(a,!1)},Ef.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=kj.selectAll(pd(a)),d=c.filter(zf),e=c.filter(Af);b(d.classed(f.focused,!1)),b(e),he(Ef.data.targets)&&Ob(a),vf()},Ef.show=function(a,b){a=Dc(a),b=b||{},Mc(a),kj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&wf(a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ef.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),kj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&xf(a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ef.toggle=function(a){Gc(a)?Ef.hide(a):Ef.show(a)},Ef.unzoom=function(){fj.clear().update(),hf({withUpdateXDomain:!0})},Ef.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Eg[b]=a.classes[b]}),"categories"in a&&Hi&&(lh=a.categories,vg.categories(lh)),"cacheIds"in a&&bc(a.cacheIds)?void pf(dc(a.cacheIds),a.done):void("unload"in a?rf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){qf(a)}):qf(a))},Ef.unload=function(a,b){rf(Dc(a),function(){hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ef.selected=function(a){return Df.merge(mj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Df.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ef.select=function(a,b,c){Pg&&mj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Df.select(this),i="circle"===this.nodeName?Fe:Ie,j="circle"===this.nodeName?Ge:Je,k=Qg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Rg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},Ef.unselect=function(a,b){Pg&&mj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Df.select(this),g="circle"===this.nodeName?Ge:Je,h=Qg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED); +h&&i&&Rg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},Ef.toLine=function(a){Cf(a,"line")},Ef.toSpline=function(a){Cf(a,"spline")},Ef.toBar=function(a){Cf(a,"bar")},Ef.toScatter=function(a){Cf(a,"scatter")},Ef.toArea=function(a){Cf(a,"area")},Ef.toAreaSpline=function(a){Cf(a,"area-spline")},Ef.toPie=function(a){Cf(a,"pie",{withTransform:!0})},Ef.toDonut=function(a){Cf(a,"donut",{withTransform:!0})},Ef.groups=function(a){return c(a)?Fg:(Fg=a,hf(),Fg)},Ef.xgrids=function(a){return a?(Uh=a,hf(),Uh):Uh},Ef.xgrids.add=function(a){return a?Ef.xgrids(Uh.concat(a)):void 0},Ef.xgrids.remove=function(a){var b=Bf(a);return Ef.xgrids(Uh.filter(b))},Ef.ygrids=function(a){return a?(Wh=a,hf(),Wh):Wh},Ef.ygrids.add=function(a){return a?Ef.ygrids(Wh.concat(a)):void 0},Ef.ygrids.remove=function(a){var b=Bf(a);return Ef.ygrids(Wh.filter(b))},Ef.regions=function(a){return c(a)?si:(si=a,hf(),si)},Ef.regions.add=function(a){return c(a)?si:(si=si.concat(a),hf(),si)},Ef.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;kj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),si=si.filter(function(b){return b.classes.indexOf(a)<0})}),si},Ef.data.get=function(a){var b=Ef.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ef.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ef.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Dg[b]=a[b]}),yf(Cc(Ef.data.targets),{withTransition:!0}),Dg):Dg},Ef.x=function(a){return arguments.length&&(qc(Ef.data.targets,a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ef.data.xs},Ef.xs=function(a){return arguments.length&&(rc(Ef.data.targets,a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ef.data.xs},Ef.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ef.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Bh=+a.y),b(a.y2)&&(Kh=+a.y2)):Bh=Kh=+a,hf())},Ef.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,hf())},Ef.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ef.axis.max(a.max),"undefined"!=typeof a.min&&Ef.axis.min(a.min))},Ef.legend.show=function(a){wf(Dc(a)),hf({withLegend:!0})},Ef.legend.hide=function(a){xf(Dc(a)),hf({withLegend:!0})},Ef.resize=function(a){Hf=a?a.width:null,If=a?a.height:null,nf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ef.destroy=function(){Ef.data.targets=void 0,Ef.data.xs={},qj.html(""),a.onresize=null},"url"in e.data)Df.xhr(e.data.url,function(a,b){var c,d=Df.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Df.csv.parse(b.response),af(c)});else if("rows"in e.data)af(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");af(uc(e.data.columns))}return Ef},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file From a57b5d681a245b2c274abfa9baa7cfa68b6b26ad Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 10:34:11 +0900 Subject: [PATCH 34/38] Fix select/unselect for arc - #158 --- c3.js | 20 ++++++++++---------- c3.min.js | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/c3.js b/c3.js index ff845e5..34f188a 100644 --- a/c3.js +++ b/c3.js @@ -2291,6 +2291,9 @@ function toggleArc(selected, target, d, i) { toggleBar(selected, target, d.data, i); } + function getToggle(that) { + return that.nodeName === 'circle' ? togglePoint : (d3.select(that).classed(CLASS.bar) ? toggleBar : toggleArc); + } function filterRemoveNull(data) { return data.filter(function (d) { return isValue(d.value); }); @@ -4337,19 +4340,17 @@ c3.select = function (ids, indices, resetOther) { if (! __data_selection_enabled) { return; } main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) { - var shape = d3.select(this), - select = (this.nodeName === 'circle') ? selectPoint : selectBar, - unselect = (this.nodeName === 'circle') ? unselectPoint : unselectBar, - isTargetId = __data_selection_grouped || !ids || ids.indexOf(d.id) >= 0, + var shape = d3.select(this), id = d.data ? d.data.id : d.id, toggle = getToggle(this), + isTargetId = __data_selection_grouped || !ids || ids.indexOf(id) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0, isSelected = shape.classed(CLASS.SELECTED); if (isTargetId && isTargetIndex) { if (__data_selection_isselectable(d) && !isSelected) { - select(shape.classed(CLASS.SELECTED, true), d, i); + toggle(true, shape.classed(CLASS.SELECTED, true), d, i); } } else if (isDefined(resetOther) && resetOther) { if (isSelected) { - unselect(shape.classed(CLASS.SELECTED, false), d, i); + toggle(false, shape.classed(CLASS.SELECTED, false), d, i); } } }); @@ -4358,15 +4359,14 @@ c3.unselect = function (ids, indices) { if (! __data_selection_enabled) { return; } main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) { - var shape = d3.select(this), - unselect = (this.nodeName === 'circle') ? unselectPoint : unselectBar, - isTargetId = __data_selection_grouped || !ids || ids.indexOf(d.id) >= 0, + var shape = d3.select(this), id = d.data ? d.data.id : d.id, toggle = getToggle(this), + isTargetId = __data_selection_grouped || !ids || ids.indexOf(id) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0, isSelected = shape.classed(CLASS.SELECTED); if (isTargetId && isTargetIndex) { if (__data_selection_isselectable(d)) { if (isSelected) { - unselect(shape.classed(CLASS.SELECTED, false), d, i); + toggle(false, shape.classed(CLASS.SELECTED, false), d, i); } } } diff --git a/c3.min.js b/c3.min.js index 4db0ab2..29ba482 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.33"},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;cWf&&(Wf=0),0>Yf&&(Yf=0),Xf=hh?Tf.left-cj-dj:Wf,Zf=hh?Yf:_f-Uf.top-Uf.bottom,0>Xf&&(Xf=0),0>Zf&&(Zf=0),p(),Zi&&he(Ef.data.targets)&&(Vf.left=Wf/2+bg)}function o(){mj.select("line."+f.xgridFocus).attr("x1",hh?0:-10).attr("x2",hh?Wf:-10).attr("y1",hh?-10:Tf.top).attr("y2",hh?-10:Yf)}function p(){bg=Yf/2,ag=.95*bg,cg=ge(Ef.data.targets)?.6*ag:0}function q(){var a=hh?f.axisX:f.axisY,b=mj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Df.select(Gf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return Hf?Hf:x()}function s(){var a=If?If:y();return a>0?a:320}function t(){return he(Ef.data.targets)?0:Jf?Jf:hh?ih?v("x"):1:!Ah||Fh?1:v("y")}function u(){var a=1;return he(Ef.data.targets)?0:Kf?Kf:Zi?P()+(Jh&&!hh?v("y2"):a):Jh?Oh||hh?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||ih?"x"===a&&xh?xh:"y"!==a||Ah?"y2"!==a||Jh?(jb(a).isInner?30:40)+("y2"===a?-10:0):ej:bh&&!Zi?10:1:0}function x(){return+Df.select(Gf).style("width").replace("px","")}function y(){return+Df.select(Gf).style("height").replace("px","")}function z(a){return a?-5:-(Tf.left-1)}function A(a){return a?-20:-4}function B(){return z(!hh)}function C(){return A(!hh)}function D(){return z(hh)}function E(){return A(hh)}function F(a){return a?Wf+2+4:Tf.left+20}function G(a){return a?(xh?xh:0)+80:Yf+8}function H(){return F(!hh)}function I(){return G(!hh)}function J(){return F(hh)}function K(){return G(hh)}function L(){var a,b,c,d,e,f=Ac(Ef.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=pg(b.x)-pg(a.x),0===c?hh?Yf:Wf:(d=zc(),e=de(Ef.data.targets)?(d-(Hi?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function M(a){$i=a}function N(a){_i=a}function O(a){aj=a}function P(){return bh?Zi?_i*($i+1):$f:0}function Q(){return bh?Zi?_f:aj*($i+1):0}function R(){var a,b,c=!pg;hg=hh?1:0,ig=hh?Yf:Wf,jg=hh?0:Yf,kg=hh?Wf:1,lg=hg,mg=ig,ng=hh?0:Zf,og=hh?Xf:1,pg=T(hg,ig,c?void 0:pg.domain(),function(){return vg.tickOffset()}),qg=U(jg,kg,c?void 0:qg.domain()),rg=U(jg,kg,c?void 0:rg.domain()),sg=T(hg,ig,rj,function(a){return a%1?0:yg.tickOffset()}),tg=U(ng,og,c?void 0:tg.domain()),ug=U(ng,og,c?void 0:ug.domain()),a=$(),b=sh?sh:c?void 0:vg.tickValues(),vg=X(pg,Ui,a,b),yg=X(sg,Xi,a,b),wg=Y(qg,Vi,Gh,Ih),xg=Y(rg,Wi,Ph,Rh),c||(fj.scale(sg),Lf&&jj.scale(pg)),S()}function S(){dg=Gb(),eg=Hb(),fg=Hb(.98)}function T(a,b,d,e){var f=(Gi?Df.time.scale():Df.scale.linear()).range([a,b]);if(f.orgDomain=function(){return f.domain()},d&&f.domain(d),c(e)&&(e=function(){return 0}),Hi){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=Df.scale.linear().range([a,b]);return c&&d.domain(c),d}function V(a){return"y2"===Z(a)?rg:qg}function W(a){return"y2"===Z(a)?ug:tg}function X(a,b,c,d){var e=(Hi?Eb():Df.svg.axis()).scale(a).orient(b);return e.tickFormat(c).tickValues(d),Hi?(e.tickCentered(mh),Ae(oh)&&(oh=!1)):e.tickOffset=function(){var a=Bc(Ef.data.targets),b=pg(a[1])-pg(a[0]),c=b?b:hh?Yf:Wf;return c/zc()/2},Hi&&e.categories(lh),e}function Y(a,b,c,d){return Df.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Gg?Gg[a]:"y"}function $(){var a=Gi?Ri:Hi?Tc:function(a){return 0>a?a.toFixed(0):a};return nh&&("function"==typeof nh?a=nh:Gi&&(a=function(a){return a?Qi(nh)(a):""})),a}function _(a){var b;return"y"===a?b=Eh:"y2"===a?b=Nh:"x"===a&&(b=zh),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?Eh=b:"y2"===a?Nh=b:"x"===a&&(zh=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",hh?"inner-top":"inner-right")}function hb(){return fb("y",hh?"inner-right":"inner-top")}function ib(){return fb("y2",hh?"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?Wf/2:Wf:b.isBottom?-Yf:b.isMiddle?-Yf/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(!hh,gb())}function rb(){return nb(hh,hb())}function sb(){return nb(hh,ib())}function tb(){return ob(!hh,gb())}function ub(){return ob(hh,hb())}function vb(){return ob(hh,ib())}function wb(){var a=gb();return hh?a.isInner?"1.2em":-25-Cb("x"):a.isInner?"-0.5em":xh?xh-10:"3em"}function xb(){var a=hb();return hh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Cb("y")}function yb(){var a=ib();return hh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Cb("y2")}function zb(){return pb(!hh,gb())}function Ab(){return pb(hh,hb())}function Bb(){return pb(hh,ib())}function Cb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return Df.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Db(){mj.select("."+f.axisX+" ."+f.axisXLabel).transition().attr("x",qb).attr("dx",tb).attr("dy",wb).text(kb),mj.select("."+f.axisY+" ."+f.axisYLabel).transition().attr("x",rb).attr("dx",ub).attr("dy",xb).attr("dy",xb).text(lb),mj.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 Df.min(Object.keys(i).map(function(a){return Df.min(i[a])}))}function Wb(a){var b,c,d,e,f,g,h=Cc(a),i=Pc(a);if(Fg.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 Df.max(Object.keys(i).map(function(a){return Df.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?Lh:Ch,n="y2"===c?Kh:Bh,o=b(m)?m:Vb(l),p=b(n)?n:Wb(l),q="y2"===c?Mh:Dh,r=xd()&&hh;return 0===l.length?"y2"===c?rg.domain():qg.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(qg.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&&Hh&&(f=b(Hh.top)?Hh.top:e,g=b(Hh.bottom)?Hh.bottom:e),"y2"===c&&Qh&&(f=b(Qh.top)?Qh.top:e,g=b(Qh.bottom)?Qh.bottom:e),de(l)&&!Rc(l)&&(g=o),[o-g,p+f])}function Yb(a){return vh?Gi?we(vh):vh:Df.min(a,function(a){return Df.min(a.values,function(a){return a.x})})}function Zb(a){return uh?Gi?we(uh):uh:Df.max(a,function(a){return Df.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 Hi?d=0:de(a)?(c=zc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof wh&&Be(wh)?(e=b(wh.left)?wh.left:d,f=b(wh.right)?wh.right:d):e=f="number"==typeof wh?wh: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=Gi?new Date(.5*c.getTime()):-.5,d=Gi?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Gi?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Gi?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?qg:rg;return b="y"===a.axis||"y2"===a.axis?hh?Yf:"start"in a?d(a.start):Yf:hh?"end"in a?pg(Gi?we(a.end):a.end):Yf:Yf,c>b?0:b-c}function ic(a){return zg&&a===zg||Be(Ag)&&Ce(Ag,a)}function jc(a){return!ic(a)}function kc(a){return zg?zg:Be(Ag)?Ag[a]:null}function lc(a,b){var c,d=b&&Be(b)?Cc(b):[];return d.forEach(function(b){kc(b)===a&&(c=Ef.data.xs[b])}),c}function mc(a,b){return a in Ef.data.xs&&Ef.data.xs[a]&&Ef.data.xs[a][b]?Ef.data.xs[a][b]:b}function nc(a){Object.keys(a).forEach(function(b){Ag[b]=a[b]})}function oc(a){return 1===Df.set(Object.keys(a).map(function(b){return a[b]})).size()}function pc(a){var b;return a&&(b=Dg[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)}),Ef.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=Gi?a?a instanceof Date?a:we(a):we(mc(c,d)):Ii&&!Hi?b(a)?+a:mc(c,d):d}function tc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Ef.data.xs[c]=a.map(function(a){return a[f]}).filter(b):zg?(d=Object.keys(Ef.data.xs),Ef.data.xs[c]=d.length>0?Ef.data.xs[d[0]]:void 0):Be(Ag)&&(Ef.data.xs[c]=lc(f,Ef.data.targets)):Ef.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Ef.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Cg(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 Ii&&Hi&&0===c&&g&&(0===e&&(lh=[]),lh.push(g)),("undefined"==typeof a[b]||Ef.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++})}),Hg&&be(Cc(c).filter(function(a){return!(a in Ig)}),Hg),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&&Ef.data.targets[0].values[a-1]?Ef.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(Ef.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(Gi?new Date(i):i);j.push(e)}return Gi||(j=j.sort(function(a,b){return a-b})),j}function Lc(a){Si=Si.concat(a)}function Mc(a){Si=Si.filter(function(b){return a.indexOf(b)<0})}function Nc(a){Ti=Ti.concat(a)}function Oc(a){Ti=Ti.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 Df.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 Kg&&"desc"===Kg.toLowerCase()}function Qd(){return Kg&&"asc"===Kg.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 Kg&&a.sort(Kg),a}function Sd(a,c){var d,e,f,g,h,i,j,k=he(Ef.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&ti&&(pj.html(wi(a,$(),zd(k),Pi)).style("display","block"),d=pj.property("offsetWidth"),e=pj.property("offsetHeight"),k?(g=Wf/2+c[0],i=Yf/2+c[1]+20):(hh?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=pg(l[0].x)+20):(f=q(),g=f+t()+pg(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)),pj.style("top",i+"px").style("left",g+"px"))}function Td(){pj.style("display","none")}function Ud(a){var c=a.filter(function(a){return a&&b(a.value)});ti&&(ee(Ef.data.targets)||he(Ef.data.targets)||mj.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(hh?"y1":"x1",Fd).attr(hh?"y2":"x2",Fd))}function Vd(){mj.select("line."+f.xgridFocus).style("visibility","hidden")}function Wd(a){return a.x||0===a.x?pg(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 di?di:b?2*a.tickOffset()*ei/b:0}function be(a,b){Dc(a).forEach(function(a){tj[a]=b===Ig[a],Ig[a]=b})}function ce(a,b){var c=!1;return a.forEach(function(a){Ig[a.id]===b&&(c=!0),a.id in Ig||"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 Ig)||"line"===Ig[b]||"spline"===Ig[b]||"area"===Ig[b]||"area-spline"===Ig[b]}function je(a){var b="string"==typeof a?a:a.id;return"spline"===Ig[b]||"area-spline"===Ig[b]}function ke(a){var b="string"==typeof a?a:a.id;return"bar"===Ig[b]}function le(a){var b="string"==typeof a?a:a.id;return"scatter"===Ig[b]}function me(a){var b="string"==typeof a?a:a.id;return"pie"===Ig[b]}function ne(a){var b="string"==typeof a?a:a.id;return"donut"===Ig[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)&&ni||me(a)&&hi}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):g in a?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=Bg?Df.time.format(Bg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Bg)}return c}function xe(a,b){var c=Df.mouse(a),d=Df.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)?qg:rg,d=hh?1:0,e=hh?0:1;return Math.pow(pg(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){Wg(b,a.node()),mj.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",hh?Xd:Wd).attr("cy",hh?Wd:Xd).attr("stroke",function(){return Pi(b)}).attr("r",1.4*Pe(b)).transition().duration(100).attr("r",Pe)}function Ge(a,b,c){Xg(b,a.node()),mj.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){Wg(b,a.node()),a.transition().duration(100).style("fill",function(){return Df.rgb(Pi(b)).brighter(.75)})}function Je(a,b){Xg(b,a.node()),a.transition().duration(100).style("fill",function(){return Pi(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 a.filter(function(a){return b(a.value)})}function Ne(a){return Yh?"function"==typeof Zh?Zh(a):Zh:0}function Oe(a){return _h?ai?ai:1.75*Ne(a):Ne(a)}function Pe(a){return bi?bi:4*Ne(a)}function Qe(a,c){return(c?mj.selectAll("."+f.circles+od(c)):mj).selectAll("."+f.circle+(b(a)?"-"+a:""))}function Re(a,b){Qe(a,b).classed(f.EXPANDED,!0).attr("r",Oe)}function Se(a){Qe(a).filter(function(){return Df.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",Ne)}function Te(a){return mj.selectAll("."+f.bar+(b(a)?"-"+a:""))}function Ue(a){Te(a).classed(f.EXPANDED,!0)}function Ve(a){Te(a).classed(f.EXPANDED,!1)}function We(a,b){var c=$e(a,b);return function(a,b){var d=c(a,b),e=hh?1:0,f=hh?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 Xe(a,b){var c=$e(a,!1),d=b?Ye:Ze;return function(a,b){return d(c(a,b),a,this)}}function Ye(a,b){var c;return hh?(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 Ze(a,b,c){var d=c.getBoundingClientRect();return hh?(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(vg,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 hh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function _e(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 af(b){var c,d,e;if(qj=Df.select(Gf),qj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(qj.html("").classed("c3",!0),Ef.data.xs={},Ef.data.targets=vc(b),Og&&Lc(Og===!0?Cc(Ef.data.targets):Og),n(),R(),pg.domain(Df.extent(_b(Ef.data.targets))),qg.domain(Xb(Ef.data.targets,"y")),rg.domain(Xb(Ef.data.targets,"y2")),sg.domain(pg.domain()),tg.domain(qg.domain()),ug.domain(rg.domain()),rj=pg.domain(),fj.scale(sg),Lf&&jj.scale(pg),kj=qj.append("svg").on("mouseenter",Of).on("mouseleave",Pf),lj=kj.append("defs"),lj.append("clipPath").attr("id",Ai).append("rect"),lj.append("clipPath").attr("id",Bi).append("rect"),lj.append("clipPath").attr("id",Ci).append("rect"),mf(),mj=kj.append("g").attr("transform",Yi.main),nj=kj.append("g").attr("transform",Yi.context),oj=kj.append("g").attr("transform",Yi.legend),$g||nj.style("visibility","hidden"),bh||(oj.style("visibility","hidden"),Ti=Cc(Ef.data.targets)),pj=Df.select(Gf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),yf(Cc(Ef.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=mj.append("g").attr("clip-path",Di).attr("class",f.grid),Sh&&d.append("g").attr("class",f.xgrids),Be(Uh)&&d.append("g").attr("class",f.xgridLines),$h&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),Vh&&d.append("g").attr("class",f.ygrids),Be(Wh)&&d.append("g").attr("class",f.ygridLines),ih&&mj.append("g").attr("class",f.axisX).attr("clip-path",Ei).attr("transform",Yi.x).append("text").attr("class",f.axisXLabel).attr("transform",hh?"rotate(-90)":"").style("text-anchor",zb),Ah&&mj.append("g").attr("class",f.axisY).attr("clip-path",Fi).attr("transform",Yi.y).append("text").attr("class",f.axisYLabel).attr("transform",hh?"":"rotate(-90)").style("text-anchor",Ab),Jh&&mj.append("g").attr("class",f.axisY2).attr("transform",Yi.y2).append("text").attr("class",f.axisY2Label).attr("transform",hh?"":"rotate(-90)").style("text-anchor",Bb),mj.append("g").attr("clip-path",Di).attr("class",f.regions),mj.append("g").attr("clip-path",Di).attr("class",f.chart),c=mj.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",Lf?hh?"ns-resize":"ew-resize":null),mj.select("."+f.chart).append("g").attr("class",f.chartBars),mj.select("."+f.chart).append("g").attr("class",f.chartLines),mj.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",Yi.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Rb()),mj.select("."+f.chart).append("g").attr("class",f.chartTexts),Lf&&mj.insert("rect",Nf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",Wf).attr("height",Yf).style("opacity",0).style("cursor",hh?"ns-resize":"ew-resize").call(jj).on("dblclick.zoom",null),yh&&fj.extent("function"!=typeof yh?yh:yh(_b())),nj.append("g").attr("clip-path",Di).attr("class",f.chart),nj.select("."+f.chart).append("g").attr("class",f.chartBars),nj.select("."+f.chart).append("g").attr("class",f.chartLines),nj.append("g").attr("clip-path",Di).attr("class",f.brush).call(fj).selectAll("rect").attr(hh?"width":"height",hh?Xf:Zf),nj.append("g").attr("class",f.axisX).attr("transform",Yi.subx).attr("clip-path",hh?"":Ei),of(Ef.data.targets),hh?mj.select("."+f.axisX).style("opacity",0).call(vg):(mj.select("."+f.axisY).style("opacity",0).call(wg),mj.select("."+f.axisY2).style("opacity",0).call(xg)),n(),R(),mf(),m(!1),hf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),xi){if(Gi&&"string"==typeof yi){for(yi=we(yi),e=0;e0){d=[];for(var g in Dg)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 ff(a){he(Ef.data.targets)||Pg&&(Ji=a,mj.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Ki=!0,Yg())}function gf(){he(Ef.data.targets)||Pg&&(mj.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),mj.selectAll("."+f.shape).classed(f.INCLUDED,!1),Ki=!1,Zg())}function hf(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(Ef.data.targets),_=Ic(Ef.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?Sf:0,U=H?T:0,V=I?T:0,c=mj.select("."+f.axisX).style("opacity",$?0:1),g=mj.select("."+f.axisY).style("opacity",$?0:1),h=mj.select("."+f.axisY2).style("opacity",$?0:1),e=nj.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&&bh&&yf(Cc(Ef.data.targets),a,S),Hi&&(0!==_.length&&M&&K||pg.domain([0,c.selectAll(".tick").size()])),_.length&&(M&&(pg.domain(Df.extent(_b(_))),rj=pg.domain(),Lf&&jj.scale(pg).updateScaleExtent(),sg.domain(pg.domain()),fj.scale(sg)),K&&(pg.domain(fj.empty()?rj:fj.extent()),Lf&&jj.scale(pg).updateScaleExtent()),sh||!rh&&!qh||(W=Kc(Jc(_),qh),vg.tickValues(W),yg.tickValues(W))),qg.domain(Xb(_,"y")),rg.domain(Xb(_,"y2")),S.axisX.call(vg),S.axisY.call(wg),S.axisY2.call(xg),S.axisSubX.call(yg),K&&_.length)if(oh&&W){for(X=1;X=0&&Df.select(this).style("display",b%Y?"none":"block")})}else kj.selectAll("."+f.axisX+" .tick text").style("display","block");if(!hh&&th&&eb(c,S.axisX,th),O=We(Z),Q=Xe(Z,!0),R=Xe(Z,!1),Db(),tg.domain(qg.domain()),ug.domain(rg.domain()),pj.style("display","none"),o(),mj.select("line."+f.xgridFocus).style("visibility","hidden"),Sh){if("year"===Th){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=pg.ticks(10);i=mj.select("."+f.xgrids).selectAll("."+f.xgrid).data(j),i.enter().append("line").attr("class",f.xgrid),i.attr("x1",hh?0:function(a){return pg(a)-vg.tickOffset()}).attr("x2",hh?Wf:function(a){return pg(a)-vg.tickOffset()}).attr("y1",hh?function(a){return pg(a)-vg.tickOffset()}:Tf.top).attr("y2",hh?function(a){return pg(a)-vg.tickOffset()}:Yf).style("opacity",function(){return+Df.select(this).attr(hh?"y1":"x1")===(hh?Yf:0)?0:1}),i.exit().remove()}Be(Uh)&&(k=mj.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(Uh),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",hh?"":"rotate(-90)").attr("dx",hh?0:-Tf.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(T).attr("x1",hh?0:Gd).attr("x2",hh?Wf:Gd).attr("y1",hh?Gd:Tf.top).attr("y2",hh?Gd:Yf).style("opacity",1),k.select("text").transition().duration(T).attr("x",hh?Wf:0).attr("y",Gd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(T).style("opacity",0).remove()),E&&Vh&&(m=mj.select("."+f.ygrids).selectAll("."+f.ygrid).data(qg.ticks(Xh)),m.enter().append("line").attr("class",f.ygrid),m.attr("x1",hh?qg:0).attr("x2",hh?qg:Wf).attr("y1",hh?0:qg).attr("y2",hh?Yf:qg),m.exit().remove()),E&&Be(Wh)&&(n=mj.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(Wh),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",hh?"rotate(-90)":"").attr("dx",hh?0:-Tf.top).attr("dy",-5).style("opacity",0),n.select("line").transition().duration(T).attr("x1",hh?Hd:0).attr("x2",hh?Hd:Wf).attr("y1",hh?0:Hd).attr("y2",hh?Yf:Hd).style("opacity",1),n.select("text").transition().duration(T).attr("x",hh?0:Wf).attr("y",Hd).text(function(a){return a.text}).style("opacity",1),n.exit().transition().duration(T).style("opacity",0).remove()),v=mj.select("."+f.regions).selectAll("rect."+f.region).data(si),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=mj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),t.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Pi),t.style("opacity",td).transition().duration(T).attr("d",O).style("opacity",1),t.exit().transition().duration(U).style("opacity",0).remove(),q=mj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),q.enter().append("path").attr("class",Zc).style("stroke",Pi),q.style("opacity",td).transition().duration(T).attr("d",gj).style("opacity",1),q.exit().transition().duration(U).style("opacity",0).remove(),r=mj.selectAll("."+f.areas).selectAll("."+f.area).data(pe),r.enter().append("path").attr("class",fd).style("fill",Pi).style("opacity",function(){return sj=+Df.select(this).style("opacity"),0}),r.style("opacity",0).transition().duration(T).attr("d",hj).style("opacity",sj),r.exit().transition().duration(U).style("opacity",0).remove(),s=mj.selectAll("."+f.circles).selectAll("."+f.circle).data(se),s.enter().append("circle").attr("class",_c).attr("r",Ne),s.style("opacity",td).transition().duration(T).style("opacity",vd).attr("cx",hh?Xd:Wd).attr("cy",hh?Wd:Xd),s.exit().remove(),w=mj.selectAll("."+f.texts).selectAll("."+f.text).data(te),w.enter().append("text").attr("class",Vc).attr("text-anchor",function(a){return hh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).style("fill-opacity",wd),w.exit().transition().duration(U).style("fill-opacity",0).remove(),u=mj.selectAll("."+f.arcs).selectAll("."+f.arc).data(qe),u.enter().append("path").attr("class",dd).style("fill",function(a){return Pi(a.data)}).style("cursor",function(a){return Rg(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Ni||(c=Fb(a),d=Lb(c),e=Tb(),Nb(c.data.id),uf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Fb(a),c=Lb(b),d=[c];Sd(d,Df.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Ni||(c=Fb(a),d=Lb(c),e=Ub(),Ob(c.data.id),vf(),Td(),e(d,b))}).on("click",function(a,b){var c=Fb(a),d=Lb(c),e=Sb();df(this,a,b),e(d,b)}),u.attr("transform",J?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Ni=!0}).transition().duration(T).attrTween("d",function(a){var b,c=Fb(a);return c?(b=Df.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("opacity",1).call(Ee,function(){Ni=!1}),u.exit().transition().duration(U).style("opacity",0).remove(),mj.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}),mj.select("."+f.chartArcsTitle).style("opacity",ge(Ef.data.targets)?1:0),$g&&(null!==Df.event&&"zoom"===Df.event.type&&fj.extent(pg.orgDomain()).update(),F&&(!hh&&th&&eb(e,S.axisSubX,th),fj.empty()||fj.extent(pg.orgDomain()).update(),P=We(Z,!0),y=nj.selectAll("."+f.bars).selectAll("."+f.bar).data(re),y.enter().append("path").attr("class",bd).style("stroke","none").style("fill",Pi),y.style("opacity",td).transition().duration(T).attr("d",P).style("opacity",1),y.exit().transition().duration(T).style("opacity",0).remove(),x=nj.selectAll("."+f.lines).selectAll("."+f.line).data(pe),x.enter().append("path").attr("class",Zc).style("stroke",Pi),x.style("opacity",td).transition().duration(T).attr("d",ij).style("opacity",1),x.exit().transition().duration(T).style("opacity",0).remove())),mj.selectAll("."+f.selectedCircles).filter(function(a){return ke(a)}).selectAll("circle").remove(),mj.selectAll("."+f.selectedCircle).transition().duration(T).attr("cx",hh?Xd:Wd).attr("cy",hh?Wd:Xd),z=mj.select("."+f.eventRects),Be(Ag)&&!oc(Ag)?(z.classed(f.eventRectsMultiple)||z.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),A=mj.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),cf(A.enter()),A.attr("x",0).attr("y",0).attr("width",Wf).attr("height",Yf)):(z.classed(f.eventRectsSingle)||z.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Ii&&!Hi?(D=function(a,b){var c=xc(b),d=yc(b),e=Ef.data.xs[a.id][b];return(pg(d?d:e+50)-pg(c?c:e-50))/2},C=function(a,b){var c=xc(b),d=Ef.data.xs[a.id][b];return(pg(d)+pg(c?c:d-50))/2}):(D=L(),C=function(a){return pg(a.x)-D/2}),B=Ac(Ef.data.targets),mj.select("."+f.eventRects).datum(B?B.values:[]),A=mj.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),bf(A.enter()),A.attr("class",id).attr("x",hh?0:C).attr("y",hh?C:0).attr("width",hh?Wf:D).attr("height",hh?D:Yf),A.exit().remove()),Cc(Ef.data.targets).forEach(function(a){tj[a]=!0})}function jf(){hf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function kf(){return"mousemove"===Df.event.sourceEvent.type&&jj.altDomain?(pg.domain(jj.altDomain),void jj.scale(pg).updateScaleExtent()):(Hi&&pg.orgDomain()[0]===rj[0]&&pg.domain([rj[0]-1e-10,pg.orgDomain()[1]]),hf({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===Df.event.sourceEvent.type&&(Li=!0)))}function lf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function mf(){kj.attr("width",$f).attr("height",_f),kj.select("#"+Ai).select("rect").attr("width",Wf).attr("height",Yf),kj.select("#"+Bi).select("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),kj.select("#"+Ci).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),kj.select("."+f.zoomRect).attr("width",Wf).attr("height",Yf),qj.style("max-height",_f+"px")}function nf(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(),mf(),m(a.withTransition),hf(a)}function of(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=mj.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).style("fill",function(a){return Pi(a)}),e=mj.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 Rg(a)?"pointer":null}),c=mj.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("fill",Pi).style("cursor",function(a){return Rg(a)?"pointer":null}),a.forEach(function(a){mj.selectAll("."+f.selectedCircles+od(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=mj.select("."+f.chartArcs).selectAll("."+f.chartArc).data(gg(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=nj.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=nj.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)),kj.selectAll("."+f.target).filter(function(a){return Gc(a.id)}).transition().duration(Sf).style("opacity",1)}function pf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?be(a.id,b.types[a.id]):be(a.id,b.type)}),Ef.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=Zi?j:i,l=Zi?Q():P();return d&&(w=0,C=0,t=0,u=0),bh&&!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=Zi?u:t,void(gh?(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=oj.selectAll("."+f.legendItemFocused).size();b=b||{},p=d(b.withTransition)?b.withTransition:!0,q=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,Zi?(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=oj.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 dh?dh(a):Ef.toggle(a)}).on("mouseover",function(a){Df.select(this).classed(f.legendItemFocused,!0),Ni||Ef.focus(a),"function"==typeof eh&&eh(a)}).on("mouseout",function(a){Df.select(this).classed(f.legendItemFocused,!1),Ni||Ef.revert(),"function"==typeof fh&&fh(a)}),o.append("text").text(function(a){return d(Dg[a])?Dg[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",Zi?h:-200).attr("y",Zi?-200:k),o.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",Zi?i:-200).attr("y",Zi?-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",function(a){return Pi(a)}).attr("x",Zi?h:-200).attr("y",Zi?-200:j).attr("width",10).attr("height",10),oj.selectAll("text").data(a).text(function(a){return d(Dg[a])?Dg[a]:a}).each(function(a,b){e(this,a,0===b)}).transition().duration(p?250:0).attr("x",h).attr("y",k),oj.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(p?250:0).attr("x",i).attr("y",l),oj.selectAll("rect."+f.legendItemTile).data(a).transition().duration(p?250:0).attr("x",g).attr("y",j),oj.selectAll("."+f.legendItem).classed(f.legendItemHidden,function(a){return!Gc(a)}).transition().style("opacity",function(a){var b=Df.select(this);return Gc(a)?!D||b.classed(f.legendItemFocused)?sf(b):tf(b):bj}),N(t),O(u),M(C),n(),R(),mf(),m(q,c)}function zf(a){return Ec(Ef.data.targets,a.id)}function Af(a){return"data"in a&&Ec(Ef.data.targets,a.data.id)}function Bf(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 Cf(a,b,c){var d=!he(Ef.data.targets);Ni=!1,be(a,b),nf(c||{withTransitionForAxis:d})}var Df=a.d3?a.d3:a.require?a.require("d3"):void 0,Ef={data:{},axis:{},legend:{}},Ff={},Gf=h(["bindto"],"#chart"),Hf=h(["size","width"]),If=h(["size","height"]),Jf=h(["padding","left"],50),Kf=h(["padding","right"]),Lf=h(["zoom","enabled"],!1),Mf=h(["zoom","extent"]),Nf=h(["zoom","privileged"],!1),Of=h(["onenter"],function(){}),Pf=h(["onleave"],function(){}),Qf=h(["onresize"],function(){}),Rf=h(["onresized"],function(){}),Sf=h(["transition","duration"],350);g("data","data is required in config");var Tf,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=h(["data","x"]),Ag=h(["data","xs"],{}),Bg=h(["data","x_format"]),Cg=h(["data","id_converter"],function(a){return a}),Dg=h(["data","names"],{}),Eg=h(["data","classes"],{}),Fg=h(["data","groups"],[]),Gg=h(["data","axes"],{}),Hg=h(["data","type"]),Ig=h(["data","types"],{}),Jg=h(["data","labels"],{}),Kg=h(["data","order"]),Lg=h(["data","regions"],{}),Mg=h(["data","color"]),Ng=h(["data","colors"],{}),Og=h(["data","hide"],!1),Pg=h(["data","selection","enabled"],!1),Qg=h(["data","selection","grouped"],!1),Rg=h(["data","selection","isselectable"],function(){return!0}),Sg=h(["data","selection","multiple"],!0),Tg=h(["data","onclick"],function(){}),Ug=h(["data","onenter"],function(){}),Vg=h(["data","onleave"],function(){}),Wg=h(["data","onselected"],function(){}),Xg=h(["data","onunselected"],function(){}),Yg=h(["data","ondragstart"],function(){}),Zg=h(["data","ondragend"],function(){}),$g=h(["subchart","show"],!1),_g=h(["subchart","size","height"],60),ah=h(["color","pattern"],[]),bh=h(["legend","show"],!0),ch=h(["legend","position"],"bottom"),dh=h(["legend","item","onclick"]),eh=h(["legend","item","onmouseover"]),fh=h(["legend","item","onmouseout"]),gh=h(["legend","equally"],!1),hh=h(["axis","rotated"],!1),ih=h(["axis","x","show"],!0),jh=h(["axis","x","type"],"indexed"),kh=h(["axis","x","localtime"],!0),lh=h(["axis","x","categories"],[]),mh=h(["axis","x","tick","centered"],!1),nh=h(["axis","x","tick","format"]),oh=h(["axis","x","tick","culling"],{}),ph=h(["axis","x","tick","culling","max"],10),qh=h(["axis","x","tick","count"]),rh=h(["axis","x","tick","fit"],!0),sh=h(["axis","x","tick","values"],null),th=h(["axis","x","tick","rotate"]),uh=h(["axis","x","max"],null),vh=h(["axis","x","min"],null),wh=h(["axis","x","padding"],{}),xh=h(["axis","x","height"]),yh=h(["axis","x","default"]),zh=h(["axis","x","label"],{}),Ah=h(["axis","y","show"],!0),Bh=h(["axis","y","max"]),Ch=h(["axis","y","min"]),Dh=h(["axis","y","center"]),Eh=h(["axis","y","label"],{}),Fh=h(["axis","y","inner"],!1),Gh=h(["axis","y","tick","format"]),Hh=h(["axis","y","padding"]),Ih=h(["axis","y","ticks"],10),Jh=h(["axis","y2","show"],!1),Kh=h(["axis","y2","max"]),Lh=h(["axis","y2","min"]),Mh=h(["axis","y2","center"]),Nh=h(["axis","y2","label"],{}),Oh=h(["axis","y2","inner"],!1),Ph=h(["axis","y2","tick","format"]),Qh=h(["axis","y2","padding"]),Rh=h(["axis","y2","ticks"],10),Sh=h(["grid","x","show"],!1),Th=h(["grid","x","type"],"tick"),Uh=h(["grid","x","lines"],[]),Vh=h(["grid","y","show"],!1),Wh=h(["grid","y","lines"],[]),Xh=h(["grid","y","ticks"],10),Yh=h(["point","show"],!0),Zh=h(["point","r"],2.5),$h=h(["point","focus","line","enabled"],!0),_h=h(["point","focus","expand","enabled"],!0),ai=h(["point","focus","expand","r"]),bi=h(["point","focus","select","r"]),ci=h(["line","connect_null"],!1),di=h(["bar","width"]),ei=h(["bar","width","ratio"],.6),fi=h(["pie","label","show"],!0),gi=h(["pie","label","format"]),hi=h(["pie","expand"],!0),ii=h(["pie","onclick"],function(){}),ji=h(["pie","onmouseover"],function(){}),ki=h(["pie","onmouseout"],function(){}),li=h(["donut","label","show"],!0),mi=h(["donut","label","format"]),ni=h(["donut","expand"],!0),oi=h(["donut","title"],""),pi=h(["donut","onclick"],function(){}),qi=h(["donut","onmouseover"],function(){}),ri=h(["donut","onmouseout"],function(){}),si=h(["regions"],[]),ti=h(["tooltip","show"],!0),ui=h(["tooltip","format","title"]),vi=h(["tooltip","format","value"]),wi=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=ui?ui:b,l=vi?vi: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+""}),xi=h(["tooltip","init","show"],!1),yi=h(["tooltip","init","x"],0),zi=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Ai=("string"==typeof Gf?Gf.replace("#",""):Gf.id)+"-clip",Bi=Ai+"-xaxis",Ci=Ai+"-yaxis",Di=i(Ai),Ei=i(Bi),Fi=i(Ci),Gi="timeseries"===jh,Hi="categorized"===jh,Ii=!Gi&&(zg||Be(Ag)),Ji=null,Ki=!1,Li=!1,Mi=!1,Ni=!1,Oi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Pi=ve(Ng,Be(ah)?ah:Oi,Mg),Qi=kh?Df.time.format:Df.time.format.utc,Ri=function(){var a=[[Qi("%Y/%-m/%-d"),function(){return!0}],[Qi("%-m/%-d"),function(a){return a.getMonth()}],[Qi("%-m/%-d"),function(a){return 1!==a.getDate()}],[Qi("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[Qi("%I %p"),function(a){return a.getHours()}],[Qi("%I:%M"),function(a){return a.getMinutes()}],[Qi(":%S"),function(a){return a.getSeconds()}],[Qi(".%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)}}(),Si=[],Ti=[],Ui=hh?"left":"bottom",Vi=hh?Fh?"top":"bottom":Fh?"right":"left",Wi=hh?Oh?"bottom":"top":Oh?"left":"right",Xi=hh?"left":"bottom",Yi={main:function(){return"translate("+Tf.left+","+Tf.top+")"},context:function(){return"translate("+Uf.left+","+Uf.top+")"},legend:function(){return"translate("+Vf.left+","+Vf.top+")"},x:function(){return"translate(0,"+(hh?0:Yf)+")"},y:function(){return"translate(0,"+(hh?Yf:0)+")"},y2:function(){return"translate("+(hh?0:Wf)+","+(hh?1:0)+")"},subx:function(){return"translate(0,"+(hh?0:Zf)+")"},arc:function(){return"translate("+Wf/2+","+Yf/2+")"}},Zi="right"===ch,$i=0,_i=0,aj=0,bj=.15,cj=30,dj=hh&&!ih?0:30,ej=5;gg=Df.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var fj,gj=function(){var a=Df.svg.line().x(hh?function(a){return V(a.id)(a.value)}:Fd).y(hh?Fd:function(a){return V(a.id)(a.value)});return ci||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ci?Me(b.values):b.values;return ie(b)?(a.interpolate(je(b)?"cardinal":"linear"),Lg[b.id]?_e(e,pg,V(b.id),Lg[b.id]):a(e)):(c=e[0]?pg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,hh?"M "+d+" "+c:"M "+c+" "+d)}}(),hj=function(){var a;return a=hh?Df.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Fd):Df.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=Me(b.values);return ce([b],"area")||ce([b],"area-spline")?(a.interpolate(je(b)?"cardinal":"linear"),a(e)):(c=e[0]?pg(e[0].x):0,d=e[0]?V(b.id)(e[0].value):0,hh?"M "+d+" "+c:"M "+c+" "+d)}}(),ij=function(){var a=Df.svg.line().x(hh?function(a){return W(a.id)(a.value)}:Id).y(hh?Id:function(a){return W(a.id)(a.value)});return function(b){var c=Me(b.values);return ie(b)?a(c):"M "+sg(c[0].x)+" "+W(b.id)(c[0].value)}}(),jj=function(){};fj=Df.svg.brush().on("brush",jf),fj.update=function(){return nj&&nj.select("."+f.brush).call(this),this},fj.scale=function(a){return hh?this.y(a):this.x(a)},Lf&&(jj=Df.behavior.zoom().on("zoomstart",function(){jj.altDomain=Df.event.sourceEvent.altKey?pg.orgDomain():null}).on("zoom",Lf?kf:null),jj.scale=function(a){return hh?this.y(a):this.x(a)},jj.orgScaleExtent=function(){var a=Mf?Mf:[1,10];return[a[0],Math.max(zc()/a[1],a[1])]},jj.updateScaleExtent=function(){var a=ac(pg.orgDomain())/ac(rj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var kj,lj,mj,nj,oj,pj,qj,rj,sj,tj={};if(Ef.focus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=kj.selectAll(pd(a)),d=c.filter(zf),e=c.filter(Af);Ef.revert(),Ef.defocus(),b(d.classed(f.focused,!0)),b(e),he(Ef.data.targets)&&Nb(a,!0),uf(a,!0)},Ef.defocus=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",.3)}var c=kj.selectAll(pd(a)),d=c.filter(zf),e=c.filter(Af);Ef.revert(),b(d.classed(f.focused,!1)),b(e),he(Ef.data.targets)&&Ob(a),uf(a,!1)},Ef.revert=function(a){function b(a){Ic(a).transition().duration(100).style("opacity",1)}var c=kj.selectAll(pd(a)),d=c.filter(zf),e=c.filter(Af);b(d.classed(f.focused,!1)),b(e),he(Ef.data.targets)&&Ob(a),vf()},Ef.show=function(a,b){a=Dc(a),b=b||{},Mc(a),kj.selectAll(qd(a)).transition().style("opacity",1),b.withLegend&&wf(a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ef.hide=function(a,b){a=Dc(a),b=b||{},Lc(a),kj.selectAll(qd(a)).transition().style("opacity",0),b.withLegend&&xf(a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Ef.toggle=function(a){Gc(a)?Ef.hide(a):Ef.show(a)},Ef.unzoom=function(){fj.clear().update(),hf({withUpdateXDomain:!0})},Ef.load=function(a){return a.xs&&nc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Eg[b]=a.classes[b]}),"categories"in a&&Hi&&(lh=a.categories,vg.categories(lh)),"cacheIds"in a&&bc(a.cacheIds)?void pf(dc(a.cacheIds),a.done):void("unload"in a?rf(Dc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){qf(a)}):qf(a))},Ef.unload=function(a,b){rf(Dc(a),function(){hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Ef.selected=function(a){return Df.merge(mj.selectAll("."+f.shapes+od(a)).selectAll("."+f.shape).filter(function(){return Df.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Ef.select=function(a,b,c){Pg&&mj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=Df.select(this),i="circle"===this.nodeName?Fe:Ie,j="circle"===this.nodeName?Ge:Je,k=Qg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?Rg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},Ef.unselect=function(a,b){Pg&&mj.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=Df.select(this),g="circle"===this.nodeName?Ge:Je,h=Qg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED); -h&&i&&Rg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},Ef.toLine=function(a){Cf(a,"line")},Ef.toSpline=function(a){Cf(a,"spline")},Ef.toBar=function(a){Cf(a,"bar")},Ef.toScatter=function(a){Cf(a,"scatter")},Ef.toArea=function(a){Cf(a,"area")},Ef.toAreaSpline=function(a){Cf(a,"area-spline")},Ef.toPie=function(a){Cf(a,"pie",{withTransform:!0})},Ef.toDonut=function(a){Cf(a,"donut",{withTransform:!0})},Ef.groups=function(a){return c(a)?Fg:(Fg=a,hf(),Fg)},Ef.xgrids=function(a){return a?(Uh=a,hf(),Uh):Uh},Ef.xgrids.add=function(a){return a?Ef.xgrids(Uh.concat(a)):void 0},Ef.xgrids.remove=function(a){var b=Bf(a);return Ef.xgrids(Uh.filter(b))},Ef.ygrids=function(a){return a?(Wh=a,hf(),Wh):Wh},Ef.ygrids.add=function(a){return a?Ef.ygrids(Wh.concat(a)):void 0},Ef.ygrids.remove=function(a){var b=Bf(a);return Ef.ygrids(Wh.filter(b))},Ef.regions=function(a){return c(a)?si:(si=a,hf(),si)},Ef.regions.add=function(a){return c(a)?si:(si=si.concat(a),hf(),si)},Ef.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;kj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),si=si.filter(function(b){return b.classes.indexOf(a)<0})}),si},Ef.data.get=function(a){var b=Ef.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Ef.data.getAsTarget=function(a){var b=Fc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Ef.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Dg[b]=a[b]}),yf(Cc(Ef.data.targets),{withTransition:!0}),Dg):Dg},Ef.x=function(a){return arguments.length&&(qc(Ef.data.targets,a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ef.data.xs},Ef.xs=function(a){return arguments.length&&(rc(Ef.data.targets,a),hf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Ef.data.xs},Ef.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Db())},Ef.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Bh=+a.y),b(a.y2)&&(Kh=+a.y2)):Bh=Kh=+a,hf())},Ef.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ch=+a.y),b(a.y2)&&(Lh=+a.y2)):Ch=Lh=+a,hf())},Ef.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Ef.axis.max(a.max),"undefined"!=typeof a.min&&Ef.axis.min(a.min))},Ef.legend.show=function(a){wf(Dc(a)),hf({withLegend:!0})},Ef.legend.hide=function(a){xf(Dc(a)),hf({withLegend:!0})},Ef.resize=function(a){Hf=a?a.width:null,If=a?a.height:null,nf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Ef.destroy=function(){Ef.data.targets=void 0,Ef.data.xs={},qj.html(""),a.onresize=null},"url"in e.data)Df.xhr(e.data.url,function(a,b){var c,d=Df.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Df.csv.parse(b.response),af(c)});else if("rows"in e.data)af(tc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");af(uc(e.data.columns))}return Ef},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window); \ No newline at end of file +!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={version:"0.1.33"},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):g in a?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("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("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("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),s.style("opacity",td).transition().duration(T).style("opacity",vd).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-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).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("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).style("fill",function(a){return Qi(a)}),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("fill",Qi).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",function(a){return Qi(a)}).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).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.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 From 18b5178a0083b92468fff626c75e72903247a1b3 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 10:45:02 +0900 Subject: [PATCH 35/38] Update version to 0.1.34 --- bower.json | 2 +- c3.js | 2 +- c3.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 069e26d..a918d0e 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "c3", "main": "c3.min.js", - "version": "0.1.33", + "version": "0.1.34", "homepage": "https://github.com/masayuki0812/c3", "authors": [ "Masayuki Tanaka " diff --git a/c3.js b/c3.js index 34f188a..cb28135 100644 --- a/c3.js +++ b/c3.js @@ -2,7 +2,7 @@ 'use strict'; var c3 = { - version: "0.1.33" + version: "0.1.34" }; var CLASS = { diff --git a/c3.min.js b/c3.min.js index 29ba482..29a26bd 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.33"},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):g in a?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;eXf&&(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):g in a?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("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("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("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),s.style("opacity",td).transition().duration(T).style("opacity",vd).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-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).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("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).style("fill",function(a){return Qi(a)}),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("fill",Qi).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",function(a){return Qi(a)}).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).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.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 diff --git a/package.json b/package.json index fd94236..f43f502 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c3", - "version": "0.1.33", + "version": "0.1.34", "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { From 150dd26ff31132140a0decf86d3c04d0e271d4be Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 14:17:48 +0900 Subject: [PATCH 36/38] Fix trivial --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index cb28135..a325256 100644 --- a/c3.js +++ b/c3.js @@ -3783,7 +3783,7 @@ .style("pointer-events", "none"); mainTextEnter.append('g') .attr('class', classTexts) - .style("fill", function (d) { return color(d); }); + .style("fill", color); //-- Bar --// mainBarUpdate = main.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar) From 7bead89c743068ec954de4739ced94f2e78bf81f Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 14:25:19 +0900 Subject: [PATCH 37/38] Update color of bar when update - #196 --- c3.js | 1 + c3.min.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/c3.js b/c3.js index a325256..3da8586 100644 --- a/c3.js +++ b/c3.js @@ -3405,6 +3405,7 @@ .style("opacity", initialOpacity) .transition().duration(duration) .attr('d', drawBar) + .style("fill", color) .style("opacity", 1); mainBar.exit().transition().duration(durationForExit) .style('opacity', 0) diff --git a/c3.min.js b/c3.min.js index 29a26bd..aa6b5fb 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):g in a?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("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("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("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),s.style("opacity",td).transition().duration(T).style("opacity",vd).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-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).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("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).style("fill",function(a){return Qi(a)}),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("fill",Qi).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",function(a){return Qi(a)}).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).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) +}qj.html(xi(Ff.data.targets.map(function(a){return pc(a.values[zi])}),$(),zd(he(Ff.data.targets)),Qi)),qj.style("top",Ai.top).style("left",Ai.left).style("display","block")}null==a.onresize&&(a.onresize=mf()),a.onresize.add&&(a.onresize.add(Rf),a.onresize.add(function(){of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Sf))}function cf(a){a.append("rect").attr("class",id).style("cursor",Qg&&Rg?"pointer":null).on("mouseover",function(a,b){if(!Li&&!he(Ff.data.targets)){var c,d,e=Ff.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(Eg).length>0){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("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("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),s.style("opacity",td).transition().duration(T).style("opacity",vd).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-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).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("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).style("fill",Qi),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("fill",Qi).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",function(a){return Qi(a)}).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).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.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 From c8cec6f6bf978c5ea722d683c2f947d6c1cf3371 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 2 May 2014 15:19:43 +0900 Subject: [PATCH 38/38] Add id for data.labels.format - #190 --- c3.js | 2 +- c3.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 3da8586..4ab19e7 100644 --- a/c3.js +++ b/c3.js @@ -3462,7 +3462,7 @@ .style("stroke", 'none') .style("fill-opacity", 0); mainText - .text(function (d) { return formatByAxisId(d.id)(d.value); }) + .text(function (d) { return formatByAxisId(d.id)(d.value, d.id); }) .style("fill-opacity", initialOpacityForText) .transition().duration(duration) .attr('x', xForText) diff --git a/c3.min.js b/c3.min.js index aa6b5fb..4fe0f02 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):g in a?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("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("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),s.style("opacity",td).transition().duration(T).style("opacity",vd).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-opacity",0),w.text(function(a){return Ed(a.id)(a.value)}).style("fill-opacity",ud).transition().duration(T).attr("x",Q).attr("y",R).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("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).style("fill",Qi),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("fill",Qi).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",function(a){return Qi(a)}).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).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) +}qj.html(xi(Ff.data.targets.map(function(a){return pc(a.values[zi])}),$(),zd(he(Ff.data.targets)),Qi)),qj.style("top",Ai.top).style("left",Ai.left).style("display","block")}null==a.onresize&&(a.onresize=mf()),a.onresize.add&&(a.onresize.add(Rf),a.onresize.add(function(){of({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})}),a.onresize.add(Sf))}function cf(a){a.append("rect").attr("class",id).style("cursor",Qg&&Rg?"pointer":null).on("mouseover",function(a,b){if(!Li&&!he(Ff.data.targets)){var c,d,e=Ff.data.targets.map(function(a){return pc(a.values[b])});if(Object.keys(Eg).length>0){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("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("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),s.style("opacity",td).transition().duration(T).style("opacity",vd).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-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-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("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).style("fill",Qi),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("fill",Qi).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",function(a){return Qi(a)}).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).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.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