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