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