From eb08e08b0758aba10d06e4147dfd3d3a9de7077e Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Wed, 30 Apr 2014 22:24:42 +0900 Subject: [PATCH] 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