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