(function(vb){function wb(){function k(c,$a){c.attr("transform",function(c){return"translate("+($a(c)+U)+",0)"})}function s(c,k){c.attr("transform",function(c){return"translate(0,"+k(c)+")"})}function Ka(c){var k=c[0];c=c[c.length-1];return kv[d].indexOf(c.id)))for(e=0;e=h;h+=diffx2)q+=c(a[g-1],a[g],h,t);return q}function lb(a){var b=l.data.targets=O(a),d,c;m.domain(d3.extent(a.map(function(a){return a.x})));y.domain(D(b,"y"));R.domain(D(b,"y2"));z.domain(m.domain());Na.domain(y.domain());Oa.domain(R.domain());C.ticks(10>a.length?a.length:10);ea.ticks(Cc).outerTickSize(0).tickFormat(Dc);Pa.ticks(Ec).outerTickSize(0).tickFormat(Fc);Jb=m.domain();K.x(z);oa&&Fa.x(m);h.append("g").attr("class", "x axis").attr("clip-path",f?"":"url(#xaxis-clip)").attr("transform",L.x).call(f?ea:C);h.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)":"").call(f?C:ea).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(Gc);Db&&h.append("g").attr("class","y2 axis").attr("transform",L.y2).call(Pa);if(oa)h.append("rect").attr("class","zoom-rect").attr("width",r).attr("height",u).style("opacity",0).call(Fa).on("dblclick.zoom", null);d=h.append("g").attr("clip-path",Va).attr("class","grid");Zb&&d.append("g").attr("class","xgrids");mb&&(c=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(mb).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}));Hc&&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);$b&&d.append("g").attr("class","ygrids");nb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(nb).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});h.append("g").attr("clip-path",Va).attr("class","regions");h.append("g").attr("clip-path",Va).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 Z&&ia?"pointer":null}).on("mouseover",function(a,b){if(!Wa){var d=l.data.targets.map(function(a){return La(a.values[b])}),c,e;if(0",c,e,g;for(c=0;c"+g+""+e+"";return b+""}),Jc=c(["tooltip","init","show"],!1),ra=c(["tooltip","init","x"],0),ec=c(["tooltip","init","position"],{top:"0px",left:"50px"}),tb=ya.replace("#","")+"-clip",Va="url(#"+tb+")",G="timeseries"===hc,ga="categorized"===hc,qb=null,Wa=!1,pb=!1,ca=qa?40:0,Sc=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()}]]), ha=d3.time.format(Pc).parse,Ab,Fb,Cb,Ma,Eb,Gb,r,u,da,bb,na,Hb,Ib,eb,fb,m,y,R,z,Na,Oa,C=ga?wb():d3.svg.axis(),ea=d3.svg.axis(),Pa=d3.svg.axis(),fa=ga?wb():d3.svg.axis();Q();U();var L={main:function(){return"translate("+J+","+p+")"},context:function(){return"translate("+I+","+ta+")"},legend:function(){return"translate("+Ka+","+xb+")"},y2:function(){return"translate("+(f?0:r)+","+(f?10:0)+")"},x:function(){return"translate(0,"+u+")"},subx:function(){return"translate(0,"+da+")"}};G&&C.tickFormat(Sc); ga?(C.categories(Ya).tickCentered(ic),fa.categories(Ya).tickCentered(ic)):(C.tickOffset=function(){return 0},fa.tickOffset=function(){return 0});var Lc=function(){var a=d3.svg.line().x(f?function(a){return E(a.id)(a.value)}:Ua).y(f?Ua:function(a){return E(a.id)(a.value)});return function(b){var c;if(jb(b))return"spline"===Y["string"===typeof b?b:b.id]?a.interpolate("cardinal"):a.interpolate("linear"),0a?0:a},S=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]}}(Qc,Rc),Za=d3.select(ya).append("svg").attr("width",r+J+F).attr("height",u+p+V),ub=Za.append("defs");ub.append("clipPath").attr("id",tb).append("rect").attr("y",p).attr("width",r).attr("height",u-p);ub.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",r+2).attr("height",40);ub.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-J+1).attr("y", p-1).attr("width",J).attr("height",u-p+2);var h=Za.append("g").attr("transform",L.main),x=null;pa&&(x=Za.append("g").attr("transform",L.context));var sa=null;qa&&(sa=Za.append("g").attr("transform",L.legend));var ja=d3.select(ya).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),K=d3.svg.brush().on("brush",function(){H({withTransition:!1,withY:!1,withSubchart:!1})}),Fa=d3.behavior.zoom().on("zoom",oa?Nc: null),Ta=null,gb=null,Jb;l.focus=function(a){l.defocus();d3.selectAll(Ja(a)).filter(function(a){return ab(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};l.defocus=function(a){d3.selectAll(Ja(a)).filter(function(a){return ab(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};l.revert=function(a){d3.selectAll(Ja(a)).filter(function(a){return ab(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};l.show=function(a){d3.selectAll(Ja(a)).transition().style("opacity", 1)};l.hide=function(a){d3.selectAll(Ja(a)).transition().style("opacity",0)};l.load=function(a){s(a.done)&&(a.done=function(){});if("cacheIds"in a&&la(a.cacheIds))Ha(ma(a.cacheIds),a.done);else if("data"in a)Ha(O(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){Ha(O(c),a.done)});else if("rows"in a)Ha(O(ua(a.rows)),a.done);else if("columns"in a)Ha(O(va(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();qa&&(d3.selectAll(".legend-item-"+a).remove(),Xa(l.data.targets));0b.classes.indexOf(a)})});return M};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=Qa(function(b){return b.id==a});return 0