diff --git a/c3.js b/c3.js index 93e316d..d08186b 100644 --- a/c3.js +++ b/c3.js @@ -1063,17 +1063,23 @@ tHeight = tooltip.property('offsetHeight'); // Determin tooltip position if (__axis_rotated) { - tooltipLeft = mouse[0]; + tooltipLeft = mouse[0] + 100; + tooltipRight = tooltipLeft + tWidth; + chartRight = getCurrentWidth() - getCurrentPaddingRight(); + tooltipTop = x(dataToShow[0].x) + 20; } else { svgLeft = getSvgLeft(); tooltipLeft = svgLeft + getCurrentPaddingLeft() + x(dataToShow[0].x) + 20; tooltipRight = tooltipLeft + tWidth; chartRight = svgLeft + getCurrentWidth() - getCurrentPaddingRight(); - if (tooltipRight > chartRight) { - tooltipLeft -= tWidth + 30; - } + tooltipTop = mouse[1] + 15; + } + if (tooltipRight > chartRight) { + tooltipLeft -= tWidth + 60; + } + if (tooltipTop + tHeight > getCurrentHeight()) { + tooltipTop -= tHeight + 30; } - tooltipTop = mouse[1] + 15 + tHeight < getCurrentHeight() ? mouse[1] + 15 : mouse[1] - tHeight; // Set tooltip // todo get rid of magic numbers tooltip diff --git a/c3.min.js b/c3.min.js index 31a1743..88d27de 100644 --- a/c3.min.js +++ b/c3.min.js @@ -1,95 +1,96 @@ -(function(N){function Fd(){function y(d,e){d.attr("transform",function(d){return"translate("+(e(d)+ga)+", 0)"})}function w(d,e){d.attr("transform",function(d){return"translate(0,"+e(d)+")"})}function F(d){var e=d[0];d=d[d.length-1];return eEc?Ec:a}function oa(a){var b=!1;Sb(f.data.targets).forEach(function(c){b|| -c.data.id!==a.data.id||(b=!0,a=c)});return b?a:null}function xa(){var a=e.svg.arc().outerRadius(Ra).innerRadius(Gb),b=function(b,g){var k;return g?a(b):(k=oa(b))?a(k):"M 0 0"};b.centroid=a.centroid;return b}function vc(a){var b=e.svg.arc().outerRadius(jb*(a?a:1)).innerRadius(Gb);return function(a){return(a=oa(a))?b(a):"M 0 0"}}function eb(a){a=oa(a);var b,c;b="";a&&(b=mb.centroid(a),a=b[0],b=b[1],c=Math.sqrt(a*a+b*b),b="translate("+0.8*(a/c)*Ra+","+0.8*(b/c)*Ra+")");return b}function Cb(a){return Td(a, +(function(N){function Fd(){function y(d,e){d.attr("transform",function(d){return"translate("+(e(d)+X)+", 0)"})}function w(d,e){d.attr("transform",function(d){return"translate(0,"+e(d)+")"})}function F(d){var e=d[0];d=d[d.length-1];return eEc?Ec:a}function oa(a){var b=!1;Sb(f.data.targets).forEach(function(c){b|| +c.data.id!==a.data.id||(b=!0,a=c)});return b?a:null}function ya(){var a=e.svg.arc().outerRadius(Ra).innerRadius(Gb),b=function(b,g){var k;return g?a(b):(k=oa(b))?a(k):"M 0 0"};b.centroid=a.centroid;return b}function vc(a){var b=e.svg.arc().outerRadius(jb*(a?a:1)).innerRadius(Gb);return function(a){return(a=oa(a))?b(a):"M 0 0"}}function eb(a){a=oa(a);var b,c;b="";a&&(b=mb.centroid(a),a=b[0],b=b[1],c=Math.sqrt(a*a+b*b),b="translate("+0.8*(a/c)*Ra+","+0.8*(b/c)*Ra+")");return b}function Cb(a){return Td(a, (a.endAngle-a.startAngle)/(2*Math.PI))}function wc(a,b){var c=p.selectAll(".chart-arc"+ka(a)),g=p.selectAll(".-arc").filter(function(b){return b.data.id!==a});c.selectAll("path").transition().duration(50).attr("d",Bc).transition().duration(100).attr("d",Cc).each(function(a){Tb(a.data)});b||g.style("opacity",0.3)}function Ub(a){p.selectAll(".chart-arc"+ka(a)).selectAll("path").transition().duration(50).attr("d",mb);p.selectAll(".-arc").style("opacity",1)}function Ud(a){var b=Fc(a),c,g,k,d;if(0a?a:0}),c=1;c+a||(b[g][c]+=+a)});return e.max(Object.keys(b).map(function(a){return e.max(b[a])}))}function ob(a){var b=pb(function(b){return A(b.id)===a}),c="y2"===a?Xd:Yd,g="y2"===a?Zd:$d,c=c?c:Ud(b),g=g?g:Vd(b),k=0.22*Math.abs(g-c),d=k,e=k,f="y2"===a?ae:be;f&&(c=Math.max(Math.abs(c),Math.abs(g)),g=c-f,c=f-c);"y"===a&&Ta&&(d=F(Ta.top)?Ta.top:k,e=F(Ta.bottom)?Ta.bottom:k);"y2"===a&&Ua&&(d=F(Ua.top)?Ua.top:k,e=F(Ua.bottom)?Ua.bottom:k);Z(b,"bar")&&!Gc(b)&&(e=c);return[c-e,g+d]}function ce(a){return e.min(a, -function(a){return e.min(a.values,function(a){return a.x})})}function de(a){return e.max(a,function(a){return e.max(a.values,function(a){return a.x})})}function qb(a){var b=[ce(a),de(a)],c=b[0],g=b[1],b=Math.abs(b[0]-b[1]);a=ja?0:Z(a,"bar")?b/(Aa()-1)/2:0.01*b;c=C?new Date(c.getTime()-a):c-a;g=C?new Date(g.getTime()+a):g+a;return[c,g]}function za(a){return a[1]-a[0]}function ee(a){for(var b=0;ba?0:a}function Jc(a){return ua&&a===ua||ba&&ge(ba,a)}function he(a){return!Jc(a)}function ie(a){Object.keys(a).forEach(function(b){ba[b]=a[b]})}function sb(a){var b;a&&(b=Va[a.id],a.name=b?b:a.id);return a}function Kc(a){var b=a[0],c={},g=[],k,d;for(k=1;kb&&(c=a,b=a.values.length)}):c=a?f.data.targets[0]:null;return c}function Xa(a){a=w(a)?f.data.targets: +d&&0>+a||(b[g][c]+=+a)});return e.max(Object.keys(b).map(function(a){return e.max(b[a])}))}function ob(a){var b=pb(function(b){return A(b.id)===a}),c="y2"===a?Xd:Yd,g="y2"===a?Zd:$d,c=c?c:Ud(b),g=g?g:Vd(b),k=0.22*Math.abs(g-c),d=k,e=k,f="y2"===a?ae:be;f&&(c=Math.max(Math.abs(c),Math.abs(g)),g=c-f,c=f-c);"y"===a&&Ta&&(d=F(Ta.top)?Ta.top:k,e=F(Ta.bottom)?Ta.bottom:k);"y2"===a&&Ua&&(d=F(Ua.top)?Ua.top:k,e=F(Ua.bottom)?Ua.bottom:k);$(b,"bar")&&!Gc(b)&&(e=c);return[c-e,g+d]}function ce(a){return e.min(a, +function(a){return e.min(a.values,function(a){return a.x})})}function de(a){return e.max(a,function(a){return e.max(a.values,function(a){return a.x})})}function qb(a){var b=[ce(a),de(a)],c=b[0],g=b[1],b=Math.abs(b[0]-b[1]);a=ja?0:$(a,"bar")?b/(Ba()-1)/2:0.01*b;c=C?new Date(c.getTime()-a):c-a;g=C?new Date(g.getTime()+a):g+a;return[c,g]}function Aa(a){return a[1]-a[0]}function ee(a){for(var b=0;ba?0:a}function Jc(a){return va&&a===va||ca&&ge(ca,a)}function he(a){return!Jc(a)}function ie(a){Object.keys(a).forEach(function(b){ca[b]=a[b]})}function sb(a){var b;a&&(b=Va[a.id],a.name=b?b:a.id);return a}function Kc(a){var b=a[0],c={},g=[],k,d;for(k=1;kb&&(c=a,b=a.values.length)}):c=a?f.data.targets[0]:null;return c}function Xa(a){a=w(a)?f.data.targets: a;return a.map(function(a){return a.id})}function Oc(a){var b=Xa(),c;for(c=0;ca})} function Wd(a){return Pc(a,function(a){return 0k&&(d-=c+30)),c=b[1]+15+gu[c].indexOf(k.id)))for(g=0;gb.value?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ge(a,b,c){c=c.getBBox();return h?(a[0][0]+a[2][0]+0.6*c.height)/2:a[2][1]+(0>b.value?c.height:va(b)?-3:-6)}function pd(a,b){var c=a.__max__+1,g=c?1.2*S.tickOffset()/c:0,d=we(g,c,a,!!b),e=xe(!!b),f=ye(a,!!b),h=b?H:t;return function(a,b){var c=h(a.id)(0), -l=f(a,b)||c;return[[d(a),l],[d(a),e(a)-(c-l)],[d(a)+g,e(a)-(c-l)],[d(a)+g,l]]}}function He(a,b,c,g){var d,e,f="M",l,n,m,p,q,s=[];if(y(g))for(d=0;d=e;e+=r)f+=g(a[d-1],a[d],e,m)}return f}function fc(a){var b;ub=e.select(ya);if(ub.empty())N.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".'); -else{ub.html("");f.data.x={};f.data.targets=Wa(a);qa();P();m.domain(e.extent(qb(f.data.targets)));D.domain(ob("y"));aa.domain(ob("y2"));T.domain(m.domain());kb.domain(D.domain());lb.domain(aa.domain());$=m.domain();J.scale(T);ea&&E.scale(m);p=e.select(ya).append("svg").attr("width",q+v+M).attr("height",r+n+pa).on("mouseenter",Ie).on("mouseleave",Je);vb=p.append("defs");vb.append("clipPath").attr("id",gc).append("rect").attr("width",q).attr("height",r);vb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x", --1).attr("y",-20).attr("width",ha).attr("height",X);vb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-v+1).attr("width",Ka).attr("height",Db);l=p.append("g").attr("transform",K.main);G=Ha?p.append("g").attr("transform",K.context):null;Ia=ia?p.append("g").attr("transform",K.legend):null;U=e.select(ya).style("position","relative").append("div").style("position","absolute").style("z-index","10").style("display","none");l.append("g").attr("class","x axis").attr("clip-path",h?"":"url("+ -document.URL+"#xaxis-clip)").attr("transform",K.x).append("text").attr("class","-axis-x-label").attr("x",q).attr("dy","-.5em").style("text-anchor","end").text(Ke);l.append("g").attr("class","y axis").attr("clip-path",h?"url("+document.URL+"#yaxis-clip)":"").append("text").attr("transform","rotate(-90)").attr("dy","1.2em").attr("dx","-.5em").style("text-anchor","end").text(Le);fb&&l.append("g").attr("class","y2 axis").attr("transform",K.y2);a=l.append("g").attr("clip-path",bb).attr("class","grid"); -sd&&a.append("g").attr("class","xgrids");hc&&(b=a.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(hc).enter().append("g").attr("class","xgrid-line"),b.append("line").attr("class",function(a){return""+a["class"]}),b.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",h?"":"rotate(-90)").attr("dx",h?0:-n).attr("dy",-5).text(function(a){return a.text}));Me&&a.append("g").attr("class","xgrid-focus").append("line").attr("class", -"xgrid-focus").attr("x1",h?0:-10).attr("x2",h?q:-10).attr("y1",h?-10:n).attr("y2",h?-10:r);td&&a.append("g").attr("class","ygrids");ic&&(a=a.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(ic).enter().append("g").attr("class","ygrid-line"),a.append("line").attr("class",function(a){return""+a["class"]}),a.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",h?"rotate(-90)":"").attr("dx",h?0:-n).attr("dy",-5).text(function(a){return a.text})); -l.append("g").attr("clip-path",bb).attr("class","regions");l.append("g").attr("clip-path",bb).attr("class","chart");l.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",ea?h?"ns-resize":"ew-resize":null);l.select(".chart").append("g").attr("class","chart-bars");l.select(".chart").append("g").attr("class","chart-lines");l.select(".chart").append("g").attr("class","chart-arcs").attr("transform",K.arc).append("text").attr("class","chart-arcs-title").style("text-anchor", -"middle").text(Ne);l.select(".chart").append("g").attr("class","chart-texts");if(ea)l.insert("rect",Oe?null:"g.grid").attr("class","zoom-rect").attr("width",q).attr("height",r).style("opacity",0).style("cursor",h?"ns-resize":"ew-resize").call(E).on("dblclick.zoom",null);null!==wb&&J.extent("function"!==typeof wb?wb:wb(qb()));Ha&&(G.append("g").attr("clip-path",bb).attr("class","chart"),G.select(".chart").append("g").attr("class","chart-bars"),G.select(".chart").append("g").attr("class","chart-lines"), -G.append("g").attr("clip-path",bb).attr("class","x brush").call(J).selectAll("rect").attr(h?"width":"height",h?Fb:ib),G.append("g").attr("class","x axis").attr("transform",K.subx).attr("clip-path",h?"url("+document.URL+"#yaxis-clip)":""));ia&&xb(f.data.targets);ud(f.data.targets);V({withTransform:!0,withUpdateXDomain:!0});if(Pe){if(C&&"string"===typeof Ja){Ja=ta(Ja);for(a=0;aZb(c,a)?p.select(".event-rect").style("cursor","pointer"):p.select(".event-rect").style("cursor",null))}).on("click",function(){var a,c;B(f.data.targets)||(a=e.mouse(this),c=$c(f.data.targets,a),100>Zb(c,a)&&l.select(".-circles-"+c.id).select(".-circle-"+c.index).each(function(){wd(this,c,c.index)}))}).call(e.behavior.drag().origin(Object).on("drag",function(){xd(e.mouse(this))}).on("dragstart",function(){yd(e.mouse(this))}).on("dragend", -function(){zd()})).call(E).on("dblclick.zoom",null)}function wd(a,b,c){var d=e.select(a),k=d.classed(na),f=!1,h;"circle"===a.nodeName?(f=id(a,1.5*ab),h=ld):"rect"===a.nodeName&&(f=jd(a),h=nd);if(wa||f)la&&ma(b)&&(d.classed(na,!k),h(!k,d,b,c)),Te(b,d)}function xd(a){var b,c,d,k,h,m,p;B(f.data.targets)||!la||ea&&!E.altDomain||(b=mc[0],c=mc[1],d=a[0],a=a[1],k=Math.min(b,d),h=Math.max(b,d),m=wa?n:Math.min(c,a),p=wa?r:Math.max(c,a),l.select(".dragarea").attr("x",k).attr("y",m).attr("width",h-k).attr("height", -p-m),l.selectAll(".-shapes").selectAll(".-shape").filter(function(a){return ma(a)}).each(function(a,b){var c=e.select(this),d=c.classed(na),g=c.classed(nc),f,l,rd,n;f=!1;"circle"===this.nodeName?(f=1*c.attr("cx"),l=1*c.attr("cy"),n=ld,f=ka.value?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return Yb(a.value)});c.style("fill-opacity", -se).transition().duration(s).attr("x",u).attr("y",v).style("fill-opacity",Uc);c.exit().transition().duration(a).style("fill-opacity",0).remove();l.selectAll(".-line").style("opacity",Ba).transition().duration(s).attr("d",We).style("opacity",1);l.selectAll(".-area").style("opacity",0).transition().duration(s).attr("d",Xe).style("opacity",Ad);a=l.selectAll(".-circles").selectAll(".-circle").data(ze);a.enter().append("circle").attr("class",qe).style("opacity",0).attr("r",ec);a.style("opacity",Ba).transition().duration(s).style("opacity", -te).attr("cx",h?Ga:Fa).attr("cy",h?Fa:Ga);a.exit().remove();l.selectAll(".chart-arc").select(".-arc").attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(s).attrTween("d",function(a){a=oa(a);if(!a)return function(){return"M 0 0"};var b=e.interpolate(this._current,a);this._current=b(0);return function(a){a=b(a);return gd(a.data)||Tb(a.data)?mb(a,!0):"M 0 0"}}).attr("transform",x?"scale(1)":"").style("opacity",1);l.selectAll(".chart-arc").select("text").attr("transform", -eb).style("opacity",0).transition().duration(s).text(Cb).style("opacity",function(a){return gd(a.data)||Tb(a.data)?1:0});l.select(".chart-arcs-title").style("opacity",Z(f.data.targets,"donut")?1:0);Ha&&(null!==e.event&&"zoom"===e.event.type&&J.extent(m.orgDomain()).update(),k&&(G.select(".x.axis").style("opacity",w?0:1).transition().duration(h?s:0).call(Pb),J.empty()||J.extent(m.orgDomain()).update(),k=od(d,!0),d=G.selectAll(".-bars").selectAll(".-bar").data(hd),d.enter().append("path").attr("d", -k).style("stroke","none").style("fill",function(a){return I(a.id)}).attr("class",Sc),d.style("opacity",Ba).transition().duration(s).attr("d",k).style("opacity",1),d.exit().transition().duration(s).style("opacity",0).remove(),G.selectAll(".-line").style("opacity",Ba).transition().duration(s).attr("d",Ye).style("opacity",1)));l.selectAll(".selected-circles").filter(function(a){return va(a)}).selectAll("circle").remove();l.selectAll(".selected-circle").transition().duration(s).attr("cx",h?Ga:Fa).attr("cy", -h?Fa:Ga);ba?(k=l.select(".event-rects").selectAll(".event-rect").data([0]),Se(k.enter()),k.attr("x",0).attr("y",0).attr("width",q).attr("height",r)):(Wb?(p=function(a,b){var c=Nc(b),d=br&&(r=b,x||(s=(Qa-r*Object.keys(a).length)/2));c>q&&(q=c,x&&(s=(sa-q*Object.keys(a).length)/2))};d=Ia.selectAll(".legend-item").data(c).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click", -function(a){af(a)}).on("mouseover",function(a){oc(a);f.focus(a)}).on("mouseout",function(){pc();f.revert()});d.append("text").text(function(a){return y(Va[a])?Va[a]:a}).each(function(){u(this)}).style("pointer-events","none").attr("x",x?h:-200).attr("y",x?-200:m);d.append("rect").attr("class","legend-item-event").style("fill-opacity",0).attr("x",x?l:-200).attr("y",x?-200:p).attr("width",r+14).attr("height",24);d.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill", -function(a){return I(a)}).attr("x",x?h:-200).attr("y",x?-200:n).attr("width",10).attr("height",10);Ia.selectAll("text").data(c).each(function(){u(this)}).transition().duration(t?250:0).attr("x",h).attr("y",n);Ia.selectAll("rect.legend-item-event").data(c).transition().duration(t?250:0).attr("x",l).attr("y",p);Ia.selectAll("rect.legend-item-tile").data(c).transition().duration(t?250:0).attr("x",e).attr("y",m)}function yb(a){return a?"-"+a.replace(/\./g,"\\."):""}function ka(a){return".target"+yb(a)} -function qc(a){return Oc(a.id)}function rc(a){return"data"in a&&Oc(a.data.id)}var f={data:{}},rb={},da="_expanded_",na="_selected_",nc="_included_",ya=d(["bindto"],"#chart"),Pa=d(["size","width"],null),Hb=d(["size","height"],null),gb=d(["padding","left"],null),zc=d(["padding","right"],null),ea=d(["zoom","enabled"],!1),Bd=d(["zoom","extent"],null),Oe=d(["zoom","privileged"],!1),Ie=d(["onenter"],function(){}),Je=d(["onleave"],function(){}),Ue=d(["transition","duration"],350);if(!("data"in fa))throw Error("data is required in config"); -var ua=d(["data","x"],null),ba=d(["data","xs"],null),$b=d(["data","x_format"],"%Y-%m-%d"),je=d(["data","id_converter"],function(a){return a}),Va=d(["data","names"],{}),u=d(["data","groups"],[]),Dc=d(["data","axes"],{}),Mc=d(["data","type"],null),z=d(["data","types"],{}),Ca=d(["data","labels"],{}),Ea=d(["data","order"],null),Cd=d(["data","regions"],{}),bf=d(["data","colors"],{}),la=d(["data","selection","enabled"],!1),wa=d(["data","selection","grouped"],!1),ma=d(["data","selection","isselectable"], -function(){return!0}),Ha=d(["subchart","show"],!1),Eb=Ha?d(["subchart","size","height"],60):0,cf=d(["color","pattern"],null),ia=d(["legend","show"],!0),df=d(["legend","position"],"bottom"),af=d(["legend","item","onclick"],function(){}),h=d(["axis","rotated"],!1),sc=d(["axis","x","type"],"indexed"),Sa=d(["axis","x","categories"],[]),Pd=d(["axis","x","tick","centered"],!1),nb=d(["axis","x","tick","format"],null),Sd=d(["axis","x","tick","culling"],h||"categorized"===sc?!1:!0),Ec=d(["axis","x","tick", -"count"],10),wb=d(["axis","x","default"],null),Ke=d(["axis","x","label"],null),$d=d(["axis","y","max"],null),Yd=d(["axis","y","min"],null),be=d(["axis","y","center"],null),Le=d(["axis","y","label"],null),hb=d(["axis","y","inner"],!1),Rb=d(["axis","y","tick","format"],null),Ta=d(["axis","y","padding"],null),Ld=d(["axis","y","ticks"],10),fb=d(["axis","y2","show"],!1),Zd=d(["axis","y2","max"],null),Xd=d(["axis","y2","min"],null),ae=d(["axis","y2","center"],null),Ib=d(["axis","y2","inner"],!1),Nd=d(["axis", -"y2","tick","format"],null),Ua=d(["axis","y2","padding"],null),Od=d(["axis","y2","ticks"],10),sd=d(["grid","x","show"],!1),Ve=d(["grid","x","type"],"tick"),hc=d(["grid","x","lines"],null),td=d(["grid","y","show"],!1),ic=d(["grid","y","lines"],null),ec=d(["point","show"],!0)?d(["point","r"],2.5):0,Me=d(["point","focus","line","enabled"],!0),jc=d(["point","focus","expand","enabled"],!0),kc=d(["point","focus","expand","r"],jc?4:ec),ab=d(["point","focus","select","r"],8),Te=d(["point","onclick"],function(){}), -Ce=d(["point","onselected"],function(){}),De=d(["point","onunselected"],function(){}),Td=d(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),Ne=d(["arc","title"],""),O=d(["regions"],[]),bd=d(["tooltip","enabled"],!0),Dd=d(["tooltip","format","title"],null),Ed=d(["tooltip","format","value"],null),cd=d(["tooltip","contents"],function(a,b,c,d){b=Dd?Dd:b;c=Ed?Ed:c;var e,f,h,l;for(f=0;f"+ -e+""),l=a[f].name,h=c(a[f].value),e+=""+l+""+h+"");return e+""}),Pe=d(["tooltip","init","show"],!1),Ja=d(["tooltip","init","x"],0),vd=d(["tooltip","init","position"],{top:"0px",left:"50px"}),gc=ya.replace("#","")+"-clip",bb="url("+document.URL+"#"+gc+")",C="timeseries"===sc,ja="categorized"===sc,Wb=!C&&(ua||ba),mc=null,cb=!1,lc=!1,I=function(a, -b){var c=[],d=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");return function(b){if(b in a)return a[b];-1===c.indexOf(b)&&c.push(b);return d[c.indexOf(b)%d.length]}}(bf,cf),Qd=function(){var a=[[e.time.format("%Y/%-m/%-d"),function(){return!0}],[e.time.format("%-m/%-d"),function(a){return a.getMonth()}],[e.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[e.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[e.time.format("%I %p"), -function(a){return a.getHours()}],[e.time.format("%I:%M"),function(a){return a.getMinutes()}],[e.time.format(":%S"),function(a){return a.getSeconds()}],[e.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)}}(),q,Fb,r,ib,Oa,ra,sa,Qa,Ra,jb,Gb,mb,Bc,Cc,Sb,Jb,Kb,Lb,Mb,Nb,Ob,m,D,aa,T,kb,lb,S,Qb,Ac,Pb,Id=h?"left":"bottom",Kd=h?hb?"top":"bottom":hb?"right":"left",Md=h?Ib?"bottom":"top":Ib?"left":"right",Jd=h?"left": -"bottom",K={main:function(){return"translate("+v+","+n+")"},context:function(){return"translate("+Ma+","+Ab+")"},legend:function(){return"translate("+zb+","+tc+")"},y2:function(){return"translate("+(h?0:q)+","+(h?1:0)+")"},x:function(){return"translate(0,"+r+")"},subx:function(){return"translate(0,"+(h?0:ib)+")"},arc:function(){return"translate("+q/2+","+r/2+")"}},x="right"===df,yc=40,xc=20;Sb=e.layout.pie().value(function(a){return a.values.reduce(function(a,c){return a+c.value},0)});var We=function(){var a= -e.svg.line().x(h?function(a){return t(a.id)(a.value)}:Da).y(h?Da:function(a){return t(a.id)(a.value)});return function(b){var c=bc(b.values),d;if(tb(b))return fd(b)?a.interpolate("cardinal"):a.interpolate("linear"),Cd[b.id]?He(c,m,t(b.id),Cd[b.id]):a(c);d=m(c[0].x);b=t(b.id)(c[0].value);return h?"M "+b+" "+d:"M "+d+" "+b}}(),Xe=function(){var a;a=h?e.svg.area().x0(function(a){return t(a.id)(0)}).x1(function(a){return t(a.id)(a.value)}).y(Da):e.svg.area().x(Da).y0(function(a){return t(a.id)(0)}).y1(function(a){return t(a.id)(a.value)}); -return function(b){var c=bc(b.values),d;if(Z([b],"area")||Z([b],"area-spline"))return fd(b)?a.interpolate("cardinal"):a.interpolate("linear"),a(c);d=m(c[0].x);b=t(b.id)(c[0].value);return h?"M "+b+" "+d:"M "+d+" "+b}}(),Ye=function(){var a=e.svg.line().x(h?function(a){return H(a.id)(a.value)}:Wc).y(h?Wc:function(a){return H(a.id)(a.value)});return function(b){var c=bc(b.values);return tb(b)?a(c):"M "+T(c[0].x)+" "+H(b.id)(c[0].value)}}(),J,E=function(){};J=e.svg.brush().on("brush",function(){V({withTransition:!1, -withY:!1,withSubchart:!1,withUpdateXDomain:!0})});J.update=function(){G&&G.select(".x.brush").call(this);return this};J.scale=function(a){return h?this.y(a):this.x(a)};ea&&(E=e.behavior.zoom().on("zoomstart",function(){E.altDomain=e.event.sourceEvent.altKey?m.orgDomain():null}).on("zoom",ea?Ze:null),E.scale=function(a){return h?this.y(a):this.x(a)},E.orgScaleExtent=function(){var a=Bd?Bd:[1,10];return[a[0],Math.max(Aa()/a[1],a[1])]},E.updateScaleExtent=function(){var a=za(m.orgDomain())/za($),b=this.orgScaleExtent(); -this.scaleExtent([b[0]*a,b[1]*a]);return this});var p,vb,l,G,Ia,U,ub,$,Ad,Xb={};f.focus=function(a){var b=p.selectAll(ka(a)),c=b.filter(qc),b=b.filter(rc);f.revert();f.defocus();c.classed("focused",!0).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);B(f.data.targets)&&wc(a,!0);oc(a)};f.defocus=function(a){var b=p.selectAll(ka(a)),c=b.filter(qc),b=b.filter(rc);f.revert();c.classed("focused",!1).transition().duration(100).style("opacity",0.3);b.transition().duration(100).style("opacity", -0.3);B(f.data.targets)&&Ub(a);$e(a)};f.revert=function(a){var b=p.selectAll(ka(a)),c=b.filter(qc),b=b.filter(rc);c.classed("focused",!1).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);B(f.data.targets)&&Ub(a);pc()};f.show=function(a){p.selectAll(ka(a)).transition().style("opacity",1)};f.hide=function(a){p.selectAll(ka(a)).transition().style("opacity",0)};f.unzoom=function(){J.clear().update();V({withUpdateXDomain:!0})};f.load=function(a){"function"!== -typeof a.done&&(a.done=function(){});a.xs&&ie(a.xs);"categories"in a&&ja&&(Sa=a.categories,S.categories(Sa));if("cacheIds"in a&&ee(a.cacheIds))db(fe(a.cacheIds),a.done);else if("data"in a)db(Wa(a.data),a.done);else if("url"in a)e.csv(a.url,function(b,c){db(Wa(c),a.done)});else if("rows"in a)db(Wa(Kc(a.rows)),a.done);else if("columns"in a)db(Wa(Lc(a.columns)),a.done);else throw Error("url or rows or columns is required.");};f.unload=function(a){f.data.targets=f.data.targets.filter(function(b){return b.id!== -a});p.selectAll(ka(a)).transition().style("opacity",0).remove();ia&&(p.selectAll(".legend-item"+yb(a)).remove(),xb(f.data.targets));0b.classes.indexOf(a)})});return O};f.data.get=function(a){a=f.data.getAsTarget(a);return y(a)?a.values.map(function(a){return a.value}): -void 0};f.data.getAsTarget=function(a){var b=pb(function(b){return b.id===a});return 0k&&(d-=c+60),l+g>Y()&&(l-=g+30),U.style("top",l+"px").style("left",d+"px").style("visibility","visible"))}function dd(a){a=a.filter(function(a){return a&&F(a.value)});bd&&($(f.data.targets,"scatter")||B(f.data.targets)|| +l.selectAll("line.xgrid-focus").style("visibility","visible").data([a[0]]).attr(h?"y1":"x1",Ea).attr(h?"y2":"x2",Ea))}function ed(){l.select("line.xgrid-focus").style("visibility","hidden")}function Ga(a){return a.x||0===a.x?m(a.x):null}function Ha(a){return t(a.id)(a.value)}function ve(){var a={},b=0,c,g;pb(wa).forEach(function(k){for(c=0;cu[c].indexOf(k.id)))for(g=0;gb.value?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ge(a,b,c){c=c.getBBox();return h?(a[0][0]+a[2][0]+0.6*c.height)/2:a[2][1]+(0>b.value?c.height:wa(b)?-3:-6)}function pd(a,b){var c=a.__max__+1,g=c?1.2*S.tickOffset()/c:0,d=we(g,c,a,!!b),e=xe(!!b),f=ye(a,!!b),h=b? +H:t;return function(a,b){var c=h(a.id)(0),l=f(a,b)||c;return[[d(a),l],[d(a),e(a)-(c-l)],[d(a)+g,e(a)-(c-l)],[d(a)+g,l]]}}function He(a,b,c,g){var d,e,f="M",l,m,n,p,q,s=[];if(y(g))for(d=0;d=e;e+=r)f+=g(a[d-1],a[d],e,n)}return f}function fc(a){var b;ub= +e.select(za);if(ub.empty())N.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');else{ub.html("");f.data.x={};f.data.targets=Wa(a);qa();P();m.domain(e.extent(qb(f.data.targets)));D.domain(ob("y"));ba.domain(ob("y2"));T.domain(m.domain());kb.domain(D.domain());lb.domain(ba.domain());aa=m.domain();J.scale(T);fa&&E.scale(m);p=e.select(za).append("svg").attr("width",q+v+M).attr("height",r+n+pa).on("mouseenter",Ie).on("mouseleave", +Je);vb=p.append("defs");vb.append("clipPath").attr("id",gc).append("rect").attr("width",q).attr("height",r);vb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-20).attr("width",ha).attr("height",Z);vb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-v+1).attr("width",La).attr("height",Db);l=p.append("g").attr("transform",K.main);G=Ia?p.append("g").attr("transform",K.context):null;Ja=ia?p.append("g").attr("transform",K.legend):null;U=e.select(za).style("position", +"relative").append("div").style("position","absolute").style("z-index","10").style("display","none");l.append("g").attr("class","x axis").attr("clip-path",h?"":"url("+document.URL+"#xaxis-clip)").attr("transform",K.x).append("text").attr("class","-axis-x-label").attr("x",q).attr("dy","-.5em").style("text-anchor","end").text(Ke);l.append("g").attr("class","y axis").attr("clip-path",h?"url("+document.URL+"#yaxis-clip)":"").append("text").attr("transform","rotate(-90)").attr("dy","1.2em").attr("dx", +"-.5em").style("text-anchor","end").text(Le);fb&&l.append("g").attr("class","y2 axis").attr("transform",K.y2);a=l.append("g").attr("clip-path",bb).attr("class","grid");sd&&a.append("g").attr("class","xgrids");hc&&(b=a.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(hc).enter().append("g").attr("class","xgrid-line"),b.append("line").attr("class",function(a){return""+a["class"]}),b.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform", +h?"":"rotate(-90)").attr("dx",h?0:-n).attr("dy",-5).text(function(a){return a.text}));Me&&a.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",h?0:-10).attr("x2",h?q:-10).attr("y1",h?-10:n).attr("y2",h?-10:r);td&&a.append("g").attr("class","ygrids");ic&&(a=a.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(ic).enter().append("g").attr("class","ygrid-line"),a.append("line").attr("class",function(a){return""+a["class"]}),a.append("text").attr("class", +function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",h?"rotate(-90)":"").attr("dx",h?0:-n).attr("dy",-5).text(function(a){return a.text}));l.append("g").attr("clip-path",bb).attr("class","regions");l.append("g").attr("clip-path",bb).attr("class","chart");l.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).style("cursor",fa?h?"ns-resize":"ew-resize":null);l.select(".chart").append("g").attr("class","chart-bars");l.select(".chart").append("g").attr("class", +"chart-lines");l.select(".chart").append("g").attr("class","chart-arcs").attr("transform",K.arc).append("text").attr("class","chart-arcs-title").style("text-anchor","middle").text(Ne);l.select(".chart").append("g").attr("class","chart-texts");if(fa)l.insert("rect",Oe?null:"g.grid").attr("class","zoom-rect").attr("width",q).attr("height",r).style("opacity",0).style("cursor",h?"ns-resize":"ew-resize").call(E).on("dblclick.zoom",null);null!==wb&&J.extent("function"!==typeof wb?wb:wb(qb()));Ia&&(G.append("g").attr("clip-path", +bb).attr("class","chart"),G.select(".chart").append("g").attr("class","chart-bars"),G.select(".chart").append("g").attr("class","chart-lines"),G.append("g").attr("clip-path",bb).attr("class","x brush").call(J).selectAll("rect").attr(h?"width":"height",h?Fb:ib),G.append("g").attr("class","x axis").attr("transform",K.subx).attr("clip-path",h?"url("+document.URL+"#yaxis-clip)":""));ia&&xb(f.data.targets);ud(f.data.targets);V({withTransform:!0,withUpdateXDomain:!0});if(Pe){if(C&&"string"===typeof Ka){Ka= +ua(Ka);for(a=0;aZb(c,a)?p.select(".event-rect").style("cursor","pointer"):p.select(".event-rect").style("cursor",null))}).on("click",function(){var a,c;B(f.data.targets)||(a=e.mouse(this),c=$c(f.data.targets,a),100>Zb(c,a)&&l.select(".-circles-"+c.id).select(".-circle-"+c.index).each(function(){wd(this, +c,c.index)}))}).call(e.behavior.drag().origin(Object).on("drag",function(){xd(e.mouse(this))}).on("dragstart",function(){yd(e.mouse(this))}).on("dragend",function(){zd()})).call(E).on("dblclick.zoom",null)}function wd(a,b,c){var d=e.select(a),k=d.classed(na),f=!1,h;"circle"===a.nodeName?(f=id(a,1.5*ab),h=ld):"rect"===a.nodeName&&(f=jd(a),h=nd);if(xa||f)la&&ma(b)&&(d.classed(na,!k),h(!k,d,b,c)),Te(b,d)}function xd(a){var b,c,d,k,h,m,p;B(f.data.targets)||!la||fa&&!E.altDomain||(b=mc[0],c=mc[1],d=a[0], +a=a[1],k=Math.min(b,d),h=Math.max(b,d),m=xa?n:Math.min(c,a),p=xa?r:Math.max(c,a),l.select(".dragarea").attr("x",k).attr("y",m).attr("width",h-k).attr("height",p-m),l.selectAll(".-shapes").selectAll(".-shape").filter(function(a){return ma(a)}).each(function(a,b){var c=e.select(this),d=c.classed(na),g=c.classed(nc),f,l,rd,n;f=!1;"circle"===this.nodeName?(f=1*c.attr("cx"),l=1*c.attr("cy"),n=ld,f=ka.value?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0).text(function(a){return Yb(a.value)});c.style("fill-opacity",se).transition().duration(s).attr("x",u).attr("y",v).style("fill-opacity",Uc);c.exit().transition().duration(a).style("fill-opacity",0).remove();l.selectAll(".-line").style("opacity",Ca).transition().duration(s).attr("d",We).style("opacity",1);l.selectAll(".-area").style("opacity",0).transition().duration(s).attr("d",Xe).style("opacity", +Ad);a=l.selectAll(".-circles").selectAll(".-circle").data(ze);a.enter().append("circle").attr("class",qe).style("opacity",0).attr("r",ec);a.style("opacity",Ca).transition().duration(s).style("opacity",te).attr("cx",h?Ha:Ga).attr("cy",h?Ga:Ha);a.exit().remove();l.selectAll(".chart-arc").select(".-arc").attr("transform",x?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(s).attrTween("d",function(a){a=oa(a);if(!a)return function(){return"M 0 0"};var b=e.interpolate(this._current, +a);this._current=b(0);return function(a){a=b(a);return gd(a.data)||Tb(a.data)?mb(a,!0):"M 0 0"}}).attr("transform",x?"scale(1)":"").style("opacity",1);l.selectAll(".chart-arc").select("text").attr("transform",eb).style("opacity",0).transition().duration(s).text(Cb).style("opacity",function(a){return gd(a.data)||Tb(a.data)?1:0});l.select(".chart-arcs-title").style("opacity",$(f.data.targets,"donut")?1:0);Ia&&(null!==e.event&&"zoom"===e.event.type&&J.extent(m.orgDomain()).update(),k&&(G.select(".x.axis").style("opacity", +w?0:1).transition().duration(h?s:0).call(Pb),J.empty()||J.extent(m.orgDomain()).update(),k=od(d,!0),d=G.selectAll(".-bars").selectAll(".-bar").data(hd),d.enter().append("path").attr("d",k).style("stroke","none").style("fill",function(a){return I(a.id)}).attr("class",Sc),d.style("opacity",Ca).transition().duration(s).attr("d",k).style("opacity",1),d.exit().transition().duration(s).style("opacity",0).remove(),G.selectAll(".-line").style("opacity",Ca).transition().duration(s).attr("d",Ye).style("opacity", +1)));l.selectAll(".selected-circles").filter(function(a){return wa(a)}).selectAll("circle").remove();l.selectAll(".selected-circle").transition().duration(s).attr("cx",h?Ha:Ga).attr("cy",h?Ga:Ha);ca?(k=l.select(".event-rects").selectAll(".event-rect").data([0]),Se(k.enter()),k.attr("x",0).attr("y",0).attr("width",q).attr("height",r)):(Wb?(p=function(a,b){var c=Nc(b),d=br&&(r=b,x||(s=(Qa-r*Object.keys(a).length)/ +2));c>q&&(q=c,x&&(s=(ta-q*Object.keys(a).length)/2))};d=Ja.selectAll(".legend-item").data(c).enter().append("g").attr("class",function(a){return"legend-item legend-item-"+a}).style("cursor","pointer").on("click",function(a){af(a)}).on("mouseover",function(a){oc(a);f.focus(a)}).on("mouseout",function(){pc();f.revert()});d.append("text").text(function(a){return y(Va[a])?Va[a]:a}).each(function(){u(this)}).style("pointer-events","none").attr("x",x?h:-200).attr("y",x?-200:m);d.append("rect").attr("class", +"legend-item-event").style("fill-opacity",0).attr("x",x?l:-200).attr("y",x?-200:p).attr("width",r+14).attr("height",24);d.append("rect").attr("class","legend-item-tile").style("pointer-events","none").style("fill",function(a){return I(a)}).attr("x",x?h:-200).attr("y",x?-200:n).attr("width",10).attr("height",10);Ja.selectAll("text").data(c).each(function(){u(this)}).transition().duration(t?250:0).attr("x",h).attr("y",n);Ja.selectAll("rect.legend-item-event").data(c).transition().duration(t?250:0).attr("x", +l).attr("y",p);Ja.selectAll("rect.legend-item-tile").data(c).transition().duration(t?250:0).attr("x",e).attr("y",m)}function yb(a){return a?"-"+a.replace(/\./g,"\\."):""}function ka(a){return".target"+yb(a)}function qc(a){return Oc(a.id)}function rc(a){return"data"in a&&Oc(a.data.id)}var f={data:{}},rb={},ea="_expanded_",na="_selected_",nc="_included_",za=d(["bindto"],"#chart"),ra=d(["size","width"],null),Hb=d(["size","height"],null),gb=d(["padding","left"],null),zc=d(["padding","right"],null),fa= +d(["zoom","enabled"],!1),Bd=d(["zoom","extent"],null),Oe=d(["zoom","privileged"],!1),Ie=d(["onenter"],function(){}),Je=d(["onleave"],function(){}),Ue=d(["transition","duration"],350);if(!("data"in ga))throw Error("data is required in config");var va=d(["data","x"],null),ca=d(["data","xs"],null),$b=d(["data","x_format"],"%Y-%m-%d"),je=d(["data","id_converter"],function(a){return a}),Va=d(["data","names"],{}),u=d(["data","groups"],[]),Dc=d(["data","axes"],{}),Mc=d(["data","type"],null),z=d(["data", +"types"],{}),Da=d(["data","labels"],{}),Fa=d(["data","order"],null),Cd=d(["data","regions"],{}),bf=d(["data","colors"],{}),la=d(["data","selection","enabled"],!1),xa=d(["data","selection","grouped"],!1),ma=d(["data","selection","isselectable"],function(){return!0}),Ia=d(["subchart","show"],!1),Eb=Ia?d(["subchart","size","height"],60):0,cf=d(["color","pattern"],null),ia=d(["legend","show"],!0),df=d(["legend","position"],"bottom"),af=d(["legend","item","onclick"],function(){}),h=d(["axis","rotated"], +!1),sc=d(["axis","x","type"],"indexed"),Sa=d(["axis","x","categories"],[]),Pd=d(["axis","x","tick","centered"],!1),nb=d(["axis","x","tick","format"],null),Sd=d(["axis","x","tick","culling"],h||"categorized"===sc?!1:!0),Ec=d(["axis","x","tick","count"],10),wb=d(["axis","x","default"],null),Ke=d(["axis","x","label"],null),$d=d(["axis","y","max"],null),Yd=d(["axis","y","min"],null),be=d(["axis","y","center"],null),Le=d(["axis","y","label"],null),hb=d(["axis","y","inner"],!1),Rb=d(["axis","y","tick", +"format"],null),Ta=d(["axis","y","padding"],null),Ld=d(["axis","y","ticks"],10),fb=d(["axis","y2","show"],!1),Zd=d(["axis","y2","max"],null),Xd=d(["axis","y2","min"],null),ae=d(["axis","y2","center"],null),Ib=d(["axis","y2","inner"],!1),Nd=d(["axis","y2","tick","format"],null),Ua=d(["axis","y2","padding"],null),Od=d(["axis","y2","ticks"],10),sd=d(["grid","x","show"],!1),Ve=d(["grid","x","type"],"tick"),hc=d(["grid","x","lines"],null),td=d(["grid","y","show"],!1),ic=d(["grid","y","lines"],null),ec= +d(["point","show"],!0)?d(["point","r"],2.5):0,Me=d(["point","focus","line","enabled"],!0),jc=d(["point","focus","expand","enabled"],!0),kc=d(["point","focus","expand","r"],jc?4:ec),ab=d(["point","focus","select","r"],8),Te=d(["point","onclick"],function(){}),Ce=d(["point","onselected"],function(){}),De=d(["point","onunselected"],function(){}),Td=d(["arc","label","format"],function(a,b){return(100*b).toFixed(1)+"%"}),Ne=d(["arc","title"],""),O=d(["regions"],[]),bd=d(["tooltip","enabled"],!0),Dd=d(["tooltip", +"format","title"],null),Ed=d(["tooltip","format","value"],null),cd=d(["tooltip","contents"],function(a,b,c,d){b=Dd?Dd:b;c=Ed?Ed:c;var e,f,h,l;for(f=0;f"+e+""),l=a[f].name,h=c(a[f].value),e+=""+l+""+h+"");return e+""}),Pe= +d(["tooltip","init","show"],!1),Ka=d(["tooltip","init","x"],0),vd=d(["tooltip","init","position"],{top:"0px",left:"50px"}),gc=za.replace("#","")+"-clip",bb="url("+document.URL+"#"+gc+")",C="timeseries"===sc,ja="categorized"===sc,Wb=!C&&(va||ca),mc=null,cb=!1,lc=!1,I=function(a,b){var c=[],d=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");return function(b){if(b in a)return a[b];-1===c.indexOf(b)&&c.push(b);return d[c.indexOf(b)%d.length]}}(bf, +cf),Qd=function(){var a=[[e.time.format("%Y/%-m/%-d"),function(){return!0}],[e.time.format("%-m/%-d"),function(a){return a.getMonth()}],[e.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[e.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[e.time.format("%I %p"),function(a){return a.getHours()}],[e.time.format("%I:%M"),function(a){return a.getMinutes()}],[e.time.format(":%S"),function(a){return a.getSeconds()}],[e.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)}}(),q,Fb,r,ib,Pa,sa,ta,Qa,Ra,jb,Gb,mb,Bc,Cc,Sb,Jb,Kb,Lb,Mb,Nb,Ob,m,D,ba,T,kb,lb,S,Qb,Ac,Pb,Id=h?"left":"bottom",Kd=h?hb?"top":"bottom":hb?"right":"left",Md=h?Ib?"bottom":"top":Ib?"left":"right",Jd=h?"left":"bottom",K={main:function(){return"translate("+v+","+n+")"},context:function(){return"translate("+Na+","+Ab+")"},legend:function(){return"translate("+zb+","+tc+")"},y2:function(){return"translate("+(h?0:q)+","+(h?1: +0)+")"},x:function(){return"translate(0,"+r+")"},subx:function(){return"translate(0,"+(h?0:ib)+")"},arc:function(){return"translate("+q/2+","+r/2+")"}},x="right"===df,yc=40,xc=20;Sb=e.layout.pie().value(function(a){return a.values.reduce(function(a,c){return a+c.value},0)});var We=function(){var a=e.svg.line().x(h?function(a){return t(a.id)(a.value)}:Ea).y(h?Ea:function(a){return t(a.id)(a.value)});return function(b){var c=bc(b.values),d;if(tb(b))return fd(b)?a.interpolate("cardinal"):a.interpolate("linear"), +Cd[b.id]?He(c,m,t(b.id),Cd[b.id]):a(c);d=m(c[0].x);b=t(b.id)(c[0].value);return h?"M "+b+" "+d:"M "+d+" "+b}}(),Xe=function(){var a;a=h?e.svg.area().x0(function(a){return t(a.id)(0)}).x1(function(a){return t(a.id)(a.value)}).y(Ea):e.svg.area().x(Ea).y0(function(a){return t(a.id)(0)}).y1(function(a){return t(a.id)(a.value)});return function(b){var c=bc(b.values),d;if($([b],"area")||$([b],"area-spline"))return fd(b)?a.interpolate("cardinal"):a.interpolate("linear"),a(c);d=m(c[0].x);b=t(b.id)(c[0].value); +return h?"M "+b+" "+d:"M "+d+" "+b}}(),Ye=function(){var a=e.svg.line().x(h?function(a){return H(a.id)(a.value)}:Wc).y(h?Wc:function(a){return H(a.id)(a.value)});return function(b){var c=bc(b.values);return tb(b)?a(c):"M "+T(c[0].x)+" "+H(b.id)(c[0].value)}}(),J,E=function(){};J=e.svg.brush().on("brush",function(){V({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})});J.update=function(){G&&G.select(".x.brush").call(this);return this};J.scale=function(a){return h?this.y(a):this.x(a)}; +fa&&(E=e.behavior.zoom().on("zoomstart",function(){E.altDomain=e.event.sourceEvent.altKey?m.orgDomain():null}).on("zoom",fa?Ze:null),E.scale=function(a){return h?this.y(a):this.x(a)},E.orgScaleExtent=function(){var a=Bd?Bd:[1,10];return[a[0],Math.max(Ba()/a[1],a[1])]},E.updateScaleExtent=function(){var a=Aa(m.orgDomain())/Aa(aa),b=this.orgScaleExtent();this.scaleExtent([b[0]*a,b[1]*a]);return this});var p,vb,l,G,Ja,U,ub,aa,Ad,Xb={};f.focus=function(a){var b=p.selectAll(ka(a)),c=b.filter(qc),b=b.filter(rc); +f.revert();f.defocus();c.classed("focused",!0).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);B(f.data.targets)&&wc(a,!0);oc(a)};f.defocus=function(a){var b=p.selectAll(ka(a)),c=b.filter(qc),b=b.filter(rc);f.revert();c.classed("focused",!1).transition().duration(100).style("opacity",0.3);b.transition().duration(100).style("opacity",0.3);B(f.data.targets)&&Ub(a);$e(a)};f.revert=function(a){var b=p.selectAll(ka(a)),c=b.filter(qc),b=b.filter(rc);c.classed("focused", +!1).transition().duration(100).style("opacity",1);b.transition().duration(100).style("opacity",1);B(f.data.targets)&&Ub(a);pc()};f.show=function(a){p.selectAll(ka(a)).transition().style("opacity",1)};f.hide=function(a){p.selectAll(ka(a)).transition().style("opacity",0)};f.unzoom=function(){J.clear().update();V({withUpdateXDomain:!0})};f.load=function(a){"function"!==typeof a.done&&(a.done=function(){});a.xs&&ie(a.xs);"categories"in a&&ja&&(Sa=a.categories,S.categories(Sa));if("cacheIds"in a&&ee(a.cacheIds))db(fe(a.cacheIds), +a.done);else if("data"in a)db(Wa(a.data),a.done);else if("url"in a)e.csv(a.url,function(b,c){db(Wa(c),a.done)});else if("rows"in a)db(Wa(Kc(a.rows)),a.done);else if("columns"in a)db(Wa(Lc(a.columns)),a.done);else throw Error("url or rows or columns is required.");};f.unload=function(a){f.data.targets=f.data.targets.filter(function(b){return b.id!==a});p.selectAll(ka(a)).transition().style("opacity",0).remove();ia&&(p.selectAll(".legend-item"+yb(a)).remove(),xb(f.data.targets));0b.classes.indexOf(a)})});return O};f.data.get=function(a){a=f.data.getAsTarget(a);return y(a)?a.values.map(function(a){return a.value}):void 0};f.data.getAsTarget=function(a){var b=pb(function(b){return b.id===a});return 0