(function(ob){function pb(){function h(c,Ua){c.attr("transform",function(c){return"translate("+(Ua(c)+S)+",0)"})}function t(c,h){c.attr("transform",function(c){return"translate(0,"+h(c)+")"})}function Ea(c){var h=c[0];c=c[c.length-1];return hv[d].indexOf(c.id)))for(e=0;e=s;s+=diffx2)m+=e(a[c-1],a[c],s,l);return m}function eb(a){var b=k.data.targets=M(a),d,c;l.domain(d3.extent(a.map(function(a){return a.x})));x.domain(E(b,"y"));Q.domain(E(b,"y2"));y.domain(l.domain());Ha.domain(x.domain());Ia.domain(Q.domain());D.ticks(10>a.length?a.length:10);ia.ticks(3).outerTickSize(0).tickFormat(tc); Ja.ticks(3).outerTickSize(0).tickFormat(uc);g.append("g").attr("class","x axis").attr("clip-path",f?"":"url(#xaxis-clip)").attr("transform","translate(0,"+u+")").call(f?ia:D);g.append("g").attr("class","y axis").attr("clip-path",f?"url(#yaxis-clip)":"").call(f?D:ia).append("text").attr("transform","rotate(-90)").attr("dy","1.4em").attr("dx","-.8em").style("text-anchor","end").text(vc);ub&&g.append("g").attr("class","y2 axis").attr("transform","translate("+(f?0:p)+","+(f?10:0)+")").call(Ja);d=g.append("g").attr("clip-path", Pa).attr("class","grid");Qb&&d.append("g").attr("class","xgrids");fb&&(c=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(fb).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:-r).attr("dy",-6).text(function(a){return a.text}));wc&&d.append("g").attr("class","xgrid-focus").append("line").attr("class", "xgrid-focus").attr("x1",f?0:-10).attr("x2",f?p:-10).attr("y1",f?-10:r).attr("y2",f?-10:u);Rb&&d.append("g").attr("class","ygrids");gb&&d.append("g").attr("class","ygrid-lines").selectAll("ygrid-line").data(gb).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});g.append("g").attr("clip-path",Pa).attr("class","regions");g.append("g").attr("clip-path",Pa).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&&ca?"pointer":null}).on("mouseover",function(a,b){if(!Qa){var d=k.data.targets.map(function(a){return Fa(a.values[b])}),c,e;if(0",c,e,f;for(c=0;c"+f+""+e+"";return b+""}),yc=c(["tooltip","init","show"],!1),na=c(["tooltip","init","x"],0),Wb=c(["tooltip","init","position"],{top:"0px",left:"50px"}),mb=z.bindto.replace("#","")+"-clip",Pa="url(#"+ mb+")",H="timeseries"===Zb,ea="categorized"===Zb,ib=null,Qa=!1,aa=ma?40:0,Gc=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()}]]),ba=d3.time.format(Dc).parse,rb,wb,tb,vb,xb,p,u,ha,zb,Ab,Ya,Za,l,x,Q,y,Ha,Ia,D=ea?pb():d3.svg.axis(),ia=d3.svg.axis(),Ja=d3.svg.axis(),ja=ea?pb():d3.svg.axis();P();S();H&&D.tickFormat(Gc);ea?(D.categories(Sa).tickCentered($b),ja.categories(Sa).tickCentered($b)):(D.tickOffset=function(){return 0},ja.tickOffset=function(){return 0});ea&&function(){var a= l,b=y,c=Object.keys(l),e,f;l=function(b){return a(b)+D.tickOffset()};y=function(a){return b(a)+ja.tickOffset()};for(f=0;fa?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]}}(Ec,Fc),Ta=d3.select(z.bindto).append("svg").attr("width",p+G+C).attr("height",u+r+T),nb=Ta.append("defs");nb.append("clipPath").attr("id",mb).append("rect").attr("y",r).attr("width",p).attr("height",u-r);nb.append("clipPath").attr("id","xaxis-clip").append("rect").attr("x", -1).attr("y",-1).attr("width",p+2).attr("height",40);nb.append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-G+1).attr("y",r-1).attr("width",G).attr("height",u-r+2);var g=Ta.append("g").attr("transform","translate("+G+","+r+")"),O=null;za&&(O=Ta.append("g").attr("transform","translate("+I+","+oa+")"));var Ca=null;ma&&(Ca=Ta.append("g").attr("transform","translate("+Ea+","+qb+")"));var la=d3.select(z.bindto).style("position","relative").append("div").style("position","absolute").style("width", "30%").style("z-index","10").style("visibility","hidden"),ka=d3.svg.brush().x(y).on("brush",function(){J({withTransition:!1,withY:!1,withSubchart:!1})}),Na=null,$a=null;k.focus=function(a){k.defocus();d3.selectAll(Da(a)).filter(function(a){return Va(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};k.defocus=function(a){d3.selectAll(Da(a)).filter(function(a){return Va(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",0.3)};k.revert=function(a){d3.selectAll(Da(a)).filter(function(a){return Va(a.id)}).classed("focused", !1).transition().duration(100).style("opacity",1)};k.show=function(a){d3.selectAll(Da(a)).transition().style("opacity",1)};k.hide=function(a){d3.selectAll(Da(a)).transition().style("opacity",0)};k.load=function(a){t(a.done)&&(a.done=function(){});if("cacheIds"in a&&fa(a.cacheIds))Aa(ga(a.cacheIds),a.done);else if("data"in a)Aa(M(data),a.done);else if("url"in a)d3.csv(a.url,function(b,c){Aa(M(c),a.done)});else if("rows"in a)Aa(M(pa(a.rows)),a.done);else if("columns"in a)Aa(M(qa(a.columns)),a.done); else throw Error("url or rows or columns is required.");};k.unload=function(a){k.data.targets=k.data.targets.filter(function(b){return b.id!=a});d3.selectAll(".target-"+a).transition().style("opacity",0).remove();ma&&(d3.selectAll(".legend-item-"+a).remove(),Ra(k.data.targets));0b.classes.indexOf(a)})});return K};k.data.get=function(a){a=k.data.getAsTarget(a);return h(a)?a.values.map(function(a){return a.value}):void 0};k.data.getAsTarget=function(a){var b=Ka(function(b){return b.id==a});return 0