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