(function(sb){function tb(){function k(c,Ya){c.attr("transform",function(c){return"translate("+(Ya(c)+T)+",0)"})}function s(c,k){c.attr("transform",function(c){return"translate(0,"+k(c)+")"})}function Ha(c){var k=c[0];c=c[c.length-1];return kt[d].indexOf(c.id)))for(e=0;e=h;h+=diffx2)q+=c(a[g-1],a[g],h,v);return q}function Vb(){return"translate("+(f?0:r)+","+(f?10:0)+ ")"}function ib(a){var b=l.data.targets=M(a),d,c;m.domain(d3.extent(a.map(function(a){return a.x})));x.domain(D(b,"y"));P.domain(D(b,"y2"));B.domain(m.domain());La.domain(x.domain());Ma.domain(P.domain());C.ticks(10>a.length?a.length:10);ka.ticks(zc).outerTickSize(0).tickFormat(Ac);Na.ticks(Bc).outerTickSize(0).tickFormat(Cc);Fb=m.domain();Q.x(B);ma&&Ba.x(m);h.append("g").attr("class","x axis").attr("clip-path",f?"":"url(#xaxis-clip)").attr("transform","translate(0,"+u+")").call(f?ka:C);h.append("g").attr("class", "y axis").attr("clip-path",f?"url(#yaxis-clip)":"").call(f?C:ka).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(Dc);yb&&h.append("g").attr("class","y2 axis").attr("transform",Vb).call(Na);if(ma)h.append("rect").attr("class","zoom-rect").attr("width",r).attr("height",u).style("opacity",0).call(Ba).on("dblclick.zoom",null);d=h.append("g").attr("clip-path",Ta).attr("class","grid");Wb&&d.append("g").attr("class","xgrids");jb&&(c=d.append("g").attr("class", "xgrid-lines").selectAll(".xgrid-line").data(jb).enter().append("g").attr("class","xgrid-line"),c.append("line").attr("class",function(a){return""+a["class"]}),c.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",f?"":"rotate(-90)").attr("dx",f?0:-p).attr("dy",-6).text(function(a){return a.text}));Ec&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",f?0:-10).attr("x2",f?r:-10).attr("y1",f?-10:p).attr("y2", f?-10:u);Xb&&d.append("g").attr("class","ygrids");kb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(kb).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});h.append("g").attr("clip-path",Ta).attr("class","regions");h.append("g").attr("clip-path",Ta).attr("class","chart");h.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(a){return Y&&ea?"pointer":null}).on("mouseover",function(a,b){if(!Ua){var d=l.data.targets.map(function(a){return Ia(a.values[b])}),c,e;if(0",c,e,g;for(c=0;c"+g+""+e+"";return b+""}),Gc=c(["tooltip","init","show"],!1),pa=c(["tooltip", "init","x"],0),bc=c(["tooltip","init","position"],{top:"0px",left:"50px"}),qb=Ka.replace("#","")+"-clip",Ta="url(#"+qb+")",G="timeseries"===ec,ca="categorized"===ec,nb=null,Ua=!1,mb=!1,ba=oa?40:0,Pc=function(a){return function(b){for(var c=a.length-1,e=a[c];!e[1](b);)e=a[--c];return e[0](b)}}([[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()}]]),da=d3.time.format(Mc).parse,vb,Ab,xb,zb,Bb,r,u,ja,Db,Eb,bb,cb,m,x,P,B,La,Ma,C=ca?tb():d3.svg.axis(),ka=d3.svg.axis(),Na=d3.svg.axis(),la=ca?tb():d3.svg.axis();O();T();G&&C.tickFormat(Pc);ca?(C.categories(Wa).tickCentered(fc),la.categories(Wa).tickCentered(fc)): (C.tickOffset=function(){return 0},la.tickOffset=function(){return 0});var Ic=function(){var a=d3.svg.line().x(f?function(a){return E(a.id)(a.value)}:Sa).y(f?Sa:function(a){return E(a.id)(a.value)});return function(b){var c;if(gb(b))return"spline"===X["string"===typeof b?b:b.id]?a.interpolate("cardinal"):a.interpolate("linear"),0a?0:a},R=function(a,b){var c=[],e=null!==b?b:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");return function(b){if(b in a)return a[b];0<= c.indexOf(b)||c.push(b);return e[c.indexOf(b)%e.length]}}(Nc,Oc),Xa=d3.select(Ka).append("svg").attr("width",r+F+A).attr("height",u+p+U),rb=Xa.append("defs");rb.append("clipPath").attr("id",qb).append("rect").attr("y",p).attr("width",r).attr("height",u-p);rb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",r+2).attr("height",40);rb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-F+1).attr("y",p-1).attr("width",F).attr("height",u- p+2);var h=Xa.append("g").attr("transform","translate("+F+","+p+")"),J=null;na&&(J=Xa.append("g").attr("transform","translate("+I+","+qa+")"));var Fa=null;oa&&(Fa=Xa.append("g").attr("transform","translate("+Ha+","+ub+")"));var fa=d3.select(Ka).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),Q=d3.svg.brush().on("brush",function(){H({withTransition:!1,withY:!1,withSubchart:!1})}),Ba=d3.behavior.zoom().on("zoom", ma?Kc:null),Ra=null,db=null,Fb;l.focus=function(a){l.defocus();d3.selectAll(Ga(a)).filter(function(a){return Za(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};l.defocus=function(a){d3.selectAll(Ga(a)).filter(function(a){return Za(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};l.revert=function(a){d3.selectAll(Ga(a)).filter(function(a){return Za(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};l.show=function(a){d3.selectAll(Ga(a)).transition().style("opacity", 1)};l.hide=function(a){d3.selectAll(Ga(a)).transition().style("opacity",0)};l.load=function(a){s(a.done)&&(a.done=function(){});if("cacheIds"in a&&ha(a.cacheIds))Da(ia(a.cacheIds),a.done);else if("data"in a)Da(M(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){Da(M(c),a.done)});else if("rows"in a)Da(M(ra(a.rows)),a.done);else if("columns"in a)Da(M(sa(a.columns)),a.done);else throw Error("url or rows or columns is required.");};l.unload=function(a){l.data.targets=l.data.targets.filter(function(b){return b.id!= a});d3.selectAll(".target-"+a).transition().style("opacity",0).remove();oa&&(d3.selectAll(".legend-item-"+a).remove(),Va(l.data.targets));0b.classes.indexOf(a)})});return K};l.data.get=function(a){a= l.data.getAsTarget(a);return k(a)?a.values.map(function(a){return a.value}):void 0};l.data.getAsTarget=function(a){var b=Oa(function(b){return b.id==a});return 0