var Timeline={};Timeline.ns="http://www.w3.org/2000/svg";Timeline.xlinkns="http://www.w3.org/1999/xlink";Timeline.marginBottom=10;Timeline.marginTop=15;Timeline.marginLeft=10;Timeline.marginRight=10;Timeline.rounded=false;Timeline.x_axis=false;Timeline.fill=true;Timeline.line="line";Timeline.dashed_style="5, 5";Timeline.parent_holder=false;Timeline.holder=false;Timeline.g=false;Timeline.axis=false;Timeline.graphs=[];Timeline.raw_points=[];Timeline.x_callback=false;Timeline.createElement=function(b,a){var c=document.createElementNS(Timeline.ns,b);for(attr in a){c.setAttribute(attr,a[attr])}return c};Timeline.hasClass=function(b,a){return(" "+b.getAttribute("class")+" ").indexOf(" "+a+" ")>-1};Timeline.addGraph=function(b,a){Timeline.graphs[b]=a};Timeline.hasGraph=function(a){if(typeof(Timeline.graphs[a])==="undefined"){return false}else{return true}};Timeline.clearGraph=function(b){if(typeof(b)==="undefined"){Timeline.raw_points=[];Timeline.graphs=[]}else{for(var a=0;a=0;--g){p[g]=(d[g]-j[g]*p[g+1])/k[g]}for(var g=0;gc||c===false){c=j[p].x}if(j[p].yb||b===false){b=j[p].y}}var f=Timeline.getNewXY(g,c,e,b);var i=f(Math.pow(10,Math.floor(Math.log(c-g)/Math.log(10))),Math.pow(10,Math.floor(Math.log(b-e)/Math.log(10))));var o=f(0,0);var n={x:i.x-o.x,y:i.y-o.y};if(Timeline.grid==="big"||Timeline.grid==="both"){var a=Timeline.holder.getElementById("grid");a.setAttribute("width",n.x);a.setAttribute("height",n.y);var h=f(Math.floor(g/Math.pow(10,Math.floor(Math.log(c-g)/Math.log(10))))*Math.pow(10,Math.floor(Math.log(c-g)/Math.log(10))),Math.floor(e/Math.pow(10,Math.floor(Math.log(b-e)/Math.log(10))))*Math.pow(10,Math.floor(Math.log(b-e)/Math.log(10))));a.setAttribute("y",h.y);a.setAttribute("x",h.x);a.querySelector("path").setAttribute("d","M "+n.x+" 0 L 0 0 0 "+n.y);if(Timeline.grid==="both"){a.querySelector("rect").setAttribute("width",n.x);a.querySelector("rect").setAttribute("height",n.y)}}if(Timeline.grid==="small"||Timeline.grid==="both"){n.x=n.x/10;n.y=n.y/10;var a=Timeline.holder.getElementById("smallGrid");a.setAttribute("width",n.x);a.setAttribute("height",n.y);if(Timeline.grid==="small"){var m=f(Math.floor(g/Math.pow(10,Math.floor(Math.log(c-g)/Math.log(10))))*Math.pow(10,Math.floor(Math.log(c-g)/Math.log(10))),Math.floor(e/Math.pow(10,Math.floor(Math.log(b-e)/Math.log(10))))*Math.pow(10,Math.floor(Math.log(b-e)/Math.log(10))));a.setAttribute("y",m.y);a.setAttribute("x",m.x)}a.querySelector("path").setAttribute("d","M "+n.x+" 0 L 0 0 0 "+n.y)}if(Timeline.x_axis===true){y=f(0,0).y;Timeline.axis.setAttribute("y1",y);Timeline.axis.setAttribute("y2",y)}return f};Timeline.draw=function(){var A=Timeline.scale(Timeline.raw_points);var t=[],o;var n,m;var d;for(var r=0;rt.length){break}q++}}for(var u=p+1;u","").split("");for(var u=0;u]+)>)/ig,"").replace("%y",Timeline.raw_points[j[r].id].y).replace("%x",Timeline.raw_points[j[r].id].x);if(u%2==0){d.appendChild(document.createTextNode(l[u]))}else{var w=Timeline.createElement("tspan",{dy:"-5"});w.appendChild(document.createTextNode(l[u]));d.appendChild(w)}}o=Timeline.createElement("path",{stroke:"black","stroke-width":2,fill:"white",opacity:0.5});v.appendChild(o);v.appendChild(d);var z=j[r].x-d.getBoundingClientRect().width/2;var a=Timeline.parent_holder.offsetHeight-j[r].y-20;var f=d.getBoundingClientRect().width;var s=d.getBoundingClientRect().height;if(j[r].x-d.getBoundingClientRect().width/2<0){z=j[r].x+20;a=Timeline.parent_holder.offsetHeight-j[r].y+5;o.setAttribute("d","M "+(z-5)+" "+(a+5)+" L "+(z-5)+" "+(a-s/2+7.5)+" L "+(z-10)+" "+(a-s/2+5)+" L "+(z-5)+" "+(a-s/2+2.5)+" L "+(z-5)+" "+(a-s+5)+" L "+(z+f+5)+" "+(a-s+5)+" L "+(z+f+5)+" "+(a+5)+" Z")}else{if(j[r].y+d.getBoundingClientRect().height+12>Timeline.parent_holder.offsetHeight){z=j[r].x+20;a=Timeline.parent_holder.offsetHeight-j[r].y+5;o.setAttribute("d","M "+(z-5)+" "+(a+5)+" L "+(z-5)+" "+(a-s/2+7.5)+" L "+(z-10)+" "+(a-s/2+5)+" L "+(z-5)+" "+(a-s/2+2.5)+" L "+(z-5)+" "+(a-s+5)+" L "+(z+f+5)+" "+(a-s+5)+" L "+(z+f+5)+" "+(a+5)+" Z");if(z+f>Timeline.parent_holder.offsetWidth){z=j[r].y-f-20;a=Timeline.parent_holder.offsetHeight-j[r].y+5;o.setAttribute("d","M "+(z-5)+" "+(a+5)+" L "+(z-5)+" "+(a-s+5)+" L "+(z+f+5)+" "+(a-s+5)+" L "+(z+f+5)+" "+(a-s/2+2.5)+" L "+(z+f+10)+" "+(a-s/2+5)+" L "+(z+f+5)+" "+(a-s/2+7.5)+" L "+(z+f+5)+" "+(a+5)+" Z")}}else{if(j[r].x+f/2+12>Timeline.parent_holder.offsetWidth){z=j[r].x-f-20;a=Timeline.parent_holder.offsetHeight-j[r].y+5;o.setAttribute("d","M "+(z-5)+" "+(a+5)+" L "+(z-5)+" "+(a-s+5)+" L "+(z+f+5)+" "+(a-s+5)+" L "+(z+f+5)+" "+(a-s/2+2.5)+" L "+(z+f+10)+" "+(a-s/2+5)+" L "+(z+f+5)+" "+(a-s/2+7.5)+" L "+(z+f+5)+" "+(a+5)+" Z")}else{o.setAttribute("d","M "+(z-5)+" "+(a+5)+" L "+(z-5)+" "+(a-s+5)+" L "+(z+f+5)+" "+(a-s+5)+" L "+(z+f+5)+" "+(a+5)+" L "+(z+f/2+2.5)+" "+(a+5)+" L "+(z+f/2)+" "+(a+10)+" L "+(z+f/2-2.5)+" "+(a+5)+" Z")}}}d.setAttribute("x",z);d.setAttribute("y",a);v.setAttribute("display","none")}}}};var old=window.onresize||function(){};window.onresize=function(){old();if(Timeline.g!==false){Timeline.g.setAttribute("transform","translate(0, "+Timeline.parent_holder.offsetHeight+") scale(1, -1)");if(Timeline.x_axis===true){Timeline.axis.setAttribute("x2",Timeline.parent_holder.offsetWidth-13-Timeline.marginRight)}[].forEach.call(Timeline.holder.querySelectorAll(".label, .over, .point, .line, .graph, .legend_x"),function(a){a.parentNode.removeChild(a)});Timeline.draw()}};