(function(kb){function lb(){function m(c,l){c.attr("transform",function(c){return"translate("+(l(c)+R)+",0)"})}function u(c,l){c.attr("transform",function(c){return"translate(0,"+l(c)+")"})}function Ca(c){var l=c[0];c=c[c.length-1];return lv[d].indexOf(k.id)))for(e=0;e=s;s+= diffx2)n+=e(a[c-1],a[c],s,l);return n}function ab(a){var b=h.data.targets=K(a),d,c;p.domain(d3.extent(a.map(function(a){return a.x})));x.domain(Da(b,"y"));P.domain(Da(b,"y2"));y.domain(p.domain());Ga.domain(x.domain());Ha.domain(P.domain());E.ticks(10>a.length?a.length:10);g.append("g").attr("class","x axis").attr("clip-path",f?"":"url(#xaxis-clip)").attr("transform","translate(0,"+w+")").call(f?ra:E);g.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)":"").call(f?E:ra).append("text").attr("transform", "rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(pc);qb&&g.append("g").attr("class","y2 axis").attr("transform","translate("+(f?0:q)+","+(f?10:0)+")").call(Va);d=g.append("g").attr("clip-path",Na).attr("class","grid");Mb&&d.append("g").attr("class","xgrids");bb&&(c=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(bb).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:-t).attr("dy",-6).text(function(a){return a.text}));qc&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",f?0:-10).attr("x2",f?q:-10).attr("y1",f?-10:t).attr("y2",f?-10:w);Nb&&d.append("g").attr("class","ygrids");cb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(cb).enter().append("line").attr("class",function(a){return"ygrid-line "+ a["class"]});g.append("g").attr("clip-path",Na).attr("class","regions");g.append("g").attr("clip-path",Na).attr("class","chart");g.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 X&&ba?"pointer":null}).on("mouseover",function(a,b){if(!Oa){var d=h.data.targets.map(function(a){return Ea(a.values[b])}),c,e;if(0",c,e,f;for(c=0;c"+f+""+e+"";return b+""}),sc=c(["tooltip","init","show"],!1),ka=c(["tooltip","init","x"],0),Sb=c(["tooltip","init","position"],{top:"0px",left:"50px"}),ib=z.bindto.replace("#","")+"-clip",Na="url(#"+ib+")",G="timeseries"===Vb,Ba="categorized"===Vb,eb=null,Oa=!1,$=ja?40:0,Ac=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()}]]),aa=d3.time.format(xc).parse,nb,sb,pb,rb,tb,q,w,fa,vb,wb,Ta,Ua,p,x,P,y,Ga,Ha,E=Ba?lb(): d3.svg.axis(),ra=d3.svg.axis(),Va=d3.svg.axis(),ga=Ba?lb():d3.svg.axis();O();R();G&&E.tickFormat(Ac);Ba?(E.categories(Qa).tickCentered(Wb),ga.categories(Qa).tickCentered(Wb)):(E.tickOffset=function(){return 0},ga.tickOffset=function(){return 0});Ba&&function(){var a=p,b=y,c=Object.keys(p),e,f;p=function(b){return a(b)+E.tickOffset()};y=function(a){return b(a)+ga.tickOffset()};for(f=0;fa?0:a},Q=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]}}(yc,zc),Ra=d3.select(z.bindto).append("svg").attr("width", q+L+D).attr("height",w+t+T),jb=Ra.append("defs");jb.append("clipPath").attr("id",ib).append("rect").attr("y",t).attr("width",q).attr("height",w-t);jb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",q+2).attr("height",40);jb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-39).attr("y",t-1).attr("width",40).attr("height",w-t+2);var g=Ra.append("g").attr("transform","translate("+L+","+t+")"),N=null;wa&&(N=Ra.append("g").attr("transform", "translate("+H+","+la+")"));var za=null;ja&&(za=Ra.append("g").attr("transform","translate("+Ca+","+mb+")"));var ia=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),ha=d3.svg.brush().x(y).on("brush",function(){I({withTransition:!1,withY:!1,withSubchart:!1})}),La=null,Wa=null;h.focus=function(a){h.defocus();d3.selectAll(Aa(a)).filter(function(a){return Sa(a.id)}).classed("focused",!0).transition().duration(100).style("opacity", 1)};h.defocus=function(a){d3.selectAll(Aa(a)).filter(function(a){return Sa(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};h.revert=function(a){d3.selectAll(Aa(a)).filter(function(a){return Sa(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};h.show=function(a){d3.selectAll(Aa(a)).transition().style("opacity",1)};h.hide=function(a){d3.selectAll(Aa(a)).transition().style("opacity",0)};h.load=function(a){u(a.done)&&(a.done=function(){});if("cacheIds"in a&&da(a.cacheIds))xa(ea(a.cacheIds),a.done);else if("data"in a)xa(K(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){xa(K(c),a.done)});else if("rows"in a)xa(K(ma(a.rows)),a.done);else if("columns"in a)xa(K(na(a.columns)),a.done);else throw Error("url or rows or columns is required.");};h.unload=function(a){h.data.targets=h.data.targets.filter(function(b){return b.id!=a});d3.selectAll(".target-"+a).transition().style("opacity",0).remove();ja&&(d3.selectAll(".legend-item-"+a).remove(),Pa(h.data.targets)); 0b.classes.indexOf(a)})});return J};h.data.get=function(a){a=h.data.getAsTarget(a);return m(a)?a.values.map(function(a){return a.value}):void 0};h.data.getAsTarget=function(a){var b=Ia(function(b){return b.id== a});return 0