diff --git a/c3.js b/c3.js index bc0abc9..3326019 100644 --- a/c3.js +++ b/c3.js @@ -130,10 +130,20 @@ __point_onselected = getConfig(['point', 'onselected'], function () {}), __point_onunselected = getConfig(['point', 'onunselected'], function () {}); - // arc - var __arc_label_show = getConfig(['arc', 'label', 'show'], true), - __arc_label_format = getConfig(['arc', 'label', 'format'], null), - __arc_title = getConfig(['arc', 'title'], ""); + // pie + var __pie_label_show = getConfig(['pie', 'label', 'show'], true), + __pie_label_format = getConfig(['pie', 'label', 'format'], null), + __pie_onclick = getConfig(['pie', 'onclick'], function () {}), + __pie_onmouseover = getConfig(['pie', 'onmouseover'], function () {}), + __pie_onmouseout = getConfig(['pie', 'onmouseout'], function () {}); + + // donut + var __donut_label_show = getConfig(['donut', 'label', 'show'], true), + __donut_label_format = getConfig(['donut', 'label', 'format'], null), + __donut_title = getConfig(['donut', 'title'], ""), + __donut_onclick = getConfig(['donut', 'onclick'], function () {}), + __donut_onmouseover = getConfig(['donut', 'onmouseover'], function () {}), + __donut_onmouseout = getConfig(['donut', 'onmouseout'], function () {}); // region - region to change style var __regions = getConfig(['regions'], []); @@ -701,11 +711,19 @@ function getArcRatio(d) { return (d.endAngle - d.startAngle) / (Math.PI * 2); } + function convertToArcData(d) { + return addName({ + id: d.data.id, + value: d.value, + ratio: getArcRatio(d) + }); + } function textForArcLabel(d) { - var ratio; - if (! __arc_label_show) { return ""; } + var ratio, format; + if (! shouldShowArcLable()) { return ""; } ratio = getArcRatio(d); - return __arc_label_format ? __arc_label_format(d.value, ratio) : defaultArcValueFormat(d.v, ratio); + format = getArcLabelFormat(); + return format ? format(d.value, ratio) : defaultArcValueFormat(d.v, ratio); } function expandArc(id, withoutFadeOut) { var target = svg.selectAll('.chart-arc' + getTargetSelector(id)), @@ -732,6 +750,27 @@ svg.selectAll('.-arc') .style("opacity", 1); } + function shouldShowArcLable() { + return hasDonutType(c3.data.targets) ? __donut_label_show : __pie_label_show; + } + function getArcLabelFormat() { + return hasDonutType(c3.data.targets) ? __donut_label_format : __pie_label_format; + } + function getArcTitle() { + return hasDonutType(c3.data.targets) ? __donut_title : ""; + } + function getArcOnClick() { + var callback = hasDonutType(c3.data.targets) ? __donut_onclick : __pie_onclick; + return typeof callback === 'function' ? callback : function () {}; + } + function getArcOnMouseOver() { + var callback = hasDonutType(c3.data.targets) ? __donut_onmouseover : __pie_onmouseover; + return typeof callback === 'function' ? callback : function () {}; + } + function getArcOnMouseOut() { + var callback = hasDonutType(c3.data.targets) ? __donut_onmouseout : __pie_onmouseout; + return typeof callback === 'function' ? callback : function () {}; + } //-- Domain --// @@ -2011,7 +2050,7 @@ .append('text') .attr('class', 'chart-arcs-title') .style("text-anchor", "middle") - .text(__arc_title); + .text(getArcTitle()); main.select(".chart").append("g") .attr("class", "chart-texts"); @@ -2898,22 +2937,26 @@ .style("fill", function (d) { return color(d.data.id); }) .style("cursor", function (d) { return __data_selection_isselectable(d) ? "pointer" : null; }) .each(function (d) { this._current = d; }) - .on('mouseover', function (d) { + .on('mouseover', function (d, i) { + var arcData = convertToArcData(d), callback = getArcOnMouseOver(); expandArc(d.data.id); focusLegend(d.data.id); + callback(arcData, i); }) .on('mousemove', function (d) { - var selectedData = [addName({ - id: d.data.id, - value: d.value, - ratio: getArcRatio(d) - })]; + var selectedData = [convertToArcData(d)]; showTooltip(selectedData, d3.mouse(this)); }) - .on('mouseout', function (d) { + .on('mouseout', function (d, i) { + var arcData = convertToArcData(d), callback = getArcOnMouseOut(); unexpandArc(d.data.id); revertLegend(); hideTooltip(); + callback(arcData, i); + }) + .on('click', function (d, i) { + var arcData = convertToArcData(d), callback = getArcOnClick(); + callback(arcData, i); }); mainPieEnter.append("text") .attr("dy", ".35em") diff --git a/c3.min.js b/c3.min.js index 5a79750..eacd3a3 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,2 +1,2 @@ -!function(a){"use strict";function b(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+q)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return p>=c||b%Math.ceil(c/p)===0}function f(a){return a0?a:320}function t(){return kd(re.data.targets)?0:ze?ze:_f?1:v("y")}function u(){var a=1;return kd(re.data.targets)?0:Ae?Ae:_g?Re+(dg&&!Of?v("y2"):a):dg?ig||Of?a:v("y2"):a}function v(a){var b=fb(a);return b.isInner?20+xb(a):40+xb(a)}function w(a){var b=fb(a);return(b.isInner?30:40)+("y2"===a?-10:0)}function x(){return+g.select(we).style("width").replace("px","")}function y(){return+g.select(we).style("height").replace("px","")}function z(a){return a?-1:-(He.left-1)}function A(a){return a?-20:-1}function B(){return z(!Of)}function C(){return A(!Of)}function D(){return z(Of)}function E(){return A(Of)}function F(a){return a?Ke+2:He.left+20}function G(a){return a?80:Me+2}function H(){return F(!Of)}function I(){return G(!Of)}function J(){return F(Of)}function K(){return G(Of)}function L(){var a=Of?Me:Ke,b=Kb(),c=fc();return c>1?a*b/(c-1):a}function M(a){ah=a}function N(a){bh=a}function O(a){ch=a}function P(){return Kf?_g?bh*(ah+1):Oe:0}function Q(){return Kf?_g?Pe:ch*(ah+1):0}function R(){var a,b,c=!ff;Ze=Of?1:0,$e=Of?Me:Ke,_e=Of?0:Me,af=Of?Ke:1,bf=Ze,cf=$e,df=Of?0:Ne,ef=Of?Le:1,ff=T(Ze,$e,c?void 0:ff.domain(),function(){return mf.tickOffset()}),gf=U(_e,af),hf=U(_e,af),jf=T(Ze,$e,rh,function(a){return a%1?0:pf.tickOffset()}),kf=U(df,ef),lf=U(df,ef),a=$(),b=_(),mf=X(ff,Wg,a,b),pf=X(jf,Zg,a,b),nf=Y(gf,Xg,ag,cg),of=Y(hf,Yg,jg,lg),c||(fh.scale(jf),Be&&jh.scale(ff)),S()}function S(){Ve=zb(),We=Ab(),Xe=Ab(.98)}function T(a,b,c,f){var h=(Og?g.time.scale():g.scale.linear()).range([a,b]);if(h.orgDomain=function(){return h.domain()},e(c)&&h.domain(c),d(f)&&(f=function(){return 0}),Pg){var i,j=h;h=function(a){return j(a)+f(a)};for(i in j)h[i]=j[i];h.orgDomain=function(){return j.domain()},h.domain=function(a){return arguments.length?(j.domain(a),h):(a=j.domain(),[a[0],a[1]+1])}}return h}function U(a,b){return g.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?hf:gf}function W(a){return"y2"===Z(a)?lf:kf}function X(a,c,d,e){var f=(Pg?b():g.svg.axis()).scale(a).orient(c);return f.tickFormat(d).ticks(e),Pg?f.tickCentered(Rf):f.tickOffset=function(){var a=Of?Me:Ke;return a*Kb()/fc()/2},Pg&&f.categories(Qf),f}function Y(a,b,c,d){return g.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in wf?wf[a]:"y"}function $(){var a=Og?Vg:Pg?oc:null;return Sf&&("function"==typeof Sf?a=Sf:Og&&(a=function(a){return g.time.format(Sf)(a)})),a}function _(){var a=fc();return Tf&&a>Uf?Uf:a}function ab(a){return"string"==typeof a?a:a?a.text:null}function bb(a,b){var c=a&&"object"==typeof a&&a.position?a.position:b;return{isInner:c.indexOf("inner")>=0,isOuter:c.indexOf("outer")>=0,isLeft:c.indexOf("left")>=0,isCenter:c.indexOf("center")>=0,isRight:c.indexOf("right")>=0,isTop:c.indexOf("top")>=0,isMiddle:c.indexOf("middle")>=0,isBottom:c.indexOf("bottom")>=0}}function cb(){return bb(Wf,"inner-right")}function db(){return bb($f,"inner-top")}function eb(){return bb(hg,"inner-top")}function fb(a){return"y2"===a?eb():"y"===a?db():cb()}function gb(){return ab(Wf)}function hb(){return ab($f)}function ib(){return ab(hg)}function jb(a,b){return a?b.isLeft?0:b.isCenter?Ke/2:Ke:b.isBottom?-Me:b.isMiddle?-Me/2:0}function kb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function lb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function mb(){return jb(!Of,cb())}function nb(){return jb(Of,db())}function ob(){return jb(Of,eb())}function pb(){return kb(Of,db())}function qb(){return kb(Of,eb())}function rb(){var a=cb();return Of?a.isInner?"1.2em":-30-xb("x"):a.isInner?"-0.5em":"3em"}function sb(){var a=db();return Of?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-xb("y")}function tb(){var a=eb();return Of?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+xb("y2")}function ub(){return lb(!Of,cb())}function vb(){return lb(Of,db())}function wb(){return lb(Of,eb())}function xb(a){var b=0;return g.selectAll("."+a+".axis .tick text").each(function(){var a=this.getBBox();b0)for(f=mc(a),b=0;ba?a:0}),c=1;c0||(h[d][b]+=+a)});return g.min(Object.keys(h).map(function(a){return g.min(h[a])}))}function Ib(a){var b,c,d,e,f,h=kc(a);if(vf.length>0)for(f=nc(a),b=0;b0?a:0}),c=1;c+a||(h[d][b]+=+a)});return g.max(Object.keys(h).map(function(a){return g.max(h[a])}))}function Jb(a){var b,d,e,f,g,h,i,j,k=jc(function(b){return Z(b.id)===a}),l="y2"===a?fg:Yf,m="y2"===a?eg:Xf,n=c(l)?l:Hb(k),o=c(m)?m:Ib(k),p="y2"===a?gg:Zf,q=Gc()&&Of;return n===o&&(0>n?o=0:n=0),b=Math.abs(o-n),d=e=f=q?0:.1*b,p&&(g=Math.max(Math.abs(n),Math.abs(o)),o=g-p,n=p-g),"y"===a&&bg&&(e=c(bg.top)?bg.top:d,f=c(bg.bottom)?bg.bottom:d),"y2"===a&&kg&&(e=c(kg.top)?kg.top:d,f=c(kg.bottom)?kg.bottom:d),q&&(h=Hc(n,o),i=Pb(gf.range()),j=[h[0]/i,h[1]/i],e+=b*(j[1]/(1-j[0]-j[1])),f+=b*(j[0]/(1-j[0]-j[1]))),gd(k)&&!mc(k)&&(f=n),[n-f,o+e]}function Kb(a){var b=Pb(rh),c=Pb(ff.domain());return a||0===c?1:b/c}function Lb(a){return g.min(a,function(a){return g.min(a.values,function(a){return a.x})})}function Mb(a){return g.max(a,function(a){return g.max(a.values,function(a){return a.x})})}function Nb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Pg?d=0:gd(a)?(c=fc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Ob(a){var b=[Lb(a),Mb(a)],c=b[0],d=b[1],e=Nb(a,b),f=Og?new Date(c.getTime()-e):c-e,g=Og?new Date(d.getTime()+e):d+e;return[f,g]}function Pb(a){return a[1]-a[0]}function Qb(a){for(var b=0;bd?0:d}function Vb(a){return qf&&a===qf||rf&&Ad(rf,a)}function Wb(a){return!Vb(a)}function Xb(a){return qf?qf:rf?rf[a]:null}function Yb(a,b){return a in re.data.x&&re.data.x[a]&&re.data.x[a][b]?re.data.x[a][b]:b}function Zb(a){Object.keys(a).forEach(function(b){rf[b]=a[b]})}function $b(a){var b;return a&&(b=uf[a.id],a.name=b?b:a.id),a}function _b(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?b.map(function(a){return a[c]}):re.data.x[Object.keys(re.data.x)[0]]}),c=d.map(function(a){var c=tf(a);return{id:c,id_org:a,values:b.map(function(b,d){var e,f=Xb(a);return e=Og?wd(b[f]):Qg?b[f]?+b[f]:Yb(a,d):d,b.x=e,{x:e,value:null===b[a]||isNaN(b[a])?null:+b[a],id:c}})}}),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++})}),xf&&ed(hc(c).filter(function(a){return!(a in yf)}),xf),c.forEach(function(a){Rb(a.id_org,a)}),c)}function cc(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 dc(a){return a>0&&re.data.targets[0].values[a-1]?re.data.targets[0].values[a-1].x:void 0}function ec(a){return a1?re.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?re.data.targets[0]:null,a}function hc(a){return a=d(a)?re.data.targets:a,a.map(function(a){return a.id})}function ic(a){var b,c=hc();for(b=0;ba})}function nc(a){return lc(a,function(a){return a>0})}function oc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1?(e=[],a[f].x&&(e=e.concat(Oc(a,f))),a[g].x&&(e=e.concat(Oc(a,g))),Rc(e,b)):Pc(a,b,f,g)}function Qc(a,b){var c;return c=a.map(function(a){return Pc(a.values,b)}),Rc(c,b)}function Rc(a,b){var c,d;return a.forEach(function(a){var e=Bd(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Sc(){return Af&&"desc"===Af.toLowerCase()}function Tc(){return Af&&"asc"===Af.toLowerCase()}function Uc(a){var b=Tc(),c=Sc();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 Af&&a.sort(Af),a}function Vc(a,b){var d,e,f,g,h,i,j,k=kd(re.data.targets),l=k?Nc:Mc,m=a.filter(function(a){return a&&c(a.value)});Fg&&0!==m.length&&(ph.html(Ig(a,$(),l,Ug)).style("visibility","hidden").style("display","block"),d=ph.property("offsetWidth"),e=ph.property("offsetHeight"),k?(g=Ke/2+b[0],i=Me/2+b[1]+20):(Of?(f=q(),g=f+b[0]+100,h=g+d,j=r()-u(),i=ff(m[0].x)+20):(f=q(),g=f+t()+ff(m[0].x)+20,h=g+d,j=f+r()-u(),i=b[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),ph.style("top",i+"px").style("left",g+"px").style("visibility","visible"))}function Wc(){ph.style("display","none")}function Xc(a){var b=a.filter(function(a){return a&&c(a.value)});Fg&&(hd(re.data.targets)||kd(re.data.targets)||mh.selectAll("line.xgrid-focus").style("visibility","visible").data([b[0]]).attr(Of?"y1":"x1",Ic).attr(Of?"y2":"x2",Ic))}function Yc(){mh.select("line.xgrid-focus").style("visibility","hidden")}function Zc(a){return a.x||0===a.x?ff(a.x):null}function $c(a){return V(a.id)(a.value)}function _c(){var a,b,c={},e=0;return jc(nd).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function dd(a,b){return b?2*a.tickOffset()*.6/b:0}function ed(a,b){var c=d(a)?hc():a;"string"==typeof c&&(c=[c]);for(var e=0;e0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ud(a,b,c,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(e(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Vd(b){var c,d,e;if(qh=g.select(we),qh.empty())return void a.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(qh.html(""),re.data.x={},re.data.targets=bc(b),o(),R(),ff.domain(g.extent(Ob(re.data.targets))),gf.domain(Jb("y")),hf.domain(Jb("y2")),jf.domain(ff.domain()),kf.domain(gf.domain()),lf.domain(hf.domain()),rh=ff.domain(),fh.scale(jf),Be&&jh.scale(ff),kh=g.select(we).append("svg").attr("width",Ke+He.left+He.right).attr("height",Me+He.top+He.bottom).on("mouseenter",Ee).on("mouseleave",Fe),lh=kh.append("defs"),lh.append("clipPath").attr("id",Mg).append("rect").attr("width",Ke).attr("height",Me),lh.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),lh.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),mh=kh.append("g").attr("transform",$g.main),nh=Hf?kh.append("g").attr("transform",$g.context):null,oh=Kf?kh.append("g").attr("transform",$g.legend):null,ph=g.select(we).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none"),mh.append("g").attr("class","x axis").attr("clip-path",Of?"":j("xaxis-clip")).attr("transform",$g.x).append("text").attr("class","-axis-x-label").attr("transform",Of?"rotate(-90)":"").attr("dy",rb).style("text-anchor",ub).text(gb),mh.append("g").attr("class","y axis").attr("clip-path",Of?j("yaxis-clip"):"").append("text").attr("class","-axis-y-label").attr("transform",Of?"":"rotate(-90)").attr("dx",pb).style("text-anchor",vb).text(hb),dg&&mh.append("g").attr("class","y2 axis").attr("transform",$g.y2).append("text").attr("class","-axis-y2-label").attr("transform",Of?"":"rotate(-90)").attr("dx",qb).style("text-anchor",wb).text(ib),d=mh.append("g").attr("clip-path",Ng).attr("class","grid"),mg&&d.append("g").attr("class","xgrids"),og&&d.append("g").attr("class","xgrid-lines"),ug&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",Of?0:-10).attr("x2",Of?Ke:-10).attr("y1",Of?-10:He.top).attr("y2",Of?-10:Me),pg&&d.append("g").attr("class","ygrids"),qg&&d.append("g").attr("class","ygrid-lines"),mh.append("g").attr("clip-path",Ng).attr("class","regions"),mh.append("g").attr("clip-path",Ng).attr("class","chart"),c=mh.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",Be?Of?"ns-resize":"ew-resize":null),mh.select(".chart").append("g").attr("class","chart-bars"),mh.select(".chart").append("g").attr("class","chart-lines"),mh.select(".chart").append("g").attr("class","chart-arcs").attr("transform",$g.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(Dg),mh.select(".chart").append("g").attr("class","chart-texts"),Be&&mh.insert("rect",De?null:"g.grid").attr("class","zoom-rect").attr("width",Ke).attr("height",Me).style("opacity",0).style("cursor",Of?"ns-resize":"ew-resize").call(jh).on("dblclick.zoom",null),null!==Vf&&fh.extent("function"!=typeof Vf?Vf:Vf(Ob())),Hf&&(nh.append("g").attr("clip-path",Ng).attr("class","chart"),nh.select(".chart").append("g").attr("class","chart-bars"),nh.select(".chart").append("g").attr("class","chart-lines"),nh.append("g").attr("clip-path",Ng).attr("class","x brush").call(fh).selectAll("rect").attr(Of?"width":"height",Of?Le:Ne),nh.append("g").attr("class","x axis").attr("transform",$g.subx).attr("clip-path",Of?j("yaxis-clip"):"")),ge(re.data.targets),Of?mh.select(".x.axis").style("opacity",0).call(mf):(mh.select(".y.axis").style("opacity",0).call(nf),mh.select(".y2.axis").style("opacity",0).call(of)),fe({withTransform:!0,withUpdateXDomain:!0,withLegend:!0,durationForAxis:0}),Jg){if(Og&&"string"==typeof Kg){for(Kg=wd(Kg),e=0;e0){d=[];for(var f in uf)for(c=0;cf&&h>c&&d>i&&j>d):"rect"===this.nodeName&&(c=1*l.attr("x"),d=1*l.attr("y"),e=1*l.attr("width"),k=Hd,o=c+e>f&&h>c&&j>d),o^n&&(l.classed(ve,!n),l.classed(ue,!m),k(!m,l,a,b))}))}function $d(a){kd(re.data.targets)||Df&&(Rg=a,mh.select(".chart").append("rect").attr("class","dragarea").style("opacity",.1),Sg=!0)}function _d(){kd(re.data.targets)||Df&&(mh.select(".dragarea").transition().duration(100).style("opacity",0).remove(),mh.selectAll(".-shape").classed(ve,!1),Sg=!1)}function ae(a){var b,d,f,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=_c(),J=kd(re.data.targets);if(a=e(a)?a:{},u=e(a.withY)?a.withY:!0,v=e(a.withSubchart)?a.withSubchart:!0,w=e(a.withTransition)?a.withTransition:!0,x=e(a.withTransform)?a.withTransform:!1,y=e(a.withUpdateXDomain)?a.withUpdateXDomain:!1,z=e(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,A=e(a.withLegend)?a.withLegend:!1,F=w?Ge:0,G=e(a.durationForExit)?a.durationForExit:F,H=e(a.durationForAxis)?a.durationForAxis:F,A&&Kf&&le(re.data.targets,a),z&&(ff.domain(g.extent(Ob(re.data.targets))),rh=ff.domain(),Be&&jh.scale(ff).updateScaleExtent(),jf.domain(ff.domain()),fh.scale(jf)),y&&(ff.domain(fh.empty()?rh:fh.extent()),Be&&jh.scale(ff).updateScaleExtent()),gf.domain(Jb("y")),hf.domain(Jb("y2")),mh.select(".x.axis").style("opacity",J?0:1).transition().duration(H).call(mf),mh.select(".y.axis").style("opacity",J?0:1).transition().duration(H).call(nf),mh.select(".y2.axis").style("opacity",J?0:1).transition().duration(H).call(of),B=Pd(I),D=Qd(I,!0),E=Qd(I,!1),mh.select(".x.axis .-axis-x-label").attr("x",mb),mh.select(".y.axis .-axis-y-label").attr("x",nb).attr("dy",sb),mh.select(".y2.axis .-axis-y2-label").attr("x",ob).attr("dy",tb),kf.domain(gf.domain()),lf.domain(hf.domain()),ph.style("display","none"),mh.select("line.xgrid-focus").style("visibility","hidden").attr("y2",Me),mg){if("year"===ng){d=[];for(var K=Ob(),M=K[0].getFullYear(),N=K[1].getFullYear(),O=M;N>=O;O++)d.push(new Date(O+"-01-01 00:00:00"))}else d=ff.ticks(10);b=mh.select(".xgrids").selectAll(".xgrid").data(d),b.enter().append("line").attr("class","xgrid"),b.attr("x1",Of?0:function(a){return ff(a)-mf.tickOffset() -}).attr("x2",Of?Ke:function(a){return ff(a)-mf.tickOffset()}).attr("y1",Of?function(a){return ff(a)-mf.tickOffset()}:He.top).attr("y2",Of?function(a){return ff(a)-mf.tickOffset()}:Me).style("opacity",function(){return+g.select(this).attr(Of?"y1":"x1")===(Of?Me:0)?0:1}),b.exit().remove()}og&&(f=mh.select(".xgrid-lines").selectAll(".xgrid-line").data(og),h=f.enter().append("g").attr("class",function(a){return"xgrid-line xgrid-line-"+(a["class"]?a["class"]:"")}),h.append("line").style("opacity",0),h.append("text").attr("text-anchor","end").attr("transform",Of?"":"rotate(-90)").attr("dx",Of?0:-He.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(F).attr("x1",Of?0:Jc).attr("x2",Of?Ke:Jc).attr("y1",Of?Jc:He.top).attr("y2",Of?Jc:Me).style("opacity",1),f.select("text").transition().duration(F).attr("x",Of?Ke:0).attr("y",Jc).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(F).style("opacity",0).remove()),u&&pg&&(i=mh.select(".ygrids").selectAll(".ygrid").data(gf.ticks(rg)),i.enter().append("line").attr("class","ygrid"),i.attr("x1",Of?gf:0).attr("x2",Of?gf:Ke).attr("y1",Of?0:gf).attr("y2",Of?Me:gf),i.exit().remove()),u&&qg&&(j=mh.select(".ygrid-lines").selectAll(".ygrid-line").data(qg),k=j.enter().append("g").attr("class",function(a){return"ygrid-line ygrid-line-"+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Of?"rotate(-90)":"").attr("dx",Of?0:-He.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(F).attr("x1",Of?Kc:0).attr("x2",Of?Kc:Ke).attr("y1",Of?0:Kc).attr("y2",Of?Me:Kc).style("opacity",1),j.select("text").transition().duration(F).attr("x",Of?0:Ke).attr("y",Kc).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(F).style("opacity",0).remove()),m=mh.selectAll(".-bars").selectAll(".-bar").data(sd),m.enter().append("path").attr("d",B).style("stroke","none").style("opacity",0).style("fill",function(a){return Ug(a.id)}).attr("class",zc),m.style("opacity",Cc).transition().duration(F).attr("d",B).style("opacity",1),m.exit().transition().duration(G).style("opacity",0).remove(),o=mh.selectAll(".-texts").selectAll(".-text").data(ud),o.enter().append("text").attr("class",pc).attr("text-anchor",function(a){return Of?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return Mc(a.value)}),o.style("fill-opacity",Dc).transition().duration(F).attr("x",D).attr("y",E).style("fill-opacity",Fc),o.exit().transition().duration(G).style("fill-opacity",0).remove(),mh.selectAll(".-line").style("opacity",Cc).transition().duration(F).attr("d",gh).style("opacity",1),mh.selectAll(".-area").style("opacity",0).transition().duration(F).attr("d",hh).style("opacity",sh),l=mh.selectAll(".-circles").selectAll(".-circle").data(td),l.enter().append("circle").attr("class",yc).style("opacity",0).attr("r",tg),l.style("opacity",Cc).transition().duration(F).style("opacity",Ec).attr("cx",Of?$c:Zc).attr("cy",Of?Zc:$c),l.exit().remove(),mh.selectAll(".chart-arc").select(".-arc").attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(F).attrTween("d",function(a){var b=yb(a);if(!b)return function(){return"M 0 0"};var c=g.interpolate(this._current,b);return this._current=c(0),function(a){return Bb(c(a),!0)}}).attr("transform",x?"scale(1)":"").style("opacity",1),mh.selectAll(".chart-arc").select("text").attr("transform",Cb).style("opacity",0).transition().duration(F).text(Eb).style("opacity",function(a){return rd(a.data)?1:0}),mh.select(".chart-arcs-title").style("opacity",jd(re.data.targets)?1:0),Hf&&(null!==g.event&&"zoom"===g.event.type&&fh.extent(ff.orgDomain()).update(),v&&(nh.select(".x.axis").style("opacity",J?0:1).transition().duration(F).call(pf),fh.empty()||fh.extent(ff.orgDomain()).update(),C=Pd(I,!0),p=nh.selectAll(".-bars").selectAll(".-bar").data(sd),p.enter().append("path").attr("d",C).style("stroke","none").style("fill",function(a){return Ug(a.id)}).attr("class",zc),p.style("opacity",Cc).transition().duration(F).attr("d",C).style("opacity",1),p.exit().transition().duration(F).style("opacity",0).remove(),nh.selectAll(".-line").style("opacity",Cc).transition().duration(F).attr("d",ih).style("opacity",1))),mh.selectAll(".selected-circles").filter(function(a){return nd(a)}).selectAll("circle").remove(),mh.selectAll(".selected-circle").transition().duration(F).attr("cx",Of?$c:Zc).attr("cy",Of?Zc:$c),rf?(q=mh.select(".event-rects").selectAll(".event-rect").data([0]),Xd(q.enter()),q.attr("x",0).attr("y",0).attr("width",Ke).attr("height",Me)):(Qg?(t=function(a,b){var c=dc(b),d=ec(b);return(ff(d?d:a.x+50)-ff(c?c:a.x-50))/2},s=function(a,b){var c=dc(b);return(ff(a.x)+ff(c?c:a.x-50))/2}):(t=L(),s=function(a){return ff(a.x)-t/2}),r=gc(),mh.select(".event-rects").datum(r?r.values:[]),q=mh.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),Wd(q.enter()),q.attr("class",Bc).attr("x",Of?0:s).attr("y",Of?s:0).attr("width",Of?Ke:t).attr("height",Of?t:Me),q.exit().remove()),n=mh.select(".regions").selectAll("rect.region").data(Eg),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Ac).attr("x",Of?0:Tb).attr("y",Of?Tb:He.top).attr("width",Of?Ke:Ub).attr("height",Of?Ub:Me).transition().duration(F).style("fill-opacity",function(a){return c(a.opacity)?a.opacity:.1}),n.exit().transition().duration(F).style("fill-opacity",0).remove(),hc().forEach(function(a){th[a]=!0})}function be(){ae({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function ce(){return"mousemove"===g.event.sourceEvent.type&&jh.altDomain?(ff.domain(jh.altDomain),void jh.scale(ff).updateScaleExtent()):(Pg&&ff.orgDomain()[0]===rh[0]&&ff.domain([rh[0]-1e-10,ff.orgDomain()[1]]),ae({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===g.event.sourceEvent.type&&(Tg=!0)))}function de(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ee(){kh.attr("width",Oe).attr("height",Pe),kh.select("#"+Mg).select("rect").attr("width",Ke).attr("height",Me),kh.select("#xaxis-clip").select("rect").attr("width",H),kh.select(".zoom-rect").attr("width",Ke).attr("height",Me)}function fe(a){a=e(a)?a:{},a.withTransition=e(a.withTransition)?a.withTransition:!0,a.withTransform=e(a.withTransform)?a.withTransform:!1,a.withLegend=e(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.durationForExit=0,o(),R(),ee(),n(a.withTransition),ae(a)}function ge(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=mh.select(".chart-texts").selectAll(".chart-text").data(a),j=i.enter().append("g").attr("class",function(a){return"chart-text target target-"+a.id}).style("pointer-events","none"),j.append("g").attr("class",qc).style("fill",function(a){return Ug(a.id)}),e=mh.select(".chart-bars").selectAll(".chart-bar").data(a),d=e.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("pointer-events","none"),d.append("g").attr("class",uc).style("fill",function(a){return Ug(a.id)}).style("stroke","none").style("cursor",function(a){return Ff(a)?"pointer":null}),c=mh.select(".chart-lines").selectAll(".chart-line").data(a),b=c.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("pointer-events","none"),b.append("path").attr("class",sc).style("opacity",0).style("stroke",function(a){return Ug(a.id)}),b.append("path").attr("class",wc).style("opacity",function(){return sh=+g.select(this).style("opacity"),0}).style("fill",function(a){return Ug(a.id)}),b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id}),b.append("g").attr("class",tc).style("fill",function(a){return Ug(a.id)}).style("cursor",function(a){return Ff(a)?"pointer":null}),a.forEach(function(a){var b=me(a.id);mh.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})}),h=mh.select(".chart-arcs").selectAll(".chart-arc").data(Ye(a)),f=h.enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id}),f.append("path").attr("class",vc).style("opacity",0).style("fill",function(a){return Ug(a.data.id)}).style("cursor",function(a){return Ff(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){Fb(a.data.id),ie(a.data.id)}).on("mousemove",function(a){var b=[$b({id:a.data.id,value:a.value,ratio:Db(a)})];Vc(b,g.mouse(this))}).on("mouseout",function(a){Gb(a.data.id),ke(),Wc()}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Hf&&(n=nh.select(".chart-bars").selectAll(".chart-bar").data(a),m=n.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}),m.append("g").attr("class",uc).style("fill",function(a){return Ug(a.id)}),l=nh.select(".chart-lines").selectAll(".chart-line").data(a),k=l.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}),k.append("path").attr("class",sc).style("opacity",0).style("stroke",function(a){return Ug(a.id)})),kh.selectAll(".target").transition().style("opacity",1)}function he(a,b){re.data.targets.forEach(function(b){for(var c=0;ce&&(e=(k-j)/2,v=0,B++)),A[a]=B,z[B]=e,w[a]=v,v+=j}var e,f,g=a.getBBox(),h=10*Math.ceil((g.width+t)/10),i=10*Math.ceil((g.height+s)/10),j=_g?i:h,k=_g?Qe:Re;c&&(v=0,B=0,m=0,p=0),x[b]=h,y[b]=i,(!m||h>=m)&&(m=h),(!p||i>=p)&&(p=i),f=_g?p:m,Nf?(Object.keys(x).forEach(function(a){x[a]=m}),Object.keys(y).forEach(function(a){y[a]=p}),e=(k-f*r.length)/2,u>e?(v=0,B=0,r.forEach(function(a){d(a)})):d(b,!0)):d(b)}var f,g,h,i,j,k,l,m,p,q,r=hc(a),s=4,t=26,u=10,v=0,w={},x={},y={},z={},A={},B=0;b=d(b)?{}:b,q=e(b.withTransition)?b.withTransition:!0,_g?(g=function(a){return m*(.2+A[a])},j=function(a){return z[A[a]]+w[a]}):(g=function(a){return z[A[a]]+w[a]},j=function(a){return p*(.2+A[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},f=oh.selectAll(".legend-item").data(r).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){Mf(a)}).on("mouseover",function(a){re.focus(a)}).on("mouseout",function(){re.revert()}),f.append("text").text(function(a){return e(uf[a])?uf[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",_g?h:-200).attr("y",_g?-200:k),f.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",_g?i:-200).attr("y",_g?-200:l).attr("width",function(a){return x[a]}).attr("height",function(a){return y[a]}),f.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return Ug(a)}).attr("x",_g?h:-200).attr("y",_g?-200:j).attr("width",10).attr("height",10),oh.selectAll("text").data(r).each(function(a,b){c(this,a,0===b)}).transition().duration(q?250:0).attr("x",h).attr("y",k),oh.selectAll("rect.legend-item-event").data(r).transition().duration(q?250:0).attr("x",i).attr("y",l),oh.selectAll("rect.legend-item-tile").data(r).transition().duration(q?250:0).attr("x",g).attr("y",j),N(m),O(p),M(B),o(),R(),ee(),n(!1)}function me(a){return a?"-"+a.replace(/\./g,"\\."):""}function ne(a){return".target"+me(a)}function oe(a){return ic(a.id)}function pe(a){return"data"in a&&ic(a.data.id)}function qe(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}}var re={data:{}},se={},te="_expanded_",ue="_selected_",ve="_included_",we=i(["bindto"],"#chart"),xe=i(["size","width"],null),ye=i(["size","height"],null),ze=i(["padding","left"],null),Ae=i(["padding","right"],null),Be=i(["zoom","enabled"],!1),Ce=i(["zoom","extent"],null),De=i(["zoom","privileged"],!1),Ee=i(["onenter"],function(){}),Fe=i(["onleave"],function(){}),Ge=i(["transition","duration"],350);h("data","data is required in config");var He,Ie,Je,Ke,Le,Me,Ne,Oe,Pe,Qe,Re,Se,Te,Ue,Ve,We,Xe,Ye,Ze,$e,_e,af,bf,cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf=i(["data","x"],null),rf=i(["data","xs"],null),sf=i(["data","x_format"],"%Y-%m-%d"),tf=i(["data","id_converter"],function(a){return a}),uf=i(["data","names"],{}),vf=i(["data","groups"],[]),wf=i(["data","axes"],{}),xf=i(["data","type"],null),yf=i(["data","types"],{}),zf=i(["data","labels"],{}),Af=i(["data","order"],null),Bf=i(["data","regions"],{}),Cf=i(["data","colors"],{}),Df=i(["data","selection","enabled"],!1),Ef=i(["data","selection","grouped"],!1),Ff=i(["data","selection","isselectable"],function(){return!0}),Gf=i(["data","selection","multiple"],!0),Hf=i(["subchart","show"],!1),If=Hf?i(["subchart","size","height"],60):0,Jf=i(["color","pattern"],null),Kf=i(["legend","show"],!0),Lf=i(["legend","position"],"bottom"),Mf=i(["legend","item","onclick"],function(){}),Nf=i(["legend","equally"],!1),Of=i(["axis","rotated"],!1),Pf=i(["axis","x","type"],"indexed"),Qf=i(["axis","x","categories"],[]),Rf=i(["axis","x","tick","centered"],!1),Sf=i(["axis","x","tick","format"],null),Tf=i(["axis","x","tick","culling"],"categorized"===Pf?!1:!0),Uf=i(["axis","x","tick","count"],10),Vf=i(["axis","x","default"],null),Wf=i(["axis","x","label"],null),Xf=i(["axis","y","max"],null),Yf=i(["axis","y","min"],null),Zf=i(["axis","y","center"],null),$f=i(["axis","y","label"],null),_f=i(["axis","y","inner"],!1),ag=i(["axis","y","tick","format"],null),bg=i(["axis","y","padding"],null),cg=i(["axis","y","ticks"],10),dg=i(["axis","y2","show"],!1),eg=i(["axis","y2","max"],null),fg=i(["axis","y2","min"],null),gg=i(["axis","y2","center"],null),hg=i(["axis","y2","label"],null),ig=i(["axis","y2","inner"],!1),jg=i(["axis","y2","tick","format"],null),kg=i(["axis","y2","padding"],null),lg=i(["axis","y2","ticks"],10),mg=i(["grid","x","show"],!1),ng=i(["grid","x","type"],"tick"),og=i(["grid","x","lines"],null),pg=i(["grid","y","show"],!1),qg=i(["grid","y","lines"],null),rg=i(["grid","y","ticks"],10),sg=i(["point","show"],!0),tg=sg?i(["point","r"],2.5):0,ug=i(["point","focus","line","enabled"],!0),vg=i(["point","focus","expand","enabled"],!0),wg=i(["point","focus","expand","r"],vg?4:tg),xg=i(["point","focus","select","r"],8),yg=i(["point","onclick"],function(){}),zg=i(["point","onselected"],function(){}),Ag=i(["point","onunselected"],function(){}),Bg=i(["arc","label","show"],!0),Cg=i(["arc","label","format"],null),Dg=i(["arc","title"],""),Eg=i(["regions"],[]),Fg=i(["tooltip","show"],!0),Gg=i(["tooltip","format","title"],null),Hg=i(["tooltip","format","value"],null),Ig=i(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=Gg?Gg:b,k=Hg?Hg:c;for(f=0;f"+(g||0===g?""+g+"":"")),i=a[f].name,h=k(a[f].value,a[f].ratio),e+=""+i+""+h+"");return e+""}),Jg=i(["tooltip","init","show"],!1),Kg=i(["tooltip","init","x"],0),Lg=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Mg=we.replace("#","")+"-clip",Ng=j(Mg),Og="timeseries"===Pf,Pg="categorized"===Pf,Qg=!Og&&(qf||rf),Rg=null,Sg=!1,Tg=!1,Ug=vd(Cf,Jf),Vg=function(){var a=[[g.time.format("%Y/%-m/%-d"),function(){return!0}],[g.time.format("%-m/%-d"),function(a){return a.getMonth()}],[g.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[g.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[g.time.format("%I %p"),function(a){return a.getHours()}],[g.time.format("%I:%M"),function(a){return a.getMinutes()}],[g.time.format(":%S"),function(a){return a.getSeconds()}],[g.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)}}(),Wg=Of?"left":"bottom",Xg=Of?_f?"top":"bottom":_f?"right":"left",Yg=Of?ig?"bottom":"top":ig?"left":"right",Zg=Of?"left":"bottom",$g={main:function(){return"translate("+He.left+","+He.top+")"},context:function(){return"translate("+Ie.left+","+Ie.top+")"},legend:function(){return"translate("+Je.left+","+Je.top+")"},x:function(){return"translate(0,"+(Of?0:Me)+")"},y:function(){return"translate(0,"+(Of?Me:0)+")"},y2:function(){return"translate("+(Of?0:Ke)+","+(Of?1:0)+")"},subx:function(){return"translate(0,"+(Of?0:Ne)+")"},arc:function(){return"translate("+Ke/2+","+Me/2+")"}},_g="right"===Lf,ah=0,bh=0,ch=0,dh=40,eh=20;Ye=g.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var fh,gh=function(){var a=g.svg.line().x(Of?function(a){return V(a.id)(a.value)}:Ic).y(Of?Ic:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=Id(b.values);return ld(b)?(a.interpolate(md(b)?"cardinal":"linear"),Bf[b.id]?Ud(e,ff,V(b.id),Bf[b.id]):a(e)):(c=ff(e[0].x),d=V(b.id)(e[0].value),Of?"M "+d+" "+c:"M "+c+" "+d)}}(),hh=function(){var a;return a=Of?g.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Ic):g.svg.area().x(Ic).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Id(b.values);return fd([b],"area")||fd([b],"area-spline")?(a.interpolate(md(b)?"cardinal":"linear"),a(e)):(c=ff(e[0].x),d=V(b.id)(e[0].value),Of?"M "+d+" "+c:"M "+c+" "+d)}}(),ih=function(){var a=g.svg.line().x(Of?function(a){return W(a.id)(a.value)}:Lc).y(Of?Lc:function(a){return W(a.id)(a.value)});return function(b){var c=Id(b.values);return ld(b)?a(c):"M "+jf(c[0].x)+" "+W(b.id)(c[0].value)}}(),jh=function(){};fh=g.svg.brush().on("brush",be),fh.update=function(){return nh&&nh.select(".x.brush").call(this),this},fh.scale=function(a){return Of?this.y(a):this.x(a)},Be&&(jh=g.behavior.zoom().on("zoomstart",function(){jh.altDomain=g.event.sourceEvent.altKey?ff.orgDomain():null}).on("zoom",Be?ce:null),jh.scale=function(a){return Of?this.y(a):this.x(a)},jh.orgScaleExtent=function(){var a=Ce?Ce:[1,10];return[a[0],Math.max(fc()/a[1],a[1])]},jh.updateScaleExtent=function(){var a=Pb(ff.orgDomain())/Pb(rh),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var kh,lh,mh,nh,oh,ph,qh,rh,sh,th={};if(re.focus=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=kh.selectAll(ne(a)),d=c.filter(oe),e=c.filter(pe);re.revert(),re.defocus(),b(d.classed("focused",!0)),b(e),kd(re.data.targets)&&Fb(a,!0),ie(a)},re.defocus=function(a){function b(a){a.transition().duration(100).style("opacity",.3)}var c=kh.selectAll(ne(a)),d=c.filter(oe),e=c.filter(pe);re.revert(),b(d.classed("focused",!1)),b(e),kd(re.data.targets)&&Gb(a),je(a)},re.revert=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=kh.selectAll(ne(a)),d=c.filter(oe),e=c.filter(pe);b(d.classed("focused",!1)),b(e),kd(re.data.targets)&&Gb(a),ke()},re.show=function(a){kh.selectAll(ne(a)).transition().style("opacity",1)},re.hide=function(a){kh.selectAll(ne(a)).transition().style("opacity",0)},re.unzoom=function(){fh.clear().update(),ae({withUpdateXDomain:!0})},re.load=function(a){if("function"!=typeof a.done&&(a.done=function(){}),a.xs&&Zb(a.xs),"categories"in a&&Pg&&(Qf=a.categories,mf.categories(Qf)),"cacheIds"in a&&Qb(a.cacheIds))return void he(Sb(a.cacheIds),a.done);if("data"in a)he(bc(a.data),a.done);else if("url"in a)g.csv(a.url,function(b,c){he(bc(c),a.done)});else if("rows"in a)he(bc(_b(a.rows)),a.done);else{if(!("columns"in a))throw Error("url or rows or columns is required.");he(bc(ac(a.columns)),a.done)}},re.unload=function(a){re.data.targets=re.data.targets.filter(function(b){return b.id!==a}),kh.selectAll(ne(a)).transition().style("opacity",0).remove(),Kf&&oh.selectAll(".legend-item"+me(a)).remove(),re.data.targets.length>0&&ae({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},re.selected=function(a){var b=me(a);return g.merge(mh.selectAll(".-shapes"+b).selectAll(".-shape").filter(function(){return g.select(this).classed(ue)}).map(function(a){return a.map(function(a){return a.__data__})}))},re.select=function(a,b,c){Df&&mh.selectAll(".-shapes").selectAll(".-shape").each(function(d,f){var h="circle"===this.nodeName?Cd:Fd,i="circle"===this.nodeName?Dd:Gd,j=Ef||!a||a.indexOf(d.id)>=0,k=!b||b.indexOf(f)>=0;j&&k?Ff(d)&&h(g.select(this).classed(ue,!0),d,f):e(c)&&c&&i(g.select(this).classed(ue,!1),d,f)})},re.unselect=function(a,b){Df&&mh.selectAll(".-shapes").selectAll(".-shape").each(function(c,d){var e="circle"===this.nodeName?Dd:Gd,f=Ef||!a||a.indexOf(c.id)>=0,h=!b||b.indexOf(d)>=0;f&&h&&Ff(c)&&e(g.select(this).classed(ue,!1),c,d)})},re.toLine=function(a){ed(a,"line"),fe()},re.toSpline=function(a){ed(a,"spline"),fe()},re.toBar=function(a){ed(a,"bar"),fe()},re.toScatter=function(a){ed(a,"scatter"),fe()},re.toArea=function(a){ed(a,"area"),fe()},re.toAreaSpline=function(a){ed(a,"area-spline"),fe()},re.toPie=function(a){ed(a,"pie"),fe({withTransform:!0})},re.toDonut=function(a){ed(a,"donut"),fe({withTransform:!0})},re.groups=function(a){return d(a)?vf:(vf=a,ae(),vf)},re.xgrids=function(a){return a?(og=a,ae(),og):og},re.xgrids.add=function(a){return a?re.xgrids(og.concat(a)):void 0},re.xgrids.remove=function(a){var b=qe(a);return re.xgrids(og.filter(b))},re.ygrids=function(a){return a?(qg=a,ae(),qg):qg},re.ygrids.add=function(a){return a?re.ygrids(qg.concat(a)):void 0},re.ygrids.remove=function(a){var b=qe(a);return re.ygrids(qg.filter(b))},re.regions=function(a){return d(a)?Eg:(Eg=a,ae(),Eg)},re.regions.add=function(a){return d(a)?Eg:(Eg=Eg.concat(a),ae(),Eg)},re.regions.remove=function(a,b){var d=[].concat(a);return b=e(b)?b:{},d.forEach(function(a){var d=c(b.duration)?b.duration:0;kh.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Eg=Eg.filter(function(b){return b.classes.indexOf(a)<0})}),Eg},re.data.get=function(a){var b=re.data.getAsTarget(a);return e(b)?b.values.map(function(a){return a.value}):void 0},re.data.getAsTarget=function(a){var b=jc(function(b){return b.id===a});return b.length>0?b[0]:void 0},re.resize=function(a){xe=a?a.width:null,ye=a?a.height:null,fe({withLegend:!0,withTransition:!1})},re.destroy=function(){re.data.targets=void 0,re.data.x={},qh.html(""),a.onresize=null},"url"in f.data)g.csv(f.data.url,function(a,b){Vd(b)});else if("rows"in f.data)Vd(_b(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");Vd(ac(f.data.columns))}return re}}(window); \ No newline at end of file +!function(a){"use strict";function b(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+q)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return p>=c||b%Math.ceil(c/p)===0}function f(a){return a0?a:320}function t(){return rd(ye.data.targets)?0:Ge?Ge:gg?1:v("y")}function u(){var a=1;return rd(ye.data.targets)?0:He?He:oh?Ye+(kg&&!Vf?v("y2"):a):kg?pg||Vf?a:v("y2"):a}function v(a){var b=fb(a);return b.isInner?20+xb(a):40+xb(a)}function w(a){var b=fb(a);return(b.isInner?30:40)+("y2"===a?-10:0)}function x(){return+g.select(De).style("width").replace("px","")}function y(){return+g.select(De).style("height").replace("px","")}function z(a){return a?-1:-(Oe.left-1)}function A(a){return a?-20:-1}function B(){return z(!Vf)}function C(){return A(!Vf)}function D(){return z(Vf)}function E(){return A(Vf)}function F(a){return a?Re+2:Oe.left+20}function G(a){return a?80:Te+2}function H(){return F(!Vf)}function I(){return G(!Vf)}function J(){return F(Vf)}function K(){return G(Vf)}function L(){var a=Vf?Te:Re,b=Rb(),c=mc();return c>1?a*b/(c-1):a}function M(a){ph=a}function N(a){qh=a}function O(a){rh=a}function P(){return Rf?oh?qh*(ph+1):Ve:0}function Q(){return Rf?oh?We:rh*(ph+1):0}function R(){var a,b,c=!nf;ef=Vf?1:0,ff=Vf?Te:Re,gf=Vf?0:Te,hf=Vf?Re:1,jf=ef,kf=ff,lf=Vf?0:Ue,mf=Vf?Se:1,nf=T(ef,ff,c?void 0:nf.domain(),function(){return tf.tickOffset()}),of=U(gf,hf),pf=U(gf,hf),qf=T(ef,ff,Gh,function(a){return a%1?0:wf.tickOffset()}),rf=U(lf,mf),sf=U(lf,mf),a=$(),b=_(),tf=X(nf,jh,a,b),wf=X(qf,mh,a,b),uf=Y(of,kh,hg,jg),vf=Y(pf,lh,qg,sg),c||(uh.scale(qf),Ie&&yh.scale(nf)),S()}function S(){af=zb(),bf=Ab(),cf=Ab(.98)}function T(a,b,c,f){var h=(bh?g.time.scale():g.scale.linear()).range([a,b]);if(h.orgDomain=function(){return h.domain()},e(c)&&h.domain(c),d(f)&&(f=function(){return 0}),ch){var i,j=h;h=function(a){return j(a)+f(a)};for(i in j)h[i]=j[i];h.orgDomain=function(){return j.domain()},h.domain=function(a){return arguments.length?(j.domain(a),h):(a=j.domain(),[a[0],a[1]+1])}}return h}function U(a,b){return g.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?pf:of}function W(a){return"y2"===Z(a)?sf:rf}function X(a,c,d,e){var f=(ch?b():g.svg.axis()).scale(a).orient(c);return f.tickFormat(d).ticks(e),ch?f.tickCentered(Yf):f.tickOffset=function(){var a=Vf?Te:Re;return a*Rb()/mc()/2},ch&&f.categories(Xf),f}function Y(a,b,c,d){return g.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in Df?Df[a]:"y"}function $(){var a=bh?ih:ch?vc:null;return Zf&&("function"==typeof Zf?a=Zf:bh&&(a=function(a){return g.time.format(Zf)(a)})),a}function _(){var a=mc();return $f&&a>_f?_f:a}function ab(a){return"string"==typeof a?a:a?a.text:null}function bb(a,b){var c=a&&"object"==typeof a&&a.position?a.position:b;return{isInner:c.indexOf("inner")>=0,isOuter:c.indexOf("outer")>=0,isLeft:c.indexOf("left")>=0,isCenter:c.indexOf("center")>=0,isRight:c.indexOf("right")>=0,isTop:c.indexOf("top")>=0,isMiddle:c.indexOf("middle")>=0,isBottom:c.indexOf("bottom")>=0}}function cb(){return bb(bg,"inner-right")}function db(){return bb(fg,"inner-top")}function eb(){return bb(og,"inner-top")}function fb(a){return"y2"===a?eb():"y"===a?db():cb()}function gb(){return ab(bg)}function hb(){return ab(fg)}function ib(){return ab(og)}function jb(a,b){return a?b.isLeft?0:b.isCenter?Re/2:Re:b.isBottom?-Te:b.isMiddle?-Te/2:0}function kb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function lb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function mb(){return jb(!Vf,cb())}function nb(){return jb(Vf,db())}function ob(){return jb(Vf,eb())}function pb(){return kb(Vf,db())}function qb(){return kb(Vf,eb())}function rb(){var a=cb();return Vf?a.isInner?"1.2em":-30-xb("x"):a.isInner?"-0.5em":"3em"}function sb(){var a=db();return Vf?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-xb("y")}function tb(){var a=eb();return Vf?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+xb("y2")}function ub(){return lb(!Vf,cb())}function vb(){return lb(Vf,db())}function wb(){return lb(Vf,eb())}function xb(a){var b=0;return g.selectAll("."+a+".axis .tick text").each(function(){var a=this.getBBox();b0)for(f=tc(a),b=0;ba?a:0}),c=1;c0||(h[d][b]+=+a)});return g.min(Object.keys(h).map(function(a){return g.min(h[a])}))}function Pb(a){var b,c,d,e,f,h=rc(a);if(Cf.length>0)for(f=uc(a),b=0;b0?a:0}),c=1;c+a||(h[d][b]+=+a)});return g.max(Object.keys(h).map(function(a){return g.max(h[a])}))}function Qb(a){var b,d,e,f,g,h,i,j,k=qc(function(b){return Z(b.id)===a}),l="y2"===a?mg:dg,m="y2"===a?lg:cg,n=c(l)?l:Ob(k),o=c(m)?m:Pb(k),p="y2"===a?ng:eg,q=Nc()&&Vf;return n===o&&(0>n?o=0:n=0),b=Math.abs(o-n),d=e=f=q?0:.1*b,p&&(g=Math.max(Math.abs(n),Math.abs(o)),o=g-p,n=p-g),"y"===a&&ig&&(e=c(ig.top)?ig.top:d,f=c(ig.bottom)?ig.bottom:d),"y2"===a&&rg&&(e=c(rg.top)?rg.top:d,f=c(rg.bottom)?rg.bottom:d),q&&(h=Oc(n,o),i=Wb(of.range()),j=[h[0]/i,h[1]/i],e+=b*(j[1]/(1-j[0]-j[1])),f+=b*(j[0]/(1-j[0]-j[1]))),nd(k)&&!tc(k)&&(f=n),[n-f,o+e]}function Rb(a){var b=Wb(Gh),c=Wb(nf.domain());return a||0===c?1:b/c}function Sb(a){return g.min(a,function(a){return g.min(a.values,function(a){return a.x})})}function Tb(a){return g.max(a,function(a){return g.max(a.values,function(a){return a.x})})}function Ub(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return ch?d=0:nd(a)?(c=mc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Vb(a){var b=[Sb(a),Tb(a)],c=b[0],d=b[1],e=Ub(a,b),f=bh?new Date(c.getTime()-e):c-e,g=bh?new Date(d.getTime()+e):d+e;return[f,g]}function Wb(a){return a[1]-a[0]}function Xb(a){for(var b=0;bd?0:d}function ac(a){return xf&&a===xf||yf&&Hd(yf,a)}function bc(a){return!ac(a)}function cc(a){return xf?xf:yf?yf[a]:null}function dc(a,b){return a in ye.data.x&&ye.data.x[a]&&ye.data.x[a][b]?ye.data.x[a][b]:b}function ec(a){Object.keys(a).forEach(function(b){yf[b]=a[b]})}function fc(a){var b;return a&&(b=Bf[a.id],a.name=b?b:a.id),a}function gc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?b.map(function(a){return a[c]}):ye.data.x[Object.keys(ye.data.x)[0]]}),c=d.map(function(a){var c=Af(a);return{id:c,id_org:a,values:b.map(function(b,d){var e,f=cc(a);return e=bh?Dd(b[f]):dh?b[f]?+b[f]:dc(a,d):d,b.x=e,{x:e,value:null===b[a]||isNaN(b[a])?null:+b[a],id:c}})}}),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++})}),Ef&&ld(oc(c).filter(function(a){return!(a in Ff)}),Ef),c.forEach(function(a){Yb(a.id_org,a)}),c)}function jc(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 kc(a){return a>0&&ye.data.targets[0].values[a-1]?ye.data.targets[0].values[a-1].x:void 0}function lc(a){return a1?ye.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?ye.data.targets[0]:null,a}function oc(a){return a=d(a)?ye.data.targets:a,a.map(function(a){return a.id})}function pc(a){var b,c=oc();for(b=0;ba})}function uc(a){return sc(a,function(a){return a>0})}function vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1?(e=[],a[f].x&&(e=e.concat(Vc(a,f))),a[g].x&&(e=e.concat(Vc(a,g))),Yc(e,b)):Wc(a,b,f,g)}function Xc(a,b){var c;return c=a.map(function(a){return Wc(a.values,b)}),Yc(c,b)}function Yc(a,b){var c,d;return a.forEach(function(a){var e=Id(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Zc(){return Hf&&"desc"===Hf.toLowerCase()}function $c(){return Hf&&"asc"===Hf.toLowerCase()}function _c(a){var b=$c(),c=Zc();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 Hf&&a.sort(Hf),a}function ad(a,b){var d,e,f,g,h,i,j,k=rd(ye.data.targets),l=k?Uc:Tc,m=a.filter(function(a){return a&&c(a.value)});Ug&&0!==m.length&&(Eh.html(Xg(a,$(),l,hh)).style("visibility","hidden").style("display","block"),d=Eh.property("offsetWidth"),e=Eh.property("offsetHeight"),k?(g=Re/2+b[0],i=Te/2+b[1]+20):(Vf?(f=q(),g=f+b[0]+100,h=g+d,j=r()-u(),i=nf(m[0].x)+20):(f=q(),g=f+t()+nf(m[0].x)+20,h=g+d,j=f+r()-u(),i=b[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Eh.style("top",i+"px").style("left",g+"px").style("visibility","visible"))}function bd(){Eh.style("display","none")}function cd(a){var b=a.filter(function(a){return a&&c(a.value)});Ug&&(od(ye.data.targets)||rd(ye.data.targets)||Bh.selectAll("line.xgrid-focus").style("visibility","visible").data([b[0]]).attr(Vf?"y1":"x1",Pc).attr(Vf?"y2":"x2",Pc))}function dd(){Bh.select("line.xgrid-focus").style("visibility","hidden")}function ed(a){return a.x||0===a.x?nf(a.x):null}function fd(a){return V(a.id)(a.value)}function gd(){var a,b,c={},e=0;return qc(ud).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function kd(a,b){return b?2*a.tickOffset()*.6/b:0}function ld(a,b){var c=d(a)?oc():a;"string"==typeof c&&(c=[c]);for(var e=0;e0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function _d(a,b,c,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(e(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function ae(b){var c,d,e;if(Fh=g.select(De),Fh.empty())return void a.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Fh.html(""),ye.data.x={},ye.data.targets=ic(b),o(),R(),nf.domain(g.extent(Vb(ye.data.targets))),of.domain(Qb("y")),pf.domain(Qb("y2")),qf.domain(nf.domain()),rf.domain(of.domain()),sf.domain(pf.domain()),Gh=nf.domain(),uh.scale(qf),Ie&&yh.scale(nf),zh=g.select(De).append("svg").attr("width",Re+Oe.left+Oe.right).attr("height",Te+Oe.top+Oe.bottom).on("mouseenter",Le).on("mouseleave",Me),Ah=zh.append("defs"),Ah.append("clipPath").attr("id",_g).append("rect").attr("width",Re).attr("height",Te),Ah.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),Ah.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),Bh=zh.append("g").attr("transform",nh.main),Ch=Of?zh.append("g").attr("transform",nh.context):null,Dh=Rf?zh.append("g").attr("transform",nh.legend):null,Eh=g.select(De).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none"),Bh.append("g").attr("class","x axis").attr("clip-path",Vf?"":j("xaxis-clip")).attr("transform",nh.x).append("text").attr("class","-axis-x-label").attr("transform",Vf?"rotate(-90)":"").attr("dy",rb).style("text-anchor",ub).text(gb),Bh.append("g").attr("class","y axis").attr("clip-path",Vf?j("yaxis-clip"):"").append("text").attr("class","-axis-y-label").attr("transform",Vf?"":"rotate(-90)").attr("dx",pb).style("text-anchor",vb).text(hb),kg&&Bh.append("g").attr("class","y2 axis").attr("transform",nh.y2).append("text").attr("class","-axis-y2-label").attr("transform",Vf?"":"rotate(-90)").attr("dx",qb).style("text-anchor",wb).text(ib),d=Bh.append("g").attr("clip-path",ah).attr("class","grid"),tg&&d.append("g").attr("class","xgrids"),vg&&d.append("g").attr("class","xgrid-lines"),Bg&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",Vf?0:-10).attr("x2",Vf?Re:-10).attr("y1",Vf?-10:Oe.top).attr("y2",Vf?-10:Te),wg&&d.append("g").attr("class","ygrids"),xg&&d.append("g").attr("class","ygrid-lines"),Bh.append("g").attr("clip-path",ah).attr("class","regions"),Bh.append("g").attr("clip-path",ah).attr("class","chart"),c=Bh.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",Ie?Vf?"ns-resize":"ew-resize":null),Bh.select(".chart").append("g").attr("class","chart-bars"),Bh.select(".chart").append("g").attr("class","chart-lines"),Bh.select(".chart").append("g").attr("class","chart-arcs").attr("transform",nh.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(Kb()),Bh.select(".chart").append("g").attr("class","chart-texts"),Ie&&Bh.insert("rect",Ke?null:"g.grid").attr("class","zoom-rect").attr("width",Re).attr("height",Te).style("opacity",0).style("cursor",Vf?"ns-resize":"ew-resize").call(yh).on("dblclick.zoom",null),null!==ag&&uh.extent("function"!=typeof ag?ag:ag(Vb())),Of&&(Ch.append("g").attr("clip-path",ah).attr("class","chart"),Ch.select(".chart").append("g").attr("class","chart-bars"),Ch.select(".chart").append("g").attr("class","chart-lines"),Ch.append("g").attr("clip-path",ah).attr("class","x brush").call(uh).selectAll("rect").attr(Vf?"width":"height",Vf?Se:Ue),Ch.append("g").attr("class","x axis").attr("transform",nh.subx).attr("clip-path",Vf?j("yaxis-clip"):"")),ne(ye.data.targets),Vf?Bh.select(".x.axis").style("opacity",0).call(tf):(Bh.select(".y.axis").style("opacity",0).call(uf),Bh.select(".y2.axis").style("opacity",0).call(vf)),me({withTransform:!0,withUpdateXDomain:!0,withLegend:!0,durationForAxis:0}),Yg){if(bh&&"string"==typeof Zg){for(Zg=Dd(Zg),e=0;e0){d=[];for(var f in Bf)for(c=0;cf&&h>c&&d>i&&j>d):"rect"===this.nodeName&&(c=1*l.attr("x"),d=1*l.attr("y"),e=1*l.attr("width"),k=Od,o=c+e>f&&h>c&&j>d),o^n&&(l.classed(Ce,!n),l.classed(Be,!m),k(!m,l,a,b))}))}function fe(a){rd(ye.data.targets)||Kf&&(eh=a,Bh.select(".chart").append("rect").attr("class","dragarea").style("opacity",.1),fh=!0)}function ge(){rd(ye.data.targets)||Kf&&(Bh.select(".dragarea").transition().duration(100).style("opacity",0).remove(),Bh.selectAll(".-shape").classed(Ce,!1),fh=!1)}function he(a){var b,d,f,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=gd(),J=rd(ye.data.targets);if(a=e(a)?a:{},u=e(a.withY)?a.withY:!0,v=e(a.withSubchart)?a.withSubchart:!0,w=e(a.withTransition)?a.withTransition:!0,x=e(a.withTransform)?a.withTransform:!1,y=e(a.withUpdateXDomain)?a.withUpdateXDomain:!1,z=e(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,A=e(a.withLegend)?a.withLegend:!1,F=w?Ne:0,G=e(a.durationForExit)?a.durationForExit:F,H=e(a.durationForAxis)?a.durationForAxis:F,A&&Rf&&se(ye.data.targets,a),z&&(nf.domain(g.extent(Vb(ye.data.targets))),Gh=nf.domain(),Ie&&yh.scale(nf).updateScaleExtent(),qf.domain(nf.domain()),uh.scale(qf)),y&&(nf.domain(uh.empty()?Gh:uh.extent()),Ie&&yh.scale(nf).updateScaleExtent()),of.domain(Qb("y")),pf.domain(Qb("y2")),Bh.select(".x.axis").style("opacity",J?0:1).transition().duration(H).call(tf),Bh.select(".y.axis").style("opacity",J?0:1).transition().duration(H).call(uf),Bh.select(".y2.axis").style("opacity",J?0:1).transition().duration(H).call(vf),B=Wd(I),D=Xd(I,!0),E=Xd(I,!1),Bh.select(".x.axis .-axis-x-label").attr("x",mb),Bh.select(".y.axis .-axis-y-label").attr("x",nb).attr("dy",sb),Bh.select(".y2.axis .-axis-y2-label").attr("x",ob).attr("dy",tb),rf.domain(of.domain()),sf.domain(pf.domain()),Eh.style("display","none"),Bh.select("line.xgrid-focus").style("visibility","hidden").attr("y2",Te),tg){if("year"===ug){d=[]; +for(var K=Vb(),M=K[0].getFullYear(),N=K[1].getFullYear(),O=M;N>=O;O++)d.push(new Date(O+"-01-01 00:00:00"))}else d=nf.ticks(10);b=Bh.select(".xgrids").selectAll(".xgrid").data(d),b.enter().append("line").attr("class","xgrid"),b.attr("x1",Vf?0:function(a){return nf(a)-tf.tickOffset()}).attr("x2",Vf?Re:function(a){return nf(a)-tf.tickOffset()}).attr("y1",Vf?function(a){return nf(a)-tf.tickOffset()}:Oe.top).attr("y2",Vf?function(a){return nf(a)-tf.tickOffset()}:Te).style("opacity",function(){return+g.select(this).attr(Vf?"y1":"x1")===(Vf?Te:0)?0:1}),b.exit().remove()}vg&&(f=Bh.select(".xgrid-lines").selectAll(".xgrid-line").data(vg),h=f.enter().append("g").attr("class",function(a){return"xgrid-line xgrid-line-"+(a["class"]?a["class"]:"")}),h.append("line").style("opacity",0),h.append("text").attr("text-anchor","end").attr("transform",Vf?"":"rotate(-90)").attr("dx",Vf?0:-Oe.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(F).attr("x1",Vf?0:Qc).attr("x2",Vf?Re:Qc).attr("y1",Vf?Qc:Oe.top).attr("y2",Vf?Qc:Te).style("opacity",1),f.select("text").transition().duration(F).attr("x",Vf?Re:0).attr("y",Qc).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(F).style("opacity",0).remove()),u&&wg&&(i=Bh.select(".ygrids").selectAll(".ygrid").data(of.ticks(yg)),i.enter().append("line").attr("class","ygrid"),i.attr("x1",Vf?of:0).attr("x2",Vf?of:Re).attr("y1",Vf?0:of).attr("y2",Vf?Te:of),i.exit().remove()),u&&xg&&(j=Bh.select(".ygrid-lines").selectAll(".ygrid-line").data(xg),k=j.enter().append("g").attr("class",function(a){return"ygrid-line ygrid-line-"+(a.class?a.class:"")}),k.append("line").style("opacity",0),k.append("text").attr("text-anchor","end").attr("transform",Vf?"rotate(-90)":"").attr("dx",Vf?0:-Oe.top).attr("dy",-5).style("opacity",0),j.select("line").transition().duration(F).attr("x1",Vf?Rc:0).attr("x2",Vf?Rc:Re).attr("y1",Vf?0:Rc).attr("y2",Vf?Te:Rc).style("opacity",1),j.select("text").transition().duration(F).attr("x",Vf?0:Re).attr("y",Rc).text(function(a){return a.text}).style("opacity",1),j.exit().transition().duration(F).style("opacity",0).remove()),m=Bh.selectAll(".-bars").selectAll(".-bar").data(zd),m.enter().append("path").attr("d",B).style("stroke","none").style("opacity",0).style("fill",function(a){return hh(a.id)}).attr("class",Gc),m.style("opacity",Jc).transition().duration(F).attr("d",B).style("opacity",1),m.exit().transition().duration(G).style("opacity",0).remove(),o=Bh.selectAll(".-texts").selectAll(".-text").data(Bd),o.enter().append("text").attr("class",wc).attr("text-anchor",function(a){return Vf?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return Tc(a.value)}),o.style("fill-opacity",Kc).transition().duration(F).attr("x",D).attr("y",E).style("fill-opacity",Mc),o.exit().transition().duration(G).style("fill-opacity",0).remove(),Bh.selectAll(".-line").style("opacity",Jc).transition().duration(F).attr("d",vh).style("opacity",1),Bh.selectAll(".-area").style("opacity",0).transition().duration(F).attr("d",wh).style("opacity",Hh),l=Bh.selectAll(".-circles").selectAll(".-circle").data(Ad),l.enter().append("circle").attr("class",Fc).style("opacity",0).attr("r",Ag),l.style("opacity",Jc).transition().duration(F).style("opacity",Lc).attr("cx",Vf?fd:ed).attr("cy",Vf?ed:fd),l.exit().remove(),Bh.selectAll(".chart-arc").select(".-arc").attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(F).attrTween("d",function(a){var b=yb(a);if(!b)return function(){return"M 0 0"};var c=g.interpolate(this._current,b);return this._current=c(0),function(a){return Bb(c(a),!0)}}).attr("transform",x?"scale(1)":"").style("opacity",1),Bh.selectAll(".chart-arc").select("text").attr("transform",Cb).style("opacity",0).transition().duration(F).text(Fb).style("opacity",function(a){return yd(a.data)?1:0}),Bh.select(".chart-arcs-title").style("opacity",qd(ye.data.targets)?1:0),Of&&(null!==g.event&&"zoom"===g.event.type&&uh.extent(nf.orgDomain()).update(),v&&(Ch.select(".x.axis").style("opacity",J?0:1).transition().duration(F).call(wf),uh.empty()||uh.extent(nf.orgDomain()).update(),C=Wd(I,!0),p=Ch.selectAll(".-bars").selectAll(".-bar").data(zd),p.enter().append("path").attr("d",C).style("stroke","none").style("fill",function(a){return hh(a.id)}).attr("class",Gc),p.style("opacity",Jc).transition().duration(F).attr("d",C).style("opacity",1),p.exit().transition().duration(F).style("opacity",0).remove(),Ch.selectAll(".-line").style("opacity",Jc).transition().duration(F).attr("d",xh).style("opacity",1))),Bh.selectAll(".selected-circles").filter(function(a){return ud(a)}).selectAll("circle").remove(),Bh.selectAll(".selected-circle").transition().duration(F).attr("cx",Vf?fd:ed).attr("cy",Vf?ed:fd),yf?(q=Bh.select(".event-rects").selectAll(".event-rect").data([0]),ce(q.enter()),q.attr("x",0).attr("y",0).attr("width",Re).attr("height",Te)):(dh?(t=function(a,b){var c=kc(b),d=lc(b);return(nf(d?d:a.x+50)-nf(c?c:a.x-50))/2},s=function(a,b){var c=kc(b);return(nf(a.x)+nf(c?c:a.x-50))/2}):(t=L(),s=function(a){return nf(a.x)-t/2}),r=nc(),Bh.select(".event-rects").datum(r?r.values:[]),q=Bh.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),be(q.enter()),q.attr("class",Ic).attr("x",Vf?0:s).attr("y",Vf?s:0).attr("width",Vf?Re:t).attr("height",Vf?t:Te),q.exit().remove()),n=Bh.select(".regions").selectAll("rect.region").data(Tg),n.enter().append("rect").style("fill-opacity",0),n.attr("class",Hc).attr("x",Vf?0:$b).attr("y",Vf?$b:Oe.top).attr("width",Vf?Re:_b).attr("height",Vf?_b:Te).transition().duration(F).style("fill-opacity",function(a){return c(a.opacity)?a.opacity:.1}),n.exit().transition().duration(F).style("fill-opacity",0).remove(),oc().forEach(function(a){Ih[a]=!0})}function ie(){he({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function je(){return"mousemove"===g.event.sourceEvent.type&&yh.altDomain?(nf.domain(yh.altDomain),void yh.scale(nf).updateScaleExtent()):(ch&&nf.orgDomain()[0]===Gh[0]&&nf.domain([Gh[0]-1e-10,nf.orgDomain()[1]]),he({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===g.event.sourceEvent.type&&(gh=!0)))}function ke(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function le(){zh.attr("width",Ve).attr("height",We),zh.select("#"+_g).select("rect").attr("width",Re).attr("height",Te),zh.select("#xaxis-clip").select("rect").attr("width",H),zh.select(".zoom-rect").attr("width",Re).attr("height",Te)}function me(a){a=e(a)?a:{},a.withTransition=e(a.withTransition)?a.withTransition:!0,a.withTransform=e(a.withTransform)?a.withTransform:!1,a.withLegend=e(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.durationForExit=0,o(),R(),le(),n(a.withTransition),he(a)}function ne(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Bh.select(".chart-texts").selectAll(".chart-text").data(a),j=i.enter().append("g").attr("class",function(a){return"chart-text target target-"+a.id}).style("pointer-events","none"),j.append("g").attr("class",xc).style("fill",function(a){return hh(a.id)}),e=Bh.select(".chart-bars").selectAll(".chart-bar").data(a),d=e.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}).style("pointer-events","none"),d.append("g").attr("class",Bc).style("fill",function(a){return hh(a.id)}).style("stroke","none").style("cursor",function(a){return Mf(a)?"pointer":null}),c=Bh.select(".chart-lines").selectAll(".chart-line").data(a),b=c.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}).style("pointer-events","none"),b.append("path").attr("class",zc).style("opacity",0).style("stroke",function(a){return hh(a.id)}),b.append("path").attr("class",Dc).style("opacity",function(){return Hh=+g.select(this).style("opacity"),0}).style("fill",function(a){return hh(a.id)}),b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id}),b.append("g").attr("class",Ac).style("fill",function(a){return hh(a.id)}).style("cursor",function(a){return Mf(a)?"pointer":null}),a.forEach(function(a){var b=te(a.id);Bh.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})}),h=Bh.select(".chart-arcs").selectAll(".chart-arc").data(df(a)),f=h.enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id}),f.append("path").attr("class",Cc).style("opacity",0).style("fill",function(a){return hh(a.data.id)}).style("cursor",function(a){return Mf(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Eb(a),d=Mb();Gb(a.data.id),pe(a.data.id),d(c,b)}).on("mousemove",function(a){var b=[Eb(a)];ad(b,g.mouse(this))}).on("mouseout",function(a,b){var c=Eb(a),d=Nb();Hb(a.data.id),re(),bd(),d(c,b)}).on("click",function(a,b){var c=Eb(a),d=Lb();d(c,b)}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Of&&(n=Ch.select(".chart-bars").selectAll(".chart-bar").data(a),m=n.enter().append("g").attr("class",function(a){return"chart-bar target target-"+a.id}),m.append("g").attr("class",Bc).style("fill",function(a){return hh(a.id)}),l=Ch.select(".chart-lines").selectAll(".chart-line").data(a),k=l.enter().append("g").attr("class",function(a){return"chart-line target target-"+a.id}),k.append("path").attr("class",zc).style("opacity",0).style("stroke",function(a){return hh(a.id)})),zh.selectAll(".target").transition().style("opacity",1)}function oe(a,b){ye.data.targets.forEach(function(b){for(var c=0;ce&&(e=(k-j)/2,v=0,B++)),A[a]=B,z[B]=e,w[a]=v,v+=j}var e,f,g=a.getBBox(),h=10*Math.ceil((g.width+t)/10),i=10*Math.ceil((g.height+s)/10),j=oh?i:h,k=oh?Xe:Ye;c&&(v=0,B=0,m=0,p=0),x[b]=h,y[b]=i,(!m||h>=m)&&(m=h),(!p||i>=p)&&(p=i),f=oh?p:m,Uf?(Object.keys(x).forEach(function(a){x[a]=m}),Object.keys(y).forEach(function(a){y[a]=p}),e=(k-f*r.length)/2,u>e?(v=0,B=0,r.forEach(function(a){d(a)})):d(b,!0)):d(b)}var f,g,h,i,j,k,l,m,p,q,r=oc(a),s=4,t=26,u=10,v=0,w={},x={},y={},z={},A={},B=0;b=d(b)?{}:b,q=e(b.withTransition)?b.withTransition:!0,oh?(g=function(a){return m*(.2+A[a])},j=function(a){return z[A[a]]+w[a]}):(g=function(a){return z[A[a]]+w[a]},j=function(a){return p*(.2+A[a])}),h=function(a,b){return g(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return g(a,b)-4},l=function(a,b){return j(a,b)-7},f=Dh.selectAll(".legend-item").data(r).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){Tf(a)}).on("mouseover",function(a){ye.focus(a)}).on("mouseout",function(){ye.revert()}),f.append("text").text(function(a){return e(Bf[a])?Bf[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",oh?h:-200).attr("y",oh?-200:k),f.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",oh?i:-200).attr("y",oh?-200:l).attr("width",function(a){return x[a]}).attr("height",function(a){return y[a]}),f.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return hh(a)}).attr("x",oh?h:-200).attr("y",oh?-200:j).attr("width",10).attr("height",10),Dh.selectAll("text").data(r).each(function(a,b){c(this,a,0===b)}).transition().duration(q?250:0).attr("x",h).attr("y",k),Dh.selectAll("rect.legend-item-event").data(r).transition().duration(q?250:0).attr("x",i).attr("y",l),Dh.selectAll("rect.legend-item-tile").data(r).transition().duration(q?250:0).attr("x",g).attr("y",j),N(m),O(p),M(B),o(),R(),le(),n(!1)}function te(a){return a?"-"+a.replace(/\./g,"\\."):""}function ue(a){return".target"+te(a)}function ve(a){return pc(a.id)}function we(a){return"data"in a&&pc(a.data.id)}function xe(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}}var ye={data:{}},ze={},Ae="_expanded_",Be="_selected_",Ce="_included_",De=i(["bindto"],"#chart"),Ee=i(["size","width"],null),Fe=i(["size","height"],null),Ge=i(["padding","left"],null),He=i(["padding","right"],null),Ie=i(["zoom","enabled"],!1),Je=i(["zoom","extent"],null),Ke=i(["zoom","privileged"],!1),Le=i(["onenter"],function(){}),Me=i(["onleave"],function(){}),Ne=i(["transition","duration"],350);h("data","data is required in config");var Oe,Pe,Qe,Re,Se,Te,Ue,Ve,We,Xe,Ye,Ze,$e,_e,af,bf,cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf,rf,sf,tf,uf,vf,wf,xf=i(["data","x"],null),yf=i(["data","xs"],null),zf=i(["data","x_format"],"%Y-%m-%d"),Af=i(["data","id_converter"],function(a){return a}),Bf=i(["data","names"],{}),Cf=i(["data","groups"],[]),Df=i(["data","axes"],{}),Ef=i(["data","type"],null),Ff=i(["data","types"],{}),Gf=i(["data","labels"],{}),Hf=i(["data","order"],null),If=i(["data","regions"],{}),Jf=i(["data","colors"],{}),Kf=i(["data","selection","enabled"],!1),Lf=i(["data","selection","grouped"],!1),Mf=i(["data","selection","isselectable"],function(){return!0}),Nf=i(["data","selection","multiple"],!0),Of=i(["subchart","show"],!1),Pf=Of?i(["subchart","size","height"],60):0,Qf=i(["color","pattern"],null),Rf=i(["legend","show"],!0),Sf=i(["legend","position"],"bottom"),Tf=i(["legend","item","onclick"],function(){}),Uf=i(["legend","equally"],!1),Vf=i(["axis","rotated"],!1),Wf=i(["axis","x","type"],"indexed"),Xf=i(["axis","x","categories"],[]),Yf=i(["axis","x","tick","centered"],!1),Zf=i(["axis","x","tick","format"],null),$f=i(["axis","x","tick","culling"],"categorized"===Wf?!1:!0),_f=i(["axis","x","tick","count"],10),ag=i(["axis","x","default"],null),bg=i(["axis","x","label"],null),cg=i(["axis","y","max"],null),dg=i(["axis","y","min"],null),eg=i(["axis","y","center"],null),fg=i(["axis","y","label"],null),gg=i(["axis","y","inner"],!1),hg=i(["axis","y","tick","format"],null),ig=i(["axis","y","padding"],null),jg=i(["axis","y","ticks"],10),kg=i(["axis","y2","show"],!1),lg=i(["axis","y2","max"],null),mg=i(["axis","y2","min"],null),ng=i(["axis","y2","center"],null),og=i(["axis","y2","label"],null),pg=i(["axis","y2","inner"],!1),qg=i(["axis","y2","tick","format"],null),rg=i(["axis","y2","padding"],null),sg=i(["axis","y2","ticks"],10),tg=i(["grid","x","show"],!1),ug=i(["grid","x","type"],"tick"),vg=i(["grid","x","lines"],null),wg=i(["grid","y","show"],!1),xg=i(["grid","y","lines"],null),yg=i(["grid","y","ticks"],10),zg=i(["point","show"],!0),Ag=zg?i(["point","r"],2.5):0,Bg=i(["point","focus","line","enabled"],!0),Cg=i(["point","focus","expand","enabled"],!0),Dg=i(["point","focus","expand","r"],Cg?4:Ag),Eg=i(["point","focus","select","r"],8),Fg=i(["point","onclick"],function(){}),Gg=i(["point","onselected"],function(){}),Hg=i(["point","onunselected"],function(){}),Ig=i(["pie","label","show"],!0),Jg=i(["pie","label","format"],null),Kg=i(["pie","onclick"],function(){}),Lg=i(["pie","onmouseover"],function(){}),Mg=i(["pie","onmouseout"],function(){}),Ng=i(["donut","label","show"],!0),Og=i(["donut","label","format"],null),Pg=i(["donut","title"],""),Qg=i(["donut","onclick"],function(){}),Rg=i(["donut","onmouseover"],function(){}),Sg=i(["donut","onmouseout"],function(){}),Tg=i(["regions"],[]),Ug=i(["tooltip","show"],!0),Vg=i(["tooltip","format","title"],null),Wg=i(["tooltip","format","value"],null),Xg=i(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=Vg?Vg:b,k=Wg?Wg:c;for(f=0;f"+(g||0===g?""+g+"":"")),i=a[f].name,h=k(a[f].value,a[f].ratio),e+=""+i+""+h+"");return e+""}),Yg=i(["tooltip","init","show"],!1),Zg=i(["tooltip","init","x"],0),$g=i(["tooltip","init","position"],{top:"0px",left:"50px"}),_g=De.replace("#","")+"-clip",ah=j(_g),bh="timeseries"===Wf,ch="categorized"===Wf,dh=!bh&&(xf||yf),eh=null,fh=!1,gh=!1,hh=Cd(Jf,Qf),ih=function(){var a=[[g.time.format("%Y/%-m/%-d"),function(){return!0}],[g.time.format("%-m/%-d"),function(a){return a.getMonth()}],[g.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[g.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[g.time.format("%I %p"),function(a){return a.getHours()}],[g.time.format("%I:%M"),function(a){return a.getMinutes()}],[g.time.format(":%S"),function(a){return a.getSeconds()}],[g.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)}}(),jh=Vf?"left":"bottom",kh=Vf?gg?"top":"bottom":gg?"right":"left",lh=Vf?pg?"bottom":"top":pg?"left":"right",mh=Vf?"left":"bottom",nh={main:function(){return"translate("+Oe.left+","+Oe.top+")"},context:function(){return"translate("+Pe.left+","+Pe.top+")"},legend:function(){return"translate("+Qe.left+","+Qe.top+")"},x:function(){return"translate(0,"+(Vf?0:Te)+")"},y:function(){return"translate(0,"+(Vf?Te:0)+")"},y2:function(){return"translate("+(Vf?0:Re)+","+(Vf?1:0)+")"},subx:function(){return"translate(0,"+(Vf?0:Ue)+")"},arc:function(){return"translate("+Re/2+","+Te/2+")"}},oh="right"===Sf,ph=0,qh=0,rh=0,sh=40,th=20;df=g.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var uh,vh=function(){var a=g.svg.line().x(Vf?function(a){return V(a.id)(a.value)}:Pc).y(Vf?Pc:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=Pd(b.values);return sd(b)?(a.interpolate(td(b)?"cardinal":"linear"),If[b.id]?_d(e,nf,V(b.id),If[b.id]):a(e)):(c=nf(e[0].x),d=V(b.id)(e[0].value),Vf?"M "+d+" "+c:"M "+c+" "+d)}}(),wh=function(){var a;return a=Vf?g.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(Pc):g.svg.area().x(Pc).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=Pd(b.values);return md([b],"area")||md([b],"area-spline")?(a.interpolate(td(b)?"cardinal":"linear"),a(e)):(c=nf(e[0].x),d=V(b.id)(e[0].value),Vf?"M "+d+" "+c:"M "+c+" "+d)}}(),xh=function(){var a=g.svg.line().x(Vf?function(a){return W(a.id)(a.value)}:Sc).y(Vf?Sc:function(a){return W(a.id)(a.value)});return function(b){var c=Pd(b.values);return sd(b)?a(c):"M "+qf(c[0].x)+" "+W(b.id)(c[0].value)}}(),yh=function(){};uh=g.svg.brush().on("brush",ie),uh.update=function(){return Ch&&Ch.select(".x.brush").call(this),this},uh.scale=function(a){return Vf?this.y(a):this.x(a)},Ie&&(yh=g.behavior.zoom().on("zoomstart",function(){yh.altDomain=g.event.sourceEvent.altKey?nf.orgDomain():null}).on("zoom",Ie?je:null),yh.scale=function(a){return Vf?this.y(a):this.x(a)},yh.orgScaleExtent=function(){var a=Je?Je:[1,10];return[a[0],Math.max(mc()/a[1],a[1])]},yh.updateScaleExtent=function(){var a=Wb(nf.orgDomain())/Wb(Gh),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var zh,Ah,Bh,Ch,Dh,Eh,Fh,Gh,Hh,Ih={};if(ye.focus=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=zh.selectAll(ue(a)),d=c.filter(ve),e=c.filter(we);ye.revert(),ye.defocus(),b(d.classed("focused",!0)),b(e),rd(ye.data.targets)&&Gb(a,!0),pe(a)},ye.defocus=function(a){function b(a){a.transition().duration(100).style("opacity",.3)}var c=zh.selectAll(ue(a)),d=c.filter(ve),e=c.filter(we);ye.revert(),b(d.classed("focused",!1)),b(e),rd(ye.data.targets)&&Hb(a),qe(a)},ye.revert=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=zh.selectAll(ue(a)),d=c.filter(ve),e=c.filter(we);b(d.classed("focused",!1)),b(e),rd(ye.data.targets)&&Hb(a),re()},ye.show=function(a){zh.selectAll(ue(a)).transition().style("opacity",1)},ye.hide=function(a){zh.selectAll(ue(a)).transition().style("opacity",0)},ye.unzoom=function(){uh.clear().update(),he({withUpdateXDomain:!0})},ye.load=function(a){if("function"!=typeof a.done&&(a.done=function(){}),a.xs&&ec(a.xs),"categories"in a&&ch&&(Xf=a.categories,tf.categories(Xf)),"cacheIds"in a&&Xb(a.cacheIds))return void oe(Zb(a.cacheIds),a.done);if("data"in a)oe(ic(a.data),a.done);else if("url"in a)g.csv(a.url,function(b,c){oe(ic(c),a.done)});else if("rows"in a)oe(ic(gc(a.rows)),a.done);else{if(!("columns"in a))throw Error("url or rows or columns is required.");oe(ic(hc(a.columns)),a.done)}},ye.unload=function(a){ye.data.targets=ye.data.targets.filter(function(b){return b.id!==a}),zh.selectAll(ue(a)).transition().style("opacity",0).remove(),Rf&&Dh.selectAll(".legend-item"+te(a)).remove(),ye.data.targets.length>0&&he({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},ye.selected=function(a){var b=te(a);return g.merge(Bh.selectAll(".-shapes"+b).selectAll(".-shape").filter(function(){return g.select(this).classed(Be)}).map(function(a){return a.map(function(a){return a.__data__})}))},ye.select=function(a,b,c){Kf&&Bh.selectAll(".-shapes").selectAll(".-shape").each(function(d,f){var h="circle"===this.nodeName?Jd:Md,i="circle"===this.nodeName?Kd:Nd,j=Lf||!a||a.indexOf(d.id)>=0,k=!b||b.indexOf(f)>=0;j&&k?Mf(d)&&h(g.select(this).classed(Be,!0),d,f):e(c)&&c&&i(g.select(this).classed(Be,!1),d,f)})},ye.unselect=function(a,b){Kf&&Bh.selectAll(".-shapes").selectAll(".-shape").each(function(c,d){var e="circle"===this.nodeName?Kd:Nd,f=Lf||!a||a.indexOf(c.id)>=0,h=!b||b.indexOf(d)>=0;f&&h&&Mf(c)&&e(g.select(this).classed(Be,!1),c,d)})},ye.toLine=function(a){ld(a,"line"),me()},ye.toSpline=function(a){ld(a,"spline"),me()},ye.toBar=function(a){ld(a,"bar"),me()},ye.toScatter=function(a){ld(a,"scatter"),me()},ye.toArea=function(a){ld(a,"area"),me()},ye.toAreaSpline=function(a){ld(a,"area-spline"),me()},ye.toPie=function(a){ld(a,"pie"),me({withTransform:!0})},ye.toDonut=function(a){ld(a,"donut"),me({withTransform:!0})},ye.groups=function(a){return d(a)?Cf:(Cf=a,he(),Cf)},ye.xgrids=function(a){return a?(vg=a,he(),vg):vg},ye.xgrids.add=function(a){return a?ye.xgrids(vg.concat(a)):void 0},ye.xgrids.remove=function(a){var b=xe(a);return ye.xgrids(vg.filter(b))},ye.ygrids=function(a){return a?(xg=a,he(),xg):xg},ye.ygrids.add=function(a){return a?ye.ygrids(xg.concat(a)):void 0},ye.ygrids.remove=function(a){var b=xe(a);return ye.ygrids(xg.filter(b))},ye.regions=function(a){return d(a)?Tg:(Tg=a,he(),Tg)},ye.regions.add=function(a){return d(a)?Tg:(Tg=Tg.concat(a),he(),Tg)},ye.regions.remove=function(a,b){var d=[].concat(a);return b=e(b)?b:{},d.forEach(function(a){var d=c(b.duration)?b.duration:0;zh.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Tg=Tg.filter(function(b){return b.classes.indexOf(a)<0})}),Tg},ye.data.get=function(a){var b=ye.data.getAsTarget(a);return e(b)?b.values.map(function(a){return a.value}):void 0},ye.data.getAsTarget=function(a){var b=qc(function(b){return b.id===a});return b.length>0?b[0]:void 0},ye.resize=function(a){Ee=a?a.width:null,Fe=a?a.height:null,me({withLegend:!0,withTransition:!1})},ye.destroy=function(){ye.data.targets=void 0,ye.data.x={},Fh.html(""),a.onresize=null},"url"in f.data)g.csv(f.data.url,function(a,b){ae(b)});else if("rows"in f.data)ae(gc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ae(hc(f.data.columns))}return ye}}(window); \ No newline at end of file diff --git a/htdocs/samples/donut.html b/htdocs/samples/donut.html index 135166e..e986ee5 100644 --- a/htdocs/samples/donut.html +++ b/htdocs/samples/donut.html @@ -37,12 +37,15 @@ label: 'Petal.Width' } }, - arc: { + donut: { label: { // format: function (d, ratio) { return ""; } }, - title: "Iris Petal Width" - } + title: "Iris Petal Width", + onmouseover: function (d, i) { console.log(d, i); }, + onmouseout: function (d, i) { console.log(d, i); }, + onclick: function (d, i) { console.log(d, i); }, + } }); setTimeout(function () { diff --git a/htdocs/samples/pie.html b/htdocs/samples/pie.html index 1139254..e389bf4 100644 --- a/htdocs/samples/pie.html +++ b/htdocs/samples/pie.html @@ -35,6 +35,11 @@ y: { label: 'Petal.Width' } + }, + pie: { + onmouseover: function (d, i) { console.log(d, i); }, + onmouseout: function (d, i) { console.log(d, i); }, + onclick: function (d, i) { console.log(d, i); }, } });