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