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