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