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