(function(Ka){function gb(){function n(c,i){c.attr("transform",function(c){return"translate("+(i(c)+E)+",0)"})}function c(c,i){c.attr("transform",function(c){return"translate(0,"+i(c)+")"})}function i(v){v.each(function(){for(var i=d3.select(this),v=l.domain(),k=[],x=Math.ceil(v[0]);xa.length?a.length:10);d=f.append("g").attr("clip-path", Da).attr("class","grid");rb&&d.append("g").attr("class","xgrids");Va&&(g=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(Va).enter().append("g").attr("class","xgrid-line"),g.append("line").attr("class",function(a){return""+a["class"]}),g.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",e?"":"rotate(-90)").attr("dx",e?0:-p.top).attr("dy",-6).text(function(a){return a.text}));Yb&&d.append("g").attr("class","xgrid-focus").append("line").attr("class", "xgrid-focus").attr("x1",e?0:-10).attr("x2",e?s:-10).attr("y1",e?-10:p.top).attr("y2",e?-10:u);sb&&d.append("g").attr("class","ygrids");Wa&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(Wa).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});f.append("g").attr("clip-path",Da).attr("class","regions");f.append("g").attr("clip-path",Da).attr("class","chart");f.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).selectAll(".event-rects").data(a).enter().append("rect").attr("class", function(a,b){return"event-rect event-rect-"+b}).style("cursor",function(){return V&&aa?"pointer":null}).on("mouseover",function(a,b){if(!Ea){var d=h.data.targets.map(function(a){return a.values[b]}),g,c;for(g=0;gr[g].indexOf(a.id)))for(c=0;c",d,c,e;for(d=0;d"+e+""+ c+"";return b+""}),Gb=n.bindto.replace("#","")+"-clip",Da="url(#"+Gb+")",M="timeseries"===Eb,wa="categorized"===Eb,Ya=null,Ea=!1,ca=ra?40:0,Hb,db=[[d3.time.format("%Y/%-m/%-d"),function(){return!0}],[d3.time.format("%-m/%-d"),function(a){return a.getMonth()}],[d3.time.format("%-m/%-d"),function(a){return 1!=a.getDate()}],[d3.time.format("%-m/%-d"),function(a){return a.getDay()&&1!=a.getDate()}],[d3.time.format("%I %p"),function(a){return a.getHours()}],[d3.time.format("%I:%M"),function(a){return a.getMinutes()}], [d3.time.format(":%S"),function(a){return a.getSeconds()}],[d3.time.format(".%L"),function(a){return a.getMilliseconds()}]];Hb=function(a){for(var b=db.length-1,d=db[b];!d[1](a);)d=db[--b];return d[0](a)};var p={top:0,right:vb&&!e?50:1,bottom:20+Cb+ca,left:40},Ib=Ga-Cb-ca,fc=Ga-ca,s=dc-p.left-p.right,u=Ga-p.top-p.bottom,qa=Ga-Ib-(20+ca),la=d3.time.format(ec).parse,Jb=e?0:u,Kb=e?s:1,q=Na(e?10:0,e?u:s),D=ja(Jb,Kb),ga=ja(Jb,Kb),H=Na(0,s),Pa=ja(qa,10),Oa=ja(qa,10),w=wa?gb():d3.svg.axis(),oa=d3.svg.axis(), $a=d3.svg.axis(),ia=wa?gb():d3.svg.axis();w.scale(q).orient(e?"left":"bottom");oa.scale(D).orient(e?"bottom":"left");$a.scale(ga).orient(e?"top":"right");ia.scale(H).orient("bottom");M&&w.tickFormat(Hb);wa?(w.categories(Ha).tickCentered(Fb),ia.categories(Ha).tickCentered(Fb)):(w.tickOffset=function(){return 0},ia.tickOffset=function(){return 0});if(wa){var Ia=q,Lb=H,Mb=Object.keys(q),xa,Ja,q=function(a){return Ia(a)+w.tickOffset()},H=function(a){return Lb(a)+ia.tickOffset()};for(Ja=0;Ja=h;h+=diffx2)j+=m(b[f-1],b[f],h,k)}}b=j}else b=eb(a.values);return b}b=q(a.values[0].x);a=A(a.id)(a.values[0].value);return e?"M "+a+" "+b:"M "+b+" "+a};var yb,gc=d3.svg.line().x(function(a){return H(a.x)}).y(function(a){return Q(a.id)(a.value)}); yb=function(a){return Sa(a)?gc(a.values):"M "+H(a.values[0].x)+" "+Q(a.id)(a.values[0].value)};var cb=function(a){return"start"in a?q(M?la(a.start):a.start):0},zb=function(a){var b=cb(a),a=("end"in a?q(M?la(a.end):a.end):s)-b;return 0>a?0:a},N,fb=[],Nb=null!==Db?Db:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");N=function(a){if(a in Bb)return Bb[a];0<=fb.indexOf(a)||fb.push(a);return Nb[fb.indexOf(a)%Nb.length]};var da=d3.select(n.bindto).append("svg").attr("width", s+p.left+p.right).attr("height",u+p.top+p.bottom);da.append("defs");da.select("defs").append("clipPath").attr("id",Gb).append("rect").attr("y",p.top).attr("width",s).attr("height",u-p.top);da.select("defs").append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",s+2).attr("height",40);da.select("defs").append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-39).attr("y",p.top-1).attr("width",40).attr("height",u-p.top+2);var f=da.append("g").attr("transform", "translate("+p.left+","+p.top+")"),O=null;pa&&(O=da.append("g").attr("transform","translate(40,"+Ib+")"));var ua=null;ra&&(ua=da.append("g").attr("transform","translate(40,"+fc+")"));var Fa=d3.select(n.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),ha=d3.svg.brush().x(H).on("brush",function(){P({withTransition:!1,withY:!1,withSubchart:!1})}),Ba=null,Qa=null;h.focus=function(a){h.defocus();d3.selectAll(va(a)).filter(function(a){return Ma(a.id)}).classed("focused", !0).transition().duration(100).style("opacity",1)};h.defocus=function(a){d3.selectAll(va(a)).filter(function(a){return Ma(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};h.revert=function(a){d3.selectAll(va(a)).filter(function(a){return Ma(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};h.show=function(a){d3.selectAll(va(a)).transition().style("opacity",1)};h.hide=function(a){d3.selectAll(va(a)).transition().style("opacity",0)};h.load=function(a){l(a.done)&& (a.done=function(){});var b;if(b="cacheIds"in a)a:{b=a.cacheIds;for(var d=0;db.classes.indexOf(a)})});return I}; h.data.get=function(a){a=h.data.getAsTarget(a);return i(a)?a.values.map(function(a){return a.value}):void 0};h.data.getAsTarget=function(a){var b=k(function(b){return b.id==a});return 0