From 4107077b1a985b95a897d26aab60f2b3ee369c76 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Fri, 7 Mar 2014 13:48:27 +0900 Subject: [PATCH] Extend axis.x.label --- c3.js | 10 ++++++++-- c3.min.js | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/c3.js b/c3.js index e76e4f9..ee42bf7 100644 --- a/c3.js +++ b/c3.js @@ -479,6 +479,12 @@ var maxDataCount = getMaxDataCount(); return __axis_x_tick_culling && maxDataCount > __axis_x_tick_count ? __axis_x_tick_count : maxDataCount; } + function getXAxisLabel() { + return typeof __axis_x_label === 'string' ? __axis_x_label : __axis_x_label ? __axis_x_label.text : null; + } + function getYAxisLabel() { + return typeof __axis_y_label === 'string' ? __axis_y_label : __axis_y_label ? __axis_y_label.text : null; + } //-- Arc --// @@ -1705,7 +1711,7 @@ .attr("x", width) .attr("dy", "-.5em") .style("text-anchor", "end") - .text(__axis_x_label); + .text(getXAxisLabel); main.append("g") .attr("class", "y axis") .attr("clip-path", __axis_rotated ? "url(" + document.URL + "#yaxis-clip)" : "") @@ -1714,7 +1720,7 @@ .attr("dy", "1.2em") .attr("dx", "-.5em") .style("text-anchor", "end") - .text(__axis_y_label); + .text(getYAxisLabel); if (__axis_y2_show) { main.append("g") diff --git a/c3.min.js b/c3.min.js index bebe816..79085de 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 s(){return yc(Dd.data.targets)?0:Ld?Ld:jf?1:u("y")}function t(){return yc(Dd.data.targets)?0:Md?Md:hg?be*(nf&&!Xe?1.25:1):nf?rf||Xe?1:u("y2"):1}function u(){return 40}function v(){return+g.select(Id).style("width").replace("px","")}function w(){return+g.select(Id).style("height").replace("px","")}function x(){return Wd+2}function y(){return 40}function z(){return Td.left+20}function A(){return Yd+2}function B(){var a=Xe?Yd:Wd,b=_(),c=wb();return c>1?a*b/(c-1):a}function C(){return Ue?hg?150:$d:0}function D(){return Ue?hg?_d:40:0}function E(){var a,b;je=Xe?1:0,ke=Xe?Yd:Wd,le=Xe?0:Yd,me=Xe?Wd:1,ne=je,oe=ke,pe=Xe?0:Zd,qe=Xe?Xd:1,re=G(je,ke,re?re.domain():void 0,function(){return xe.tickOffset()}),se=H(le,me,se?se.domain():void 0),te=H(le,me,te?te.domain():void 0),ue=G(je,ke,wg,function(a){return a%1?0:Ae.tickOffset()}),ve=H(pe,qe),we=H(pe,qe),a=N(),b=O(),xe=K(re,cg,a,b),Ae=K(ue,fg,a,b),ye=L(se,dg,kf,mf),ze=L(te,eg,sf,uf),F()}function F(){fe=Q(),ge=R(),he=R(.98)}function G(a,b,c,f){var h=(Wf?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}),Xf){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 H(a,b){return g.scale.linear().range([a,b])}function I(a){return"y2"===M(a)?te:se}function J(a){return"y2"===M(a)?we:ve}function K(a,c,d,e){var f=(Xf?b():g.svg.axis()).scale(a).orient(c);return f.tickFormat(d).ticks(e),Xf?f.tickCentered($e):f.tickOffset=function(){var a=Xe?Yd:Wd;return a*_()/wb()/2},Xf&&f.categories(Ze),f}function L(a,b,c,d){return g.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function M(a){return a in He?He[a]:"y"}function N(){var a=Wf?bg:Xf?Fb:null;return _e&&("function"==typeof _e?a=_e:Wf&&(a=function(a){return g.time.format(_e)(a)})),a}function O(){var a=wb();return af&&a>bf?bf:a}function P(a){var b=!1;return ie(Dd.data.targets).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Q(){var a=g.svg.arc().outerRadius(ce).innerRadius(ee),b=function(b,c){var d;return c?a(b):(d=P(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function R(a){var b=g.svg.arc().outerRadius(de*(a?a:1)).innerRadius(ee);return function(a){var c=P(a);return c?b(c):"M 0 0"}}function S(a,b){return Fc(a.data)?fe(a,b):"M 0 0"}function T(a){var b,c,d,e,f=P(a),g="";return f&&(b=fe.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ce*.8+","+d/e*ce*.8+")"),g}function U(a){return(a.endAngle-a.startAngle)/(2*Math.PI)}function V(a){return Kf(a,U(a))}function W(a,b){var c=pg.selectAll(".chart-arc"+Ad(a)),d=pg.selectAll(".-arc").filter(function(b){return b.data.id!==a});c.selectAll("path").transition().duration(50).attr("d",ge).transition().duration(100).attr("d",he).each(function(a){Ec(a.data)}),b||d.style("opacity",.3)}function X(a){var b=pg.selectAll(".chart-arc"+Ad(a));b.selectAll("path").transition().duration(50).attr("d",fe),pg.selectAll(".-arc").style("opacity",1)}function Y(a){var b,c,d,e,f,h=Bb(a);if(Ge.length>0)for(f=Db(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 Z(a){var b,c,d,e,f,h=Bb(a);if(Ge.length>0)for(f=Eb(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 $(a){var b=Ab(function(b){return M(b.id)===a}),d="y2"===a?pf:ff,e="y2"===a?of:ef,f=d?d:Y(b),g=e?e:Z(b),h=.22*Math.abs(g-f),i=h,j=h,k="y2"===a?qf:gf;if(k){var l=Math.max(Math.abs(f),Math.abs(g));g=l-k,f=k-l}return"y"===a&&lf&&(i=c(lf.top)?lf.top:h,j=c(lf.bottom)?lf.bottom:h),"y2"===a&&tf&&(i=c(tf.top)?tf.top:h,j=c(tf.bottom)?tf.bottom:h),uc(b)&&!Db(b)&&(j=f),[f-j,g+i]}function _(a){return a?1:eb(wg)/eb(re.domain())}function ab(a){return g.min(a,function(a){return g.min(a.values,function(a){return a.x})})}function bb(a){return g.max(a,function(a){return g.max(a.values,function(a){return a.x})})}function cb(a,b){var c,d=b[0],e=b[1],f=Math.abs(d-e);return c=Xf?0:uc(a)?f/(wb()-1)/2:.01*f}function db(a){var b=[ab(a),bb(a)],c=b[0],d=b[1],e=cb(a,b),f=Wf?new Date(c.getTime()-e):c-e,g=Wf?new Date(d.getTime()+e):d+e;return[f,g]}function eb(a){return a[1]-a[0]}function fb(a){for(var b=0;bd?0:d}function kb(a){return Be&&a===Be||Ce&&Oc(Ce,a)}function lb(a){return!kb(a)}function mb(a){return Be?Be:Ce?Ce[a]:null}function nb(a,b){return a in Dd.data.x&&Dd.data.x[a]&&Dd.data.x[a][b]?Dd.data.x[a][b]:b}function ob(a){Object.keys(a).forEach(function(b){Ce[b]=a[b]})}function pb(a){var b;return a&&(b=Fe[a.id],a.name=b?b:a.id),a}function qb(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?b.map(function(a){return a[c]}):Dd.data.x[Object.keys(Dd.data.x)[0]]}),c=d.map(function(a){var c=Ee(a);return{id:c,id_org:a,values:b.map(function(b,d){var e,f=mb(a);return e=Wf?Kc(b[f]):Yf?b[f]?+b[f]:nb(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++})}),Ie&&sc(yb(c).filter(function(a){return!(a in Je)}),Ie),c.forEach(function(a){gb(a.id_org,a)}),c)}function tb(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 ub(a){return a>0&&Dd.data.targets[0].values[a-1]?Dd.data.targets[0].values[a-1].x:void 0}function vb(a){return a1?Dd.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Dd.data.targets[0]:null,a}function yb(a){return a=d(a)?Dd.data.targets:a,a.map(function(a){return a.id})}function zb(a){var b,c=yb();for(b=0;ba})}function Eb(a){return Cb(a,function(a){return a>0})}function Fb(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(ac(a,f))),a[g].x&&(e=e.concat(ac(a,g))),dc(e,b)):bc(a,b,f,g)}function cc(a,b){var c;return c=a.map(function(a){return bc(a.values,b)}),dc(c,b)}function dc(a,b){var c,d;return a.forEach(function(a){var e=Pc(a,b);(c>e||!c)&&(c=e,d=a)}),d}function ec(){return Le&&"desc"===Le.toLowerCase()}function fc(){return Le&&"asc"===Le.toLowerCase()}function gc(a){var b=fc(),c=ec();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 Le&&a.sort(Le),a}function hc(a,b){var d,e,f,g,h,i,j,k=a.filter(function(a){return a&&c(a.value)});Nf&&0!==k.length&&(ug.html(Qf(a,N(),_b,ag)).style("visibility","hidden").style("display","block"),d=ug.property("offsetWidth"),e=ug.property("offsetHeight"),Xe?(f=p(),g=f+b[0]+100,h=g+d,j=q()-t(),i=re(k[0].x)+20):(f=p(),g=f+s()+re(k[0].x)+20,h=g+d,j=f+q()-t(),i=b[1]+15),h>j&&(g-=d+60),i+e>r()&&(i-=e+30),ug.style("top",i+"px").style("left",g+"px").style("visibility","visible"))}function ic(){ug.style("display","none")}function jc(a){var b=a.filter(function(a){return a&&c(a.value)});Nf&&(vc(Dd.data.targets)||yc(Dd.data.targets)||rg.selectAll("line.xgrid-focus").style("visibility","visible").data([b[0]]).attr(Xe?"y1":"x1",Xb).attr(Xe?"y2":"x2",Xb))}function kc(){rg.select("line.xgrid-focus").style("visibility","hidden")}function lc(a){return a.x||0===a.x?re(a.x):null}function mc(a){return I(a.id)(a.value)}function nc(){var a,b,c={},e=0;return Ab(Bc).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function rc(a,b){return b?2*a.tickOffset()*.6/b:0}function sc(a,b){var c=d(a)?yb():a;"string"==typeof c&&(c=[c]);for(var e=0;e=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function hd(b){var c,d,e,f,h;if(vg=g.select(Id),vg.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(vg.html(""),Dd.data.x={},Dd.data.targets=sb(b),n(),E(),re.domain(g.extent(db(Dd.data.targets))),se.domain($("y")),te.domain($("y2")),ue.domain(re.domain()),ve.domain(se.domain()),we.domain(te.domain()),wg=re.domain(),kg.scale(ue),Nd&&og.scale(re),pg=g.select(Id).append("svg").attr("width",Wd+Td.left+Td.right).attr("height",Yd+Td.top+Td.bottom).on("mouseenter",Qd).on("mouseleave",Rd),qg=pg.append("defs"),qg.append("clipPath").attr("id",Uf).append("rect").attr("width",Wd).attr("height",Yd),qg.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-20).attr("width",x).attr("height",y),qg.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-Td.left+1).attr("width",z).attr("height",A),rg=pg.append("g").attr("transform",gg.main),sg=Re?pg.append("g").attr("transform",gg.context):null,tg=Ue?pg.append("g").attr("transform",gg.legend):null,ug=g.select(Id).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none"),rg.append("g").attr("class","x axis").attr("clip-path",Xe?"":"url("+document.URL+"#xaxis-clip)").attr("transform",gg.x).append("text").attr("class","-axis-x-label").attr("x",Wd).attr("dy","-.5em").style("text-anchor","end").text(df),rg.append("g").attr("class","y axis").attr("clip-path",Xe?"url("+document.URL+"#yaxis-clip)":"").append("text").attr("transform","rotate(-90)").attr("dy","1.2em").attr("dx","-.5em").style("text-anchor","end").text(hf),nf&&rg.append("g").attr("class","y2 axis").attr("transform",gg.y2),d=rg.append("g").attr("clip-path",Vf).attr("class","grid"),vf&&d.append("g").attr("class","xgrids"),xf&&(e=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(xf).enter().append("g").attr("class","xgrid-line"),e.append("line").attr("class",function(a){return""+a["class"]}),e.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",Xe?"":"rotate(-90)").attr("dx",Xe?0:-Td.top).attr("dy",-5).text(function(a){return a.text})),Df&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",Xe?0:-10).attr("x2",Xe?Wd:-10).attr("y1",Xe?-10:Td.top).attr("y2",Xe?-10:Yd),yf&&d.append("g").attr("class","ygrids"),zf&&(f=d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(zf).enter().append("g").attr("class","ygrid-line"),f.append("line").attr("class",function(a){return""+a["class"]}),f.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",Xe?"rotate(-90)":"").attr("dx",Xe?0:-Td.top).attr("dy",-5).text(function(a){return a.text})),rg.append("g").attr("clip-path",Vf).attr("class","regions"),rg.append("g").attr("clip-path",Vf).attr("class","chart"),c=rg.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",Nd?Xe?"ns-resize":"ew-resize":null),rg.select(".chart").append("g").attr("class","chart-bars"),rg.select(".chart").append("g").attr("class","chart-lines"),rg.select(".chart").append("g").attr("class","chart-arcs").attr("transform",gg.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(Lf),rg.select(".chart").append("g").attr("class","chart-texts"),Nd&&rg.insert("rect",Pd?null:"g.grid").attr("class","zoom-rect").attr("width",Wd).attr("height",Yd).style("opacity",0).style("cursor",Xe?"ns-resize":"ew-resize").call(og).on("dblclick.zoom",null),null!==cf&&kg.extent("function"!=typeof cf?cf:cf(db())),Re&&(sg.append("g").attr("clip-path",Vf).attr("class","chart"),sg.select(".chart").append("g").attr("class","chart-bars"),sg.select(".chart").append("g").attr("class","chart-lines"),sg.append("g").attr("clip-path",Vf).attr("class","x brush").call(kg).selectAll("rect").attr(Xe?"width":"height",Xe?Xd:Zd),sg.append("g").attr("class","x axis").attr("transform",gg.subx).attr("clip-path",Xe?"url("+document.URL+"#yaxis-clip)":"")),Ue&&yd(Dd.data.targets),td(Dd.data.targets),od({withTransform:!0,withUpdateXDomain:!0}),Rf){if(Wf&&"string"==typeof Sf){for(Sf=Kc(Sf),h=0;h0){d=[];for(var f in Fe)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=Vc,o=c+e>f&&h>c&&j>d),o^n&&(l.classed(Hd,!n),l.classed(Gd,!m),k(!m,l,a,b))}))}function md(a){yc(Dd.data.targets)||Oe&&(Zf=a,rg.select(".chart").append("rect").attr("class","dragarea").style("opacity",.1),$f=!0)}function nd(){yc(Dd.data.targets)||Oe&&(rg.select(".dragarea").transition().duration(100).style("opacity",0).remove(),rg.selectAll(".-shape").classed(Hd,!1),$f=!1)}function od(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,C,D,E,F=nc(),G=yc(Dd.data.targets);if(a=e(a)?a:{},s=e(a.withY)?a.withY:!0,t=e(a.withSubchart)?a.withSubchart:!0,u=e(a.withTransition)?a.withTransition:!0,v=e(a.withTransform)?a.withTransform:!1,w=e(a.withUpdateXDomain)?a.withUpdateXDomain:!1,x=e(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=u?Sd:0,E=e(a.durationForExit)?a.durationForExit:D,x&&(re.domain(g.extent(db(Dd.data.targets))),wg=re.domain(),Nd&&og.scale(re).updateScaleExtent(),ue.domain(re.domain()),kg.scale(ue)),w&&(re.domain(kg.empty()?wg:kg.extent()),Nd&&og.scale(re).updateScaleExtent()),se.domain($("y")),te.domain($("y2")),rg.select(".x.axis").style("opacity",G?0:1).transition().duration(D).call(Xe?ye:xe),rg.select(".y.axis").style("opacity",G?0:1).transition().duration(D).call(Xe?xe:ye),rg.select(".y2.axis").style("opacity",G?0:1).transition().call(ze),y=bd(F),A=cd(F,!0),C=cd(F,!1),rg.select(".x.axis .-axis-x-label").attr("x",Wd),ve.domain(se.domain()),we.domain(te.domain()),ug.style("display","none"),rg.select("line.xgrid-focus").style("visibility","hidden").attr("y2",Yd),vf){if("year"===wf){d=[];for(var H=db(),I=H[0].getFullYear(),J=H[1].getFullYear(),K=I;J>=K;K++)d.push(new Date(K+"-01-01 00:00:00"))}else d=re.ticks(10);b=rg.select(".xgrids").selectAll(".xgrid").data(d),b.enter().append("line").attr("class","xgrid"),b.attr("x1",Xe?0:function(a){return re(a)-xe.tickOffset()}).attr("x2",Xe?Wd:function(a){return re(a)-xe.tickOffset()}).attr("y1",Xe?function(a){return re(a)-xe.tickOffset()}:Td.top).attr("y2",Xe?function(a){return re(a)-xe.tickOffset()}:Yd).style("opacity",function(){return+g.select(this).attr(Xe?"y1":"x1")===(Xe?Yd:0)?0:1}),b.exit().remove()}xf&&(f=rg.selectAll(".xgrid-lines"),f.selectAll("line").transition().duration(D).attr("x1",Xe?0:Yb).attr("x2",Xe?Wd:Yb).attr("y1",Xe?Yb:Td.top).attr("y2",Xe?Yb:Yd),f.selectAll("text").attr("x",Xe?Wd:0).attr("y",Yb)),s&&yf&&(h=rg.select(".ygrids").selectAll(".ygrid").data(se.ticks(Af)),h.enter().append("line").attr("class","ygrid"),h.attr("x1",Xe?se:0).attr("x2",Xe?se:Wd).attr("y1",Xe?0:se).attr("y2",Xe?Yd:se),h.exit().remove()),s&&zf&&(i=rg.select(".ygrid-lines"),i.selectAll("line").transition().duration(D).attr("x1",Xe?Zb:0).attr("x2",Xe?Zb:Wd).attr("y1",Xe?0:Zb).attr("y2",Xe?Yd:Zb),i.selectAll("text").attr("x",Xe?0:Wd).attr("y",Zb)),k=rg.selectAll(".-bars").selectAll(".-bar").data(Gc),k.enter().append("path").attr("d",y).style("stroke","none").style("opacity",0).style("fill",function(a){return ag(a.id)}).attr("class",Qb),k.style("opacity",Tb).transition().duration(D).attr("d",y).style("opacity",1),k.exit().transition().duration(E).style("opacity",0).remove(),m=rg.selectAll(".-texts").selectAll(".-text").data(Ic),m.enter().append("text").attr("class",Gb).attr("text-anchor",function(a){return Xe?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return _b(a.value)}),m.style("fill-opacity",Ub).transition().duration(D).attr("x",A).attr("y",C).style("fill-opacity",Wb),m.exit().transition().duration(E).style("fill-opacity",0).remove(),rg.selectAll(".-line").style("opacity",Tb).transition().duration(D).attr("d",lg).style("opacity",1),rg.selectAll(".-area").style("opacity",0).transition().duration(D).attr("d",mg).style("opacity",xg),j=rg.selectAll(".-circles").selectAll(".-circle").data(Hc),j.enter().append("circle").attr("class",Pb).style("opacity",0).attr("r",Cf),j.style("opacity",Tb).transition().duration(D).style("opacity",Vb).attr("cx",Xe?mc:lc).attr("cy",Xe?lc:mc),j.exit().remove(),rg.selectAll(".chart-arc").select(".-arc").attr("transform",v?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(D).attrTween("d",function(a){var b=P(a);if(!b)return function(){return"M 0 0"};var c=g.interpolate(this._current,b);return this._current=c(0),function(a){return S(c(a),!0)}}).attr("transform",v?"scale(1)":"").style("opacity",1),rg.selectAll(".chart-arc").select("text").attr("transform",T).style("opacity",0).transition().duration(D).text(V).style("opacity",function(a){return Fc(a.data)?1:0}),rg.select(".chart-arcs-title").style("opacity",xc(Dd.data.targets)?1:0),Re&&(null!==g.event&&"zoom"===g.event.type&&kg.extent(re.orgDomain()).update(),t&&(sg.select(".x.axis").style("opacity",G?0:1).transition().duration(D).call(Ae),kg.empty()||kg.extent(re.orgDomain()).update(),z=bd(F,!0),n=sg.selectAll(".-bars").selectAll(".-bar").data(Gc),n.enter().append("path").attr("d",z).style("stroke","none").style("fill",function(a){return ag(a.id) -}).attr("class",Qb),n.style("opacity",Tb).transition().duration(D).attr("d",z).style("opacity",1),n.exit().transition().duration(D).style("opacity",0).remove(),sg.selectAll(".-line").style("opacity",Tb).transition().duration(D).attr("d",ng).style("opacity",1))),rg.selectAll(".selected-circles").filter(function(a){return Bc(a)}).selectAll("circle").remove(),rg.selectAll(".selected-circle").transition().duration(D).attr("cx",Xe?mc:lc).attr("cy",Xe?lc:mc),Ce?(o=rg.select(".event-rects").selectAll(".event-rect").data([0]),jd(o.enter()),o.attr("x",0).attr("y",0).attr("width",Wd).attr("height",Yd)):(Yf?(r=function(a,b){var c=ub(b),d=vb(b);return(re(d?d:a.x+50)-re(c?c:a.x-50))/2},q=function(a,b){var c=ub(b);return(re(a.x)+re(c?c:a.x-50))/2}):(r=B(),q=function(a){return re(a.x)-r/2}),p=xb(),rg.select(".event-rects").datum(p?p.values:[]),o=rg.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),id(o.enter()),o.attr("class",Sb).attr("x",Xe?0:q).attr("y",Xe?q:0).attr("width",Xe?Wd:r).attr("height",Xe?r:Yd),o.exit().remove()),l=rg.select(".regions").selectAll("rect.region").data(Mf),l.enter().append("rect").style("fill-opacity",0),l.attr("class",Rb).attr("x",Xe?0:ib).attr("y",Xe?ib:Td.top).attr("width",Xe?Wd:jb).attr("height",Xe?jb:Yd).transition().duration(D).style("fill-opacity",function(a){return c(a.opacity)?a.opacity:.1}),l.exit().transition().duration(D).style("fill-opacity",0).remove(),Ue&&yd(Dd.data.targets,{withTransition:u}),yb().forEach(function(a){yg[a]=!0})}function pd(){od({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function qd(){return"mousemove"===g.event.sourceEvent.type&&og.altDomain?(re.domain(og.altDomain),void og.scale(re).updateScaleExtent()):(Xf&&re.orgDomain()[0]===wg[0]&&re.domain([wg[0]-1e-10,re.orgDomain()[1]]),od({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===g.event.sourceEvent.type&&(_f=!0)))}function rd(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function sd(a){var b,c;a=e(a)?a:{},b=e(a.withTransition)?a.withTransition:!1,c=e(a.withTransform)?a.withTransform:!1,n(),E(),kg.scale(ue),Nd&&og.scale(re),pg.attr("width",$d).attr("height",_d),pg.select("#"+Uf).select("rect").attr("width",Wd).attr("height",Yd),pg.select("#xaxis-clip").select("rect").attr("width",x),pg.select(".zoom-rect").attr("width",Wd).attr("height",Yd),m(b),od({withTransition:b,withUpdateXDomain:!0,withTransform:c,durationForExit:0})}function td(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=rg.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",Hb).style("fill",function(a){return ag(a.id)}),e=rg.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",Lb).style("fill",function(a){return ag(a.id)}).style("stroke","none").style("cursor",function(a){return Qe(a)?"pointer":null}),c=rg.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",Jb).style("opacity",0).style("stroke",function(a){return ag(a.id)}),b.append("path").attr("class",Nb).style("opacity",function(){return xg=+g.select(this).style("opacity"),0}).style("fill",function(a){return ag(a.id)}),b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id}),b.append("g").attr("class",Kb).style("fill",function(a){return ag(a.id)}).style("cursor",function(a){return Qe(a)?"pointer":null}),a.forEach(function(a){var b=zd(a.id);rg.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})}),h=rg.select(".chart-arcs").selectAll(".chart-arc").data(ie(a)),f=h.enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id}),f.append("path").attr("class",Mb).style("opacity",0).style("fill",function(a){return ag(a.data.id)}).style("cursor",function(a){return Qe(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){W(a.data.id),vd(a.data.id)}).on("mouseout",function(a){X(a.data.id),xd()}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Re&&(n=sg.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",Lb).style("fill",function(a){return ag(a.id)}),l=sg.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",Jb).style("opacity",0).style("stroke",function(a){return ag(a.id)})),Ue&&yd(a),pg.selectAll(".target").transition().style("opacity",1)}function ud(a,b){Dd.data.targets.forEach(function(b){for(var c=0;cq&&(q=d,hg||(l=(be-q*Object.keys(a).length)/2)),e>p&&(p=e,hg&&(l=(ae-p*Object.keys(a).length)/2))},c=tg.selectAll(".legend-item").data(o).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){We(a)}).on("mouseover",function(a){vd(a),Dd.focus(a)}).on("mouseout",function(){xd(),Dd.revert()}),c.append("text").text(function(a){return e(Fe[a])?Fe[a]:a}).each(function(){m(this)}).style("pointer-events","none").attr("x",hg?g:-200).attr("y",hg?-200:i),c.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",hg?h:-200).attr("y",hg?-200:k).attr("width",q+14).attr("height",24),c.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return ag(a)}).attr("x",hg?g:-200).attr("y",hg?-200:j).attr("width",10).attr("height",10),tg.selectAll("text").data(o).each(function(){m(this)}).transition().duration(n?250:0).attr("x",g).attr("y",j),tg.selectAll("rect.legend-item-event").data(o).transition().duration(n?250:0).attr("x",h).attr("y",k),tg.selectAll("rect.legend-item-tile").data(o).transition().duration(n?250:0).attr("x",f).attr("y",i)}function zd(a){return a?"-"+a.replace(/\./g,"\\."):""}function Ad(a){return".target"+zd(a)}function Bd(a){return zb(a.id)}function Cd(a){return"data"in a&&zb(a.data.id)}var Dd={data:{}},Ed={},Fd="_expanded_",Gd="_selected_",Hd="_included_",Id=i(["bindto"],"#chart"),Jd=i(["size","width"],null),Kd=i(["size","height"],null),Ld=i(["padding","left"],null),Md=i(["padding","right"],null),Nd=i(["zoom","enabled"],!1),Od=i(["zoom","extent"],null),Pd=i(["zoom","privileged"],!1),Qd=i(["onenter"],function(){}),Rd=i(["onleave"],function(){}),Sd=i(["transition","duration"],350);h("data","data is required in config");var Td,Ud,Vd,Wd,Xd,Yd,Zd,$d,_d,ae,be,ce,de,ee,fe,ge,he,ie,je,ke,le,me,ne,oe,pe,qe,re,se,te,ue,ve,we,xe,ye,ze,Ae,Be=i(["data","x"],null),Ce=i(["data","xs"],null),De=i(["data","x_format"],"%Y-%m-%d"),Ee=i(["data","id_converter"],function(a){return a}),Fe=i(["data","names"],{}),Ge=i(["data","groups"],[]),He=i(["data","axes"],{}),Ie=i(["data","type"],null),Je=i(["data","types"],{}),Ke=i(["data","labels"],{}),Le=i(["data","order"],null),Me=i(["data","regions"],{}),Ne=i(["data","colors"],{}),Oe=i(["data","selection","enabled"],!1),Pe=i(["data","selection","grouped"],!1),Qe=i(["data","selection","isselectable"],function(){return!0}),Re=i(["subchart","show"],!1),Se=Re?i(["subchart","size","height"],60):0,Te=i(["color","pattern"],null),Ue=i(["legend","show"],!0),Ve=i(["legend","position"],"bottom"),We=i(["legend","item","onclick"],function(){}),Xe=i(["axis","rotated"],!1),Ye=i(["axis","x","type"],"indexed"),Ze=i(["axis","x","categories"],[]),$e=i(["axis","x","tick","centered"],!1),_e=i(["axis","x","tick","format"],null),af=i(["axis","x","tick","culling"],Xe||"categorized"===Ye?!1:!0),bf=i(["axis","x","tick","count"],10),cf=i(["axis","x","default"],null),df=i(["axis","x","label"],null),ef=i(["axis","y","max"],null),ff=i(["axis","y","min"],null),gf=i(["axis","y","center"],null),hf=i(["axis","y","label"],null),jf=i(["axis","y","inner"],!1),kf=i(["axis","y","tick","format"],null),lf=i(["axis","y","padding"],null),mf=i(["axis","y","ticks"],10),nf=i(["axis","y2","show"],!1),of=i(["axis","y2","max"],null),pf=i(["axis","y2","min"],null),qf=i(["axis","y2","center"],null),rf=i(["axis","y2","inner"],!1),sf=i(["axis","y2","tick","format"],null),tf=i(["axis","y2","padding"],null),uf=i(["axis","y2","ticks"],10),vf=i(["grid","x","show"],!1),wf=i(["grid","x","type"],"tick"),xf=i(["grid","x","lines"],null),yf=i(["grid","y","show"],!1),zf=i(["grid","y","lines"],null),Af=i(["grid","y","ticks"],10),Bf=i(["point","show"],!0),Cf=Bf?i(["point","r"],2.5):0,Df=i(["point","focus","line","enabled"],!0),Ef=i(["point","focus","expand","enabled"],!0),Ff=i(["point","focus","expand","r"],Ef?4:Cf),Gf=i(["point","focus","select","r"],8),Hf=i(["point","onclick"],function(){}),If=i(["point","onselected"],function(){}),Jf=i(["point","onunselected"],function(){}),Kf=i(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),Lf=i(["arc","title"],""),Mf=i(["regions"],[]),Nf=i(["tooltip","enabled"],!0),Of=i(["tooltip","format","title"],null),Pf=i(["tooltip","format","value"],null),Qf=i(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=Of?Of:b,k=Pf?Pf:c;for(f=0;f"+g+""),i=a[f].name,h=k(a[f].value),e+=""+i+""+h+"");return e+""}),Rf=i(["tooltip","init","show"],!1),Sf=i(["tooltip","init","x"],0),Tf=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Uf=Id.replace("#","")+"-clip",Vf="url("+document.URL+"#"+Uf+")",Wf="timeseries"===Ye,Xf="categorized"===Ye,Yf=!Wf&&(Be||Ce),Zf=null,$f=!1,_f=!1,ag=Jc(Ne,Te),bg=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)}}(),cg=Xe?"left":"bottom",dg=Xe?jf?"top":"bottom":jf?"right":"left",eg=Xe?rf?"bottom":"top":rf?"left":"right",fg=Xe?"left":"bottom",gg={main:function(){return"translate("+Td.left+","+Td.top+")"},context:function(){return"translate("+Ud.left+","+Ud.top+")"},legend:function(){return"translate("+Vd.left+","+Vd.top+")"},y2:function(){return"translate("+(Xe?0:Wd)+","+(Xe?1:0)+")"},x:function(){return"translate(0,"+Yd+")"},subx:function(){return"translate(0,"+(Xe?0:Zd)+")"},arc:function(){return"translate("+Wd/2+","+Yd/2+")"}},hg="right"===Ve,ig=40,jg=20;ie=g.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var kg,lg=function(){var a=g.svg.line().x(Xe?function(a){return I(a.id)(a.value)}:Xb).y(Xe?Xb:function(a){return I(a.id)(a.value)});return function(b){var c,d,e=Wc(b.values);return zc(b)?(a.interpolate(Ac(b)?"cardinal":"linear"),Me[b.id]?gd(e,re,I(b.id),Me[b.id]):a(e)):(c=re(e[0].x),d=I(b.id)(e[0].value),Xe?"M "+d+" "+c:"M "+c+" "+d)}}(),mg=function(){var a;return a=Xe?g.svg.area().x0(function(a){return I(a.id)(0)}).x1(function(a){return I(a.id)(a.value)}).y(Xb):g.svg.area().x(Xb).y0(function(a){return I(a.id)(0)}).y1(function(a){return I(a.id)(a.value)}),function(b){var c,d,e=Wc(b.values);return tc([b],"area")||tc([b],"area-spline")?(a.interpolate(Ac(b)?"cardinal":"linear"),a(e)):(c=re(e[0].x),d=I(b.id)(e[0].value),Xe?"M "+d+" "+c:"M "+c+" "+d)}}(),ng=function(){var a=g.svg.line().x(Xe?function(a){return J(a.id)(a.value)}:$b).y(Xe?$b:function(a){return J(a.id)(a.value)});return function(b){var c=Wc(b.values);return zc(b)?a(c):"M "+ue(c[0].x)+" "+J(b.id)(c[0].value)}}(),og=function(){};kg=g.svg.brush().on("brush",pd),kg.update=function(){return sg&&sg.select(".x.brush").call(this),this},kg.scale=function(a){return Xe?this.y(a):this.x(a)},Nd&&(og=g.behavior.zoom().on("zoomstart",function(){og.altDomain=g.event.sourceEvent.altKey?re.orgDomain():null}).on("zoom",Nd?qd:null),og.scale=function(a){return Xe?this.y(a):this.x(a)},og.orgScaleExtent=function(){var a=Od?Od:[1,10];return[a[0],Math.max(wb()/a[1],a[1])]},og.updateScaleExtent=function(){var a=eb(re.orgDomain())/eb(wg),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var pg,qg,rg,sg,tg,ug,vg,wg,xg,yg={};if(Dd.focus=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=pg.selectAll(Ad(a)),d=c.filter(Bd),e=c.filter(Cd);Dd.revert(),Dd.defocus(),b(d.classed("focused",!0)),b(e),yc(Dd.data.targets)&&W(a,!0),vd(a)},Dd.defocus=function(a){function b(a){a.transition().duration(100).style("opacity",.3)}var c=pg.selectAll(Ad(a)),d=c.filter(Bd),e=c.filter(Cd);Dd.revert(),b(d.classed("focused",!1)),b(e),yc(Dd.data.targets)&&X(a),wd(a)},Dd.revert=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=pg.selectAll(Ad(a)),d=c.filter(Bd),e=c.filter(Cd);b(d.classed("focused",!1)),b(e),yc(Dd.data.targets)&&X(a),xd()},Dd.show=function(a){pg.selectAll(Ad(a)).transition().style("opacity",1)},Dd.hide=function(a){pg.selectAll(Ad(a)).transition().style("opacity",0)},Dd.unzoom=function(){kg.clear().update(),od({withUpdateXDomain:!0})},Dd.load=function(a){if("function"!=typeof a.done&&(a.done=function(){}),a.xs&&ob(a.xs),"categories"in a&&Xf&&(Ze=a.categories,xe.categories(Ze)),"cacheIds"in a&&fb(a.cacheIds))return void ud(hb(a.cacheIds),a.done);if("data"in a)ud(sb(a.data),a.done);else if("url"in a)g.csv(a.url,function(b,c){ud(sb(c),a.done)});else if("rows"in a)ud(sb(qb(a.rows)),a.done);else{if(!("columns"in a))throw Error("url or rows or columns is required.");ud(sb(rb(a.columns)),a.done)}},Dd.unload=function(a){Dd.data.targets=Dd.data.targets.filter(function(b){return b.id!==a}),pg.selectAll(Ad(a)).transition().style("opacity",0).remove(),Ue&&(pg.selectAll(".legend-item"+zd(a)).remove(),yd(Dd.data.targets)),Dd.data.targets.length>0&&od({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})},Dd.selected=function(a){var b=zd(a);return g.merge(rg.selectAll(".-shapes"+b).selectAll(".-shape").filter(function(){return g.select(this).classed(Gd)}).map(function(a){return a.map(function(a){return a.__data__})}))},Dd.select=function(a,b,c){Oe&&rg.selectAll(".-shapes").selectAll(".-shape").each(function(f,h){var i="circle"===this.nodeName?Qc:Tc,j="circle"===this.nodeName?Rc:Uc;b.indexOf(h)>=0?Qe(f)&&(Pe||d(a)||a.indexOf(f.id)>=0)&&i(g.select(this).classed(Gd,!0),f,h):e(c)&&c&&j(g.select(this).classed(Gd,!1),f,h)})},Dd.unselect=function(a,b){Oe&&rg.selectAll(".-shapes").selectAll(".-shape").each(function(c,e){var f="circle"===this.nodeName?Rc:Uc;(d(b)||b.indexOf(e)>=0)&&Qe(c)&&(Pe||d(a)||a.indexOf(c.id)>=0)&&f(g.select(this).classed(Gd,!1),c,e)})},Dd.toLine=function(a){sc(a,"line"),sd({withTransition:!0})},Dd.toSpline=function(a){sc(a,"spline"),sd({withTransition:!0})},Dd.toBar=function(a){sc(a,"bar"),sd({withTransition:!0})},Dd.toScatter=function(a){sc(a,"scatter"),sd({withTransition:!0})},Dd.toArea=function(a){sc(a,"area"),sd({withTransition:!0})},Dd.toAreaSpline=function(a){sc(a,"area-spline"),sd({withTransition:!0})},Dd.toPie=function(a){sc(a,"pie"),sd({withTransition:!0,withTransform:!0})},Dd.toDonut=function(a){sc(a,"donut"),sd({withTransition:!0,withTransform:!0})},Dd.groups=function(a){return d(a)?Ge:(Ge=a,od(),Ge)},Dd.regions=function(a){return d(a)?Mf:(Mf=a,od(),Mf)},Dd.regions.add=function(a){return d(a)?Mf:(Mf=Mf.concat(a),od(),Mf)},Dd.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;pg.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Mf=Mf.filter(function(b){return b.classes.indexOf(a)<0})}),Mf},Dd.data.get=function(a){var b=Dd.data.getAsTarget(a);return e(b)?b.values.map(function(a){return a.value}):void 0},Dd.data.getAsTarget=function(a){var b=Ab(function(b){return b.id===a});return b.length>0?b[0]:void 0},Dd.resize=function(a){Jd=a?a.width:null,Kd=a?a.height:null,sd()},Dd.destroy=function(){Dd.data.targets=void 0,Dd.data.x={},vg.html(""),a.onresize=null},"url"in f.data)g.csv(f.data.url,function(a,b){hd(b)});else if("rows"in f.data)hd(qb(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");hd(rb(f.data.columns))}return Dd}}(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 s(){return Ac(Fd.data.targets)?0:Nd?Nd:lf?1:u("y")}function t(){return Ac(Fd.data.targets)?0:Od?Od:jg?de*(pf&&!Ze?1.25:1):pf?tf||Ze?1:u("y2"):1}function u(){return 40}function v(){return+g.select(Kd).style("width").replace("px","")}function w(){return+g.select(Kd).style("height").replace("px","")}function x(){return Yd+2}function y(){return 40}function z(){return Vd.left+20}function A(){return $d+2}function B(){var a=Ze?$d:Yd,b=bb(),c=yb();return c>1?a*b/(c-1):a}function C(){return We?jg?150:ae:0}function D(){return We?jg?be:40:0}function E(){var a,b;le=Ze?1:0,me=Ze?$d:Yd,ne=Ze?0:$d,oe=Ze?Yd:1,pe=le,qe=me,re=Ze?0:_d,se=Ze?Zd:1,te=G(le,me,te?te.domain():void 0,function(){return ze.tickOffset()}),ue=H(ne,oe,ue?ue.domain():void 0),ve=H(ne,oe,ve?ve.domain():void 0),we=G(le,me,yg,function(a){return a%1?0:Ce.tickOffset()}),xe=H(re,se),ye=H(re,se),a=N(),b=O(),ze=K(te,eg,a,b),Ce=K(we,hg,a,b),Ae=L(ue,fg,mf,of),Be=L(ve,gg,uf,wf),F()}function F(){he=S(),ie=T(),je=T(.98)}function G(a,b,c,f){var h=(Yf?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}),Zf){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 H(a,b){return g.scale.linear().range([a,b])}function I(a){return"y2"===M(a)?ve:ue}function J(a){return"y2"===M(a)?ye:xe}function K(a,c,d,e){var f=(Zf?b():g.svg.axis()).scale(a).orient(c);return f.tickFormat(d).ticks(e),Zf?f.tickCentered(af):f.tickOffset=function(){var a=Ze?$d:Yd;return a*bb()/yb()/2},Zf&&f.categories(_e),f}function L(a,b,c,d){return g.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function M(a){return a in Je?Je[a]:"y"}function N(){var a=Yf?dg:Zf?Hb:null;return bf&&("function"==typeof bf?a=bf:Yf&&(a=function(a){return g.time.format(bf)(a)})),a}function O(){var a=yb();return cf&&a>df?df:a}function P(){return"string"==typeof ff?ff:ff?ff.text:null}function Q(){return"string"==typeof kf?kf:kf?kf.text:null}function R(a){var b=!1;return ke(Fd.data.targets).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function S(){var a=g.svg.arc().outerRadius(ee).innerRadius(ge),b=function(b,c){var d;return c?a(b):(d=R(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function T(a){var b=g.svg.arc().outerRadius(fe*(a?a:1)).innerRadius(ge);return function(a){var c=R(a);return c?b(c):"M 0 0"}}function U(a,b){return Hc(a.data)?he(a,b):"M 0 0"}function V(a){var b,c,d,e,f=R(a),g="";return f&&(b=he.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*ee*.8+","+d/e*ee*.8+")"),g}function W(a){return(a.endAngle-a.startAngle)/(2*Math.PI)}function X(a){return Mf(a,W(a))}function Y(a,b){var c=rg.selectAll(".chart-arc"+Cd(a)),d=rg.selectAll(".-arc").filter(function(b){return b.data.id!==a});c.selectAll("path").transition().duration(50).attr("d",ie).transition().duration(100).attr("d",je).each(function(a){Gc(a.data)}),b||d.style("opacity",.3)}function Z(a){var b=rg.selectAll(".chart-arc"+Cd(a));b.selectAll("path").transition().duration(50).attr("d",he),rg.selectAll(".-arc").style("opacity",1)}function $(a){var b,c,d,e,f,h=Db(a);if(Ie.length>0)for(f=Fb(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 _(a){var b,c,d,e,f,h=Db(a);if(Ie.length>0)for(f=Gb(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 ab(a){var b=Cb(function(b){return M(b.id)===a}),d="y2"===a?rf:hf,e="y2"===a?qf:gf,f=d?d:$(b),g=e?e:_(b),h=.22*Math.abs(g-f),i=h,j=h,k="y2"===a?sf:jf;if(k){var l=Math.max(Math.abs(f),Math.abs(g));g=l-k,f=k-l}return"y"===a&&nf&&(i=c(nf.top)?nf.top:h,j=c(nf.bottom)?nf.bottom:h),"y2"===a&&vf&&(i=c(vf.top)?vf.top:h,j=c(vf.bottom)?vf.bottom:h),wc(b)&&!Fb(b)&&(j=f),[f-j,g+i]}function bb(a){return a?1:gb(yg)/gb(te.domain())}function cb(a){return g.min(a,function(a){return g.min(a.values,function(a){return a.x})})}function db(a){return g.max(a,function(a){return g.max(a.values,function(a){return a.x})})}function eb(a,b){var c,d=b[0],e=b[1],f=Math.abs(d-e);return c=Zf?0:wc(a)?f/(yb()-1)/2:.01*f}function fb(a){var b=[cb(a),db(a)],c=b[0],d=b[1],e=eb(a,b),f=Yf?new Date(c.getTime()-e):c-e,g=Yf?new Date(d.getTime()+e):d+e;return[f,g]}function gb(a){return a[1]-a[0]}function hb(a){for(var b=0;bd?0:d}function mb(a){return De&&a===De||Ee&&Qc(Ee,a)}function nb(a){return!mb(a)}function ob(a){return De?De:Ee?Ee[a]:null}function pb(a,b){return a in Fd.data.x&&Fd.data.x[a]&&Fd.data.x[a][b]?Fd.data.x[a][b]:b}function qb(a){Object.keys(a).forEach(function(b){Ee[b]=a[b]})}function rb(a){var b;return a&&(b=He[a.id],a.name=b?b:a.id),a}function sb(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?b.map(function(a){return a[c]}):Fd.data.x[Object.keys(Fd.data.x)[0]]}),c=d.map(function(a){var c=Ge(a);return{id:c,id_org:a,values:b.map(function(b,d){var e,f=ob(a);return e=Yf?Mc(b[f]):$f?b[f]?+b[f]:pb(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++})}),Ke&&uc(Ab(c).filter(function(a){return!(a in Le)}),Ke),c.forEach(function(a){ib(a.id_org,a)}),c)}function vb(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 wb(a){return a>0&&Fd.data.targets[0].values[a-1]?Fd.data.targets[0].values[a-1].x:void 0}function xb(a){return a1?Fd.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?Fd.data.targets[0]:null,a}function Ab(a){return a=d(a)?Fd.data.targets:a,a.map(function(a){return a.id})}function Bb(a){var b,c=Ab();for(b=0;ba})}function Gb(a){return Eb(a,function(a){return a>0})}function Hb(a){return a<_e.length?_e[a]:a}function Ib(a){return"-text -text-"+a.id}function Jb(a){return"-texts -texts-"+a.id}function Kb(a){return"-shapes -shapes-"+a.id}function Lb(a){return Kb(a)+" -line -line-"+a.id}function Mb(a){return Kb(a)+" -circles -circles-"+a.id}function Nb(a){return Kb(a)+" -bars -bars-"+a.id}function Ob(a){return Kb(a.data)+" -arc -arc-"+a.data.id}function Pb(a){return Kb(a)+" -area -area-"+a.id}function Qb(a,b){return"-shape -shape-"+b}function Rb(a,b){return Qb(a,b)+" -circle -circle-"+b}function Sb(a,b){return Qb(a,b)+" -bar -bar-"+b}function Tb(a,b){return"region region-"+b+" "+("classes"in a?[].concat(a.classes).join(" "):"")}function Ub(a,b){return"event-rect event-rect-"+b}function Vb(a){return Ag[a.id]?1:0}function Wb(a){var b=Yb(a);return Vb(a)*b}function Xb(a){return c(a.value)?Ec(a)?.5:1:0}function Yb(a){return"boolean"==typeof Me&&Me?1:"boolean"===Me[a.id]&&Me[a.id]?1:Me[a.id]&&Me[a.id].show?1:0}function Zb(a){return a?te(a.x):null}function $b(a){return te(Yf?Mc(a.value):a.value)}function _b(a){return ue(a.value)}function ac(a){return we(a.x)}function bc(a){var b=mf?mf:function(a){return+a};return b(a)}function cc(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;c0?g=h:f=h,g-f===1?(e=[],a[f].x&&(e=e.concat(cc(a,f))),a[g].x&&(e=e.concat(cc(a,g))),fc(e,b)):dc(a,b,f,g)}function ec(a,b){var c;return c=a.map(function(a){return dc(a.values,b)}),fc(c,b)}function fc(a,b){var c,d;return a.forEach(function(a){var e=Rc(a,b);(c>e||!c)&&(c=e,d=a)}),d}function gc(){return Ne&&"desc"===Ne.toLowerCase()}function hc(){return Ne&&"asc"===Ne.toLowerCase()}function ic(a){var b=hc(),c=gc();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 Ne&&a.sort(Ne),a}function jc(a,b){var d,e,f,g,h,i,j,k=a.filter(function(a){return a&&c(a.value)});Pf&&0!==k.length&&(wg.html(Sf(a,N(),bc,cg)).style("visibility","hidden").style("display","block"),d=wg.property("offsetWidth"),e=wg.property("offsetHeight"),Ze?(f=p(),g=f+b[0]+100,h=g+d,j=q()-t(),i=te(k[0].x)+20):(f=p(),g=f+s()+te(k[0].x)+20,h=g+d,j=f+q()-t(),i=b[1]+15),h>j&&(g-=d+60),i+e>r()&&(i-=e+30),wg.style("top",i+"px").style("left",g+"px").style("visibility","visible"))}function kc(){wg.style("display","none")}function lc(a){var b=a.filter(function(a){return a&&c(a.value)});Pf&&(xc(Fd.data.targets)||Ac(Fd.data.targets)||tg.selectAll("line.xgrid-focus").style("visibility","visible").data([b[0]]).attr(Ze?"y1":"x1",Zb).attr(Ze?"y2":"x2",Zb))}function mc(){tg.select("line.xgrid-focus").style("visibility","hidden")}function nc(a){return a.x||0===a.x?te(a.x):null}function oc(a){return I(a.id)(a.value)}function pc(){var a,b,c={},e=0;return Cb(Dc).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function tc(a,b){return b?2*a.tickOffset()*.6/b:0}function uc(a,b){var c=d(a)?Ab():a;"string"==typeof c&&(c=[c]);for(var e=0;e=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function jd(b){var c,d,e,f,h;if(xg=g.select(Kd),xg.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(xg.html(""),Fd.data.x={},Fd.data.targets=ub(b),n(),E(),te.domain(g.extent(fb(Fd.data.targets))),ue.domain(ab("y")),ve.domain(ab("y2")),we.domain(te.domain()),xe.domain(ue.domain()),ye.domain(ve.domain()),yg=te.domain(),mg.scale(we),Pd&&qg.scale(te),rg=g.select(Kd).append("svg").attr("width",Yd+Vd.left+Vd.right).attr("height",$d+Vd.top+Vd.bottom).on("mouseenter",Sd).on("mouseleave",Td),sg=rg.append("defs"),sg.append("clipPath").attr("id",Wf).append("rect").attr("width",Yd).attr("height",$d),sg.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-20).attr("width",x).attr("height",y),sg.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-Vd.left+1).attr("width",z).attr("height",A),tg=rg.append("g").attr("transform",ig.main),ug=Te?rg.append("g").attr("transform",ig.context):null,vg=We?rg.append("g").attr("transform",ig.legend):null,wg=g.select(Kd).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none"),tg.append("g").attr("class","x axis").attr("clip-path",Ze?"":"url("+document.URL+"#xaxis-clip)").attr("transform",ig.x).append("text").attr("class","-axis-x-label").attr("x",Yd).attr("dy","-.5em").style("text-anchor","end").text(P),tg.append("g").attr("class","y axis").attr("clip-path",Ze?"url("+document.URL+"#yaxis-clip)":"").append("text").attr("transform","rotate(-90)").attr("dy","1.2em").attr("dx","-.5em").style("text-anchor","end").text(Q),pf&&tg.append("g").attr("class","y2 axis").attr("transform",ig.y2),d=tg.append("g").attr("clip-path",Xf).attr("class","grid"),xf&&d.append("g").attr("class","xgrids"),zf&&(e=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(zf).enter().append("g").attr("class","xgrid-line"),e.append("line").attr("class",function(a){return""+a["class"]}),e.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",Ze?"":"rotate(-90)").attr("dx",Ze?0:-Vd.top).attr("dy",-5).text(function(a){return a.text})),Ff&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",Ze?0:-10).attr("x2",Ze?Yd:-10).attr("y1",Ze?-10:Vd.top).attr("y2",Ze?-10:$d),Af&&d.append("g").attr("class","ygrids"),Bf&&(f=d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(Bf).enter().append("g").attr("class","ygrid-line"),f.append("line").attr("class",function(a){return""+a["class"]}),f.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",Ze?"rotate(-90)":"").attr("dx",Ze?0:-Vd.top).attr("dy",-5).text(function(a){return a.text})),tg.append("g").attr("clip-path",Xf).attr("class","regions"),tg.append("g").attr("clip-path",Xf).attr("class","chart"),c=tg.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",Pd?Ze?"ns-resize":"ew-resize":null),tg.select(".chart").append("g").attr("class","chart-bars"),tg.select(".chart").append("g").attr("class","chart-lines"),tg.select(".chart").append("g").attr("class","chart-arcs").attr("transform",ig.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(Nf),tg.select(".chart").append("g").attr("class","chart-texts"),Pd&&tg.insert("rect",Rd?null:"g.grid").attr("class","zoom-rect").attr("width",Yd).attr("height",$d).style("opacity",0).style("cursor",Ze?"ns-resize":"ew-resize").call(qg).on("dblclick.zoom",null),null!==ef&&mg.extent("function"!=typeof ef?ef:ef(fb())),Te&&(ug.append("g").attr("clip-path",Xf).attr("class","chart"),ug.select(".chart").append("g").attr("class","chart-bars"),ug.select(".chart").append("g").attr("class","chart-lines"),ug.append("g").attr("clip-path",Xf).attr("class","x brush").call(mg).selectAll("rect").attr(Ze?"width":"height",Ze?Zd:_d),ug.append("g").attr("class","x axis").attr("transform",ig.subx).attr("clip-path",Ze?"url("+document.URL+"#yaxis-clip)":"")),We&&Ad(Fd.data.targets),vd(Fd.data.targets),qd({withTransform:!0,withUpdateXDomain:!0}),Tf){if(Yf&&"string"==typeof Uf){for(Uf=Mc(Uf),h=0;h0){d=[];for(var f in He)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=Xc,o=c+e>f&&h>c&&j>d),o^n&&(l.classed(Jd,!n),l.classed(Id,!m),k(!m,l,a,b))}))}function od(a){Ac(Fd.data.targets)||Qe&&(_f=a,tg.select(".chart").append("rect").attr("class","dragarea").style("opacity",.1),ag=!0)}function pd(){Ac(Fd.data.targets)||Qe&&(tg.select(".dragarea").transition().duration(100).style("opacity",0).remove(),tg.selectAll(".-shape").classed(Jd,!1),ag=!1)}function qd(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,C,D,E,F=pc(),G=Ac(Fd.data.targets);if(a=e(a)?a:{},s=e(a.withY)?a.withY:!0,t=e(a.withSubchart)?a.withSubchart:!0,u=e(a.withTransition)?a.withTransition:!0,v=e(a.withTransform)?a.withTransform:!1,w=e(a.withUpdateXDomain)?a.withUpdateXDomain:!1,x=e(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,D=u?Ud:0,E=e(a.durationForExit)?a.durationForExit:D,x&&(te.domain(g.extent(fb(Fd.data.targets))),yg=te.domain(),Pd&&qg.scale(te).updateScaleExtent(),we.domain(te.domain()),mg.scale(we)),w&&(te.domain(mg.empty()?yg:mg.extent()),Pd&&qg.scale(te).updateScaleExtent()),ue.domain(ab("y")),ve.domain(ab("y2")),tg.select(".x.axis").style("opacity",G?0:1).transition().duration(D).call(Ze?Ae:ze),tg.select(".y.axis").style("opacity",G?0:1).transition().duration(D).call(Ze?ze:Ae),tg.select(".y2.axis").style("opacity",G?0:1).transition().call(Be),y=dd(F),A=ed(F,!0),C=ed(F,!1),tg.select(".x.axis .-axis-x-label").attr("x",Yd),xe.domain(ue.domain()),ye.domain(ve.domain()),wg.style("display","none"),tg.select("line.xgrid-focus").style("visibility","hidden").attr("y2",$d),xf){if("year"===yf){d=[];for(var H=fb(),I=H[0].getFullYear(),J=H[1].getFullYear(),K=I;J>=K;K++)d.push(new Date(K+"-01-01 00:00:00"))}else d=te.ticks(10);b=tg.select(".xgrids").selectAll(".xgrid").data(d),b.enter().append("line").attr("class","xgrid"),b.attr("x1",Ze?0:function(a){return te(a)-ze.tickOffset()}).attr("x2",Ze?Yd:function(a){return te(a)-ze.tickOffset()}).attr("y1",Ze?function(a){return te(a)-ze.tickOffset()}:Vd.top).attr("y2",Ze?function(a){return te(a)-ze.tickOffset()}:$d).style("opacity",function(){return+g.select(this).attr(Ze?"y1":"x1")===(Ze?$d:0)?0:1}),b.exit().remove()}zf&&(f=tg.selectAll(".xgrid-lines"),f.selectAll("line").transition().duration(D).attr("x1",Ze?0:$b).attr("x2",Ze?Yd:$b).attr("y1",Ze?$b:Vd.top).attr("y2",Ze?$b:$d),f.selectAll("text").attr("x",Ze?Yd:0).attr("y",$b)),s&&Af&&(h=tg.select(".ygrids").selectAll(".ygrid").data(ue.ticks(Cf)),h.enter().append("line").attr("class","ygrid"),h.attr("x1",Ze?ue:0).attr("x2",Ze?ue:Yd).attr("y1",Ze?0:ue).attr("y2",Ze?$d:ue),h.exit().remove()),s&&Bf&&(i=tg.select(".ygrid-lines"),i.selectAll("line").transition().duration(D).attr("x1",Ze?_b:0).attr("x2",Ze?_b:Yd).attr("y1",Ze?0:_b).attr("y2",Ze?$d:_b),i.selectAll("text").attr("x",Ze?0:Yd).attr("y",_b)),k=tg.selectAll(".-bars").selectAll(".-bar").data(Ic),k.enter().append("path").attr("d",y).style("stroke","none").style("opacity",0).style("fill",function(a){return cg(a.id)}).attr("class",Sb),k.style("opacity",Vb).transition().duration(D).attr("d",y).style("opacity",1),k.exit().transition().duration(E).style("opacity",0).remove(),m=tg.selectAll(".-texts").selectAll(".-text").data(Kc),m.enter().append("text").attr("class",Ib).attr("text-anchor",function(a){return Ze?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return bc(a.value)}),m.style("fill-opacity",Wb).transition().duration(D).attr("x",A).attr("y",C).style("fill-opacity",Yb),m.exit().transition().duration(E).style("fill-opacity",0).remove(),tg.selectAll(".-line").style("opacity",Vb).transition().duration(D).attr("d",ng).style("opacity",1),tg.selectAll(".-area").style("opacity",0).transition().duration(D).attr("d",og).style("opacity",zg),j=tg.selectAll(".-circles").selectAll(".-circle").data(Jc),j.enter().append("circle").attr("class",Rb).style("opacity",0).attr("r",Ef),j.style("opacity",Vb).transition().duration(D).style("opacity",Xb).attr("cx",Ze?oc:nc).attr("cy",Ze?nc:oc),j.exit().remove(),tg.selectAll(".chart-arc").select(".-arc").attr("transform",v?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(D).attrTween("d",function(a){var b=R(a);if(!b)return function(){return"M 0 0"};var c=g.interpolate(this._current,b);return this._current=c(0),function(a){return U(c(a),!0)}}).attr("transform",v?"scale(1)":"").style("opacity",1),tg.selectAll(".chart-arc").select("text").attr("transform",V).style("opacity",0).transition().duration(D).text(X).style("opacity",function(a){return Hc(a.data)?1:0 +}),tg.select(".chart-arcs-title").style("opacity",zc(Fd.data.targets)?1:0),Te&&(null!==g.event&&"zoom"===g.event.type&&mg.extent(te.orgDomain()).update(),t&&(ug.select(".x.axis").style("opacity",G?0:1).transition().duration(D).call(Ce),mg.empty()||mg.extent(te.orgDomain()).update(),z=dd(F,!0),n=ug.selectAll(".-bars").selectAll(".-bar").data(Ic),n.enter().append("path").attr("d",z).style("stroke","none").style("fill",function(a){return cg(a.id)}).attr("class",Sb),n.style("opacity",Vb).transition().duration(D).attr("d",z).style("opacity",1),n.exit().transition().duration(D).style("opacity",0).remove(),ug.selectAll(".-line").style("opacity",Vb).transition().duration(D).attr("d",pg).style("opacity",1))),tg.selectAll(".selected-circles").filter(function(a){return Dc(a)}).selectAll("circle").remove(),tg.selectAll(".selected-circle").transition().duration(D).attr("cx",Ze?oc:nc).attr("cy",Ze?nc:oc),Ee?(o=tg.select(".event-rects").selectAll(".event-rect").data([0]),ld(o.enter()),o.attr("x",0).attr("y",0).attr("width",Yd).attr("height",$d)):($f?(r=function(a,b){var c=wb(b),d=xb(b);return(te(d?d:a.x+50)-te(c?c:a.x-50))/2},q=function(a,b){var c=wb(b);return(te(a.x)+te(c?c:a.x-50))/2}):(r=B(),q=function(a){return te(a.x)-r/2}),p=zb(),tg.select(".event-rects").datum(p?p.values:[]),o=tg.select(".event-rects").selectAll(".event-rect").data(function(a){return a}),kd(o.enter()),o.attr("class",Ub).attr("x",Ze?0:q).attr("y",Ze?q:0).attr("width",Ze?Yd:r).attr("height",Ze?r:$d),o.exit().remove()),l=tg.select(".regions").selectAll("rect.region").data(Of),l.enter().append("rect").style("fill-opacity",0),l.attr("class",Tb).attr("x",Ze?0:kb).attr("y",Ze?kb:Vd.top).attr("width",Ze?Yd:lb).attr("height",Ze?lb:$d).transition().duration(D).style("fill-opacity",function(a){return c(a.opacity)?a.opacity:.1}),l.exit().transition().duration(D).style("fill-opacity",0).remove(),We&&Ad(Fd.data.targets,{withTransition:u}),Ab().forEach(function(a){Ag[a]=!0})}function rd(){qd({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function sd(){return"mousemove"===g.event.sourceEvent.type&&qg.altDomain?(te.domain(qg.altDomain),void qg.scale(te).updateScaleExtent()):(Zf&&te.orgDomain()[0]===yg[0]&&te.domain([yg[0]-1e-10,te.orgDomain()[1]]),qd({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===g.event.sourceEvent.type&&(bg=!0)))}function td(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function ud(a){var b,c;a=e(a)?a:{},b=e(a.withTransition)?a.withTransition:!1,c=e(a.withTransform)?a.withTransform:!1,n(),E(),mg.scale(we),Pd&&qg.scale(te),rg.attr("width",ae).attr("height",be),rg.select("#"+Wf).select("rect").attr("width",Yd).attr("height",$d),rg.select("#xaxis-clip").select("rect").attr("width",x),rg.select(".zoom-rect").attr("width",Yd).attr("height",$d),m(b),qd({withTransition:b,withUpdateXDomain:!0,withTransform:c,durationForExit:0})}function vd(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=tg.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",Jb).style("fill",function(a){return cg(a.id)}),e=tg.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",Nb).style("fill",function(a){return cg(a.id)}).style("stroke","none").style("cursor",function(a){return Se(a)?"pointer":null}),c=tg.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",Lb).style("opacity",0).style("stroke",function(a){return cg(a.id)}),b.append("path").attr("class",Pb).style("opacity",function(){return zg=+g.select(this).style("opacity"),0}).style("fill",function(a){return cg(a.id)}),b.append("g").attr("class",function(a){return"selected-circles selected-circles-"+a.id}),b.append("g").attr("class",Mb).style("fill",function(a){return cg(a.id)}).style("cursor",function(a){return Se(a)?"pointer":null}),a.forEach(function(a){var b=Bd(a.id);tg.selectAll(".selected-circles"+b).selectAll(".selected-circle").each(function(b){b.value=a.values[b.x].value})}),h=tg.select(".chart-arcs").selectAll(".chart-arc").data(ke(a)),f=h.enter().append("g").attr("class",function(a){return"chart-arc target target-"+a.data.id}),f.append("path").attr("class",Ob).style("opacity",0).style("fill",function(a){return cg(a.data.id)}).style("cursor",function(a){return Se(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a){Y(a.data.id),xd(a.data.id)}).on("mouseout",function(a){Z(a.data.id),zd()}),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Te&&(n=ug.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",Nb).style("fill",function(a){return cg(a.id)}),l=ug.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",Lb).style("opacity",0).style("stroke",function(a){return cg(a.id)})),We&&Ad(a),rg.selectAll(".target").transition().style("opacity",1)}function wd(a,b){Fd.data.targets.forEach(function(b){for(var c=0;cq&&(q=d,jg||(l=(de-q*Object.keys(a).length)/2)),e>p&&(p=e,jg&&(l=(ce-p*Object.keys(a).length)/2))},c=vg.selectAll(".legend-item").data(o).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){Ye(a)}).on("mouseover",function(a){xd(a),Fd.focus(a)}).on("mouseout",function(){zd(),Fd.revert()}),c.append("text").text(function(a){return e(He[a])?He[a]:a}).each(function(){m(this)}).style("pointer-events","none").attr("x",jg?g:-200).attr("y",jg?-200:i),c.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",jg?h:-200).attr("y",jg?-200:k).attr("width",q+14).attr("height",24),c.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return cg(a)}).attr("x",jg?g:-200).attr("y",jg?-200:j).attr("width",10).attr("height",10),vg.selectAll("text").data(o).each(function(){m(this)}).transition().duration(n?250:0).attr("x",g).attr("y",j),vg.selectAll("rect.legend-item-event").data(o).transition().duration(n?250:0).attr("x",h).attr("y",k),vg.selectAll("rect.legend-item-tile").data(o).transition().duration(n?250:0).attr("x",f).attr("y",i)}function Bd(a){return a?"-"+a.replace(/\./g,"\\."):""}function Cd(a){return".target"+Bd(a)}function Dd(a){return Bb(a.id)}function Ed(a){return"data"in a&&Bb(a.data.id)}var Fd={data:{}},Gd={},Hd="_expanded_",Id="_selected_",Jd="_included_",Kd=i(["bindto"],"#chart"),Ld=i(["size","width"],null),Md=i(["size","height"],null),Nd=i(["padding","left"],null),Od=i(["padding","right"],null),Pd=i(["zoom","enabled"],!1),Qd=i(["zoom","extent"],null),Rd=i(["zoom","privileged"],!1),Sd=i(["onenter"],function(){}),Td=i(["onleave"],function(){}),Ud=i(["transition","duration"],350);h("data","data is required in config");var Vd,Wd,Xd,Yd,Zd,$d,_d,ae,be,ce,de,ee,fe,ge,he,ie,je,ke,le,me,ne,oe,pe,qe,re,se,te,ue,ve,we,xe,ye,ze,Ae,Be,Ce,De=i(["data","x"],null),Ee=i(["data","xs"],null),Fe=i(["data","x_format"],"%Y-%m-%d"),Ge=i(["data","id_converter"],function(a){return a}),He=i(["data","names"],{}),Ie=i(["data","groups"],[]),Je=i(["data","axes"],{}),Ke=i(["data","type"],null),Le=i(["data","types"],{}),Me=i(["data","labels"],{}),Ne=i(["data","order"],null),Oe=i(["data","regions"],{}),Pe=i(["data","colors"],{}),Qe=i(["data","selection","enabled"],!1),Re=i(["data","selection","grouped"],!1),Se=i(["data","selection","isselectable"],function(){return!0}),Te=i(["subchart","show"],!1),Ue=Te?i(["subchart","size","height"],60):0,Ve=i(["color","pattern"],null),We=i(["legend","show"],!0),Xe=i(["legend","position"],"bottom"),Ye=i(["legend","item","onclick"],function(){}),Ze=i(["axis","rotated"],!1),$e=i(["axis","x","type"],"indexed"),_e=i(["axis","x","categories"],[]),af=i(["axis","x","tick","centered"],!1),bf=i(["axis","x","tick","format"],null),cf=i(["axis","x","tick","culling"],Ze||"categorized"===$e?!1:!0),df=i(["axis","x","tick","count"],10),ef=i(["axis","x","default"],null),ff=i(["axis","x","label"],null),gf=i(["axis","y","max"],null),hf=i(["axis","y","min"],null),jf=i(["axis","y","center"],null),kf=i(["axis","y","label"],null),lf=i(["axis","y","inner"],!1),mf=i(["axis","y","tick","format"],null),nf=i(["axis","y","padding"],null),of=i(["axis","y","ticks"],10),pf=i(["axis","y2","show"],!1),qf=i(["axis","y2","max"],null),rf=i(["axis","y2","min"],null),sf=i(["axis","y2","center"],null),tf=i(["axis","y2","inner"],!1),uf=i(["axis","y2","tick","format"],null),vf=i(["axis","y2","padding"],null),wf=i(["axis","y2","ticks"],10),xf=i(["grid","x","show"],!1),yf=i(["grid","x","type"],"tick"),zf=i(["grid","x","lines"],null),Af=i(["grid","y","show"],!1),Bf=i(["grid","y","lines"],null),Cf=i(["grid","y","ticks"],10),Df=i(["point","show"],!0),Ef=Df?i(["point","r"],2.5):0,Ff=i(["point","focus","line","enabled"],!0),Gf=i(["point","focus","expand","enabled"],!0),Hf=i(["point","focus","expand","r"],Gf?4:Ef),If=i(["point","focus","select","r"],8),Jf=i(["point","onclick"],function(){}),Kf=i(["point","onselected"],function(){}),Lf=i(["point","onunselected"],function(){}),Mf=i(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),Nf=i(["arc","title"],""),Of=i(["regions"],[]),Pf=i(["tooltip","enabled"],!0),Qf=i(["tooltip","format","title"],null),Rf=i(["tooltip","format","value"],null),Sf=i(["tooltip","contents"],function(a,b,c,d){var e,f,g,h,i,j=Qf?Qf:b,k=Rf?Rf:c;for(f=0;f"+g+""),i=a[f].name,h=k(a[f].value),e+=""+i+""+h+"");return e+""}),Tf=i(["tooltip","init","show"],!1),Uf=i(["tooltip","init","x"],0),Vf=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Wf=Kd.replace("#","")+"-clip",Xf="url("+document.URL+"#"+Wf+")",Yf="timeseries"===$e,Zf="categorized"===$e,$f=!Yf&&(De||Ee),_f=null,ag=!1,bg=!1,cg=Lc(Pe,Ve),dg=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)}}(),eg=Ze?"left":"bottom",fg=Ze?lf?"top":"bottom":lf?"right":"left",gg=Ze?tf?"bottom":"top":tf?"left":"right",hg=Ze?"left":"bottom",ig={main:function(){return"translate("+Vd.left+","+Vd.top+")"},context:function(){return"translate("+Wd.left+","+Wd.top+")"},legend:function(){return"translate("+Xd.left+","+Xd.top+")"},y2:function(){return"translate("+(Ze?0:Yd)+","+(Ze?1:0)+")"},x:function(){return"translate(0,"+$d+")"},subx:function(){return"translate(0,"+(Ze?0:_d)+")"},arc:function(){return"translate("+Yd/2+","+$d/2+")"}},jg="right"===Xe,kg=40,lg=20;ke=g.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var mg,ng=function(){var a=g.svg.line().x(Ze?function(a){return I(a.id)(a.value)}:Zb).y(Ze?Zb:function(a){return I(a.id)(a.value)});return function(b){var c,d,e=Yc(b.values);return Bc(b)?(a.interpolate(Cc(b)?"cardinal":"linear"),Oe[b.id]?id(e,te,I(b.id),Oe[b.id]):a(e)):(c=te(e[0].x),d=I(b.id)(e[0].value),Ze?"M "+d+" "+c:"M "+c+" "+d)}}(),og=function(){var a;return a=Ze?g.svg.area().x0(function(a){return I(a.id)(0)}).x1(function(a){return I(a.id)(a.value)}).y(Zb):g.svg.area().x(Zb).y0(function(a){return I(a.id)(0)}).y1(function(a){return I(a.id)(a.value)}),function(b){var c,d,e=Yc(b.values);return vc([b],"area")||vc([b],"area-spline")?(a.interpolate(Cc(b)?"cardinal":"linear"),a(e)):(c=te(e[0].x),d=I(b.id)(e[0].value),Ze?"M "+d+" "+c:"M "+c+" "+d)}}(),pg=function(){var a=g.svg.line().x(Ze?function(a){return J(a.id)(a.value)}:ac).y(Ze?ac:function(a){return J(a.id)(a.value)});return function(b){var c=Yc(b.values);return Bc(b)?a(c):"M "+we(c[0].x)+" "+J(b.id)(c[0].value)}}(),qg=function(){};mg=g.svg.brush().on("brush",rd),mg.update=function(){return ug&&ug.select(".x.brush").call(this),this},mg.scale=function(a){return Ze?this.y(a):this.x(a)},Pd&&(qg=g.behavior.zoom().on("zoomstart",function(){qg.altDomain=g.event.sourceEvent.altKey?te.orgDomain():null}).on("zoom",Pd?sd:null),qg.scale=function(a){return Ze?this.y(a):this.x(a)},qg.orgScaleExtent=function(){var a=Qd?Qd:[1,10];return[a[0],Math.max(yb()/a[1],a[1])]},qg.updateScaleExtent=function(){var a=gb(te.orgDomain())/gb(yg),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag={};if(Fd.focus=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=rg.selectAll(Cd(a)),d=c.filter(Dd),e=c.filter(Ed);Fd.revert(),Fd.defocus(),b(d.classed("focused",!0)),b(e),Ac(Fd.data.targets)&&Y(a,!0),xd(a)},Fd.defocus=function(a){function b(a){a.transition().duration(100).style("opacity",.3)}var c=rg.selectAll(Cd(a)),d=c.filter(Dd),e=c.filter(Ed);Fd.revert(),b(d.classed("focused",!1)),b(e),Ac(Fd.data.targets)&&Z(a),yd(a)},Fd.revert=function(a){function b(a){a.transition().duration(100).style("opacity",1)}var c=rg.selectAll(Cd(a)),d=c.filter(Dd),e=c.filter(Ed);b(d.classed("focused",!1)),b(e),Ac(Fd.data.targets)&&Z(a),zd()},Fd.show=function(a){rg.selectAll(Cd(a)).transition().style("opacity",1)},Fd.hide=function(a){rg.selectAll(Cd(a)).transition().style("opacity",0)},Fd.unzoom=function(){mg.clear().update(),qd({withUpdateXDomain:!0})},Fd.load=function(a){if("function"!=typeof a.done&&(a.done=function(){}),a.xs&&qb(a.xs),"categories"in a&&Zf&&(_e=a.categories,ze.categories(_e)),"cacheIds"in a&&hb(a.cacheIds))return void wd(jb(a.cacheIds),a.done);if("data"in a)wd(ub(a.data),a.done);else if("url"in a)g.csv(a.url,function(b,c){wd(ub(c),a.done)});else if("rows"in a)wd(ub(sb(a.rows)),a.done);else{if(!("columns"in a))throw Error("url or rows or columns is required.");wd(ub(tb(a.columns)),a.done)}},Fd.unload=function(a){Fd.data.targets=Fd.data.targets.filter(function(b){return b.id!==a}),rg.selectAll(Cd(a)).transition().style("opacity",0).remove(),We&&(rg.selectAll(".legend-item"+Bd(a)).remove(),Ad(Fd.data.targets)),Fd.data.targets.length>0&&qd({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})},Fd.selected=function(a){var b=Bd(a);return g.merge(tg.selectAll(".-shapes"+b).selectAll(".-shape").filter(function(){return g.select(this).classed(Id)}).map(function(a){return a.map(function(a){return a.__data__})}))},Fd.select=function(a,b,c){Qe&&tg.selectAll(".-shapes").selectAll(".-shape").each(function(f,h){var i="circle"===this.nodeName?Sc:Vc,j="circle"===this.nodeName?Tc:Wc;b.indexOf(h)>=0?Se(f)&&(Re||d(a)||a.indexOf(f.id)>=0)&&i(g.select(this).classed(Id,!0),f,h):e(c)&&c&&j(g.select(this).classed(Id,!1),f,h)})},Fd.unselect=function(a,b){Qe&&tg.selectAll(".-shapes").selectAll(".-shape").each(function(c,e){var f="circle"===this.nodeName?Tc:Wc;(d(b)||b.indexOf(e)>=0)&&Se(c)&&(Re||d(a)||a.indexOf(c.id)>=0)&&f(g.select(this).classed(Id,!1),c,e)})},Fd.toLine=function(a){uc(a,"line"),ud({withTransition:!0})},Fd.toSpline=function(a){uc(a,"spline"),ud({withTransition:!0})},Fd.toBar=function(a){uc(a,"bar"),ud({withTransition:!0})},Fd.toScatter=function(a){uc(a,"scatter"),ud({withTransition:!0})},Fd.toArea=function(a){uc(a,"area"),ud({withTransition:!0})},Fd.toAreaSpline=function(a){uc(a,"area-spline"),ud({withTransition:!0})},Fd.toPie=function(a){uc(a,"pie"),ud({withTransition:!0,withTransform:!0})},Fd.toDonut=function(a){uc(a,"donut"),ud({withTransition:!0,withTransform:!0})},Fd.groups=function(a){return d(a)?Ie:(Ie=a,qd(),Ie)},Fd.regions=function(a){return d(a)?Of:(Of=a,qd(),Of)},Fd.regions.add=function(a){return d(a)?Of:(Of=Of.concat(a),qd(),Of)},Fd.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;rg.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Of=Of.filter(function(b){return b.classes.indexOf(a)<0})}),Of},Fd.data.get=function(a){var b=Fd.data.getAsTarget(a);return e(b)?b.values.map(function(a){return a.value}):void 0},Fd.data.getAsTarget=function(a){var b=Cb(function(b){return b.id===a});return b.length>0?b[0]:void 0},Fd.resize=function(a){Ld=a?a.width:null,Md=a?a.height:null,ud()},Fd.destroy=function(){Fd.data.targets=void 0,Fd.data.x={},xg.html(""),a.onresize=null},"url"in f.data)g.csv(f.data.url,function(a,b){jd(b)});else if("rows"in f.data)jd(sb(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");jd(tb(f.data.columns))}return Fd}}(window); \ No newline at end of file