(function(){vare,t,n,r,i=function(e,t){returnfunction(){returne.apply(t,arguments)}};e=jQuery,t={},t.Line=function(){functionn(n){this.updateHilight=i(this.updateHilight,this),this.hilight=i(this.hilight,this),this.updateHover=i(this.updateHover,this),this.transY=i(this.transY,this),this.transX=i(this.transX,this);varr,s=this;if(!(thisinstanceoft.Line))returnnewt.Line(n);typeofn.element=="string"?this.el=e(document.getElementById(n.element)):this.el=e(n.element);if(this.el===null||this.el.length===0)thrownewError("Graph placeholder not found.");this.options=e.extend({},this.defaults,n),typeofthis.options.units=="string"&&(this.options.postUnits=n.units);if(this.options.data===void0||this.options.data.length===0)return;this.el.addClass("graph-initialised"),this.r=newRaphael(this.el[0]),this.pointGrow=Raphael.animation({r:this.options.pointSize+3},25,"linear"),this.pointShrink=Raphael.animation({r:this.options.pointSize},25,"linear"),this.elementWidth=null,this.elementHeight=null,this.dirty=!1,this.prevHilight=null,this.el.mousemove(function(e){returns.updateHilight(e.pageX)}),this.options.hideHover&&this.el.mouseout(function(e){returns.hilight(null)}),r=function(e){vart;returnt=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],s.updateHilight(t.pageX),t},this.el.bind("touchstart",r),this.el.bind("touchmove",r),this.el.bind("touchend",r),this.setData(this.options.data)}returnn.prototype.defaults={lineWidth:3,pointSize:4,lineColors:["#0b62a4","#7A92A3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],ymax:"auto",ymin:"auto 0",marginTop:25,marginRight:25,marginBottom:30,marginLeft:25,numLines:5,gridLineColor:"#aaa",gridTextColor:"#888",gridTextSize:12,gridStrokeWidth:.5,hoverPaddingX:10,hoverPaddingY:5,hoverMargin:10,hoverFillColor:"#fff",hoverBorderColor:"#ccc",hoverBorderWidth:2,hoverOpacity:.95,hoverLabelColor:"#444",hoverFontSize:12,smooth:!0,hideHover:!1,parseTime:!0,preUnits:"",postUnits:"",dateFormat:function(e){return(newDate(e)).toString()},xLabels:"auto",xLabelFormat:null},n.prototype.setData=function(n,r){vari,s,o,u,a,f,l,c,h,p,d,v,m,g,y=this;r==null&&(r=!0),this.options.data=n.slice(0),this.options.data.sort(function(e,t){return(e[y.options.xkey]<t[y.options.xkey])-(t[y.options.xkey]<e[y.options.xkey])}),this.columnLabels=e.map(this.options.data,function(e){returne[y.options.xkey]}),this.seriesLabels=this.options.labels,this.series=[],d=this.options.ykeys;for(f=0,h=d.length;f<h;f++){o=d[f],s=[],v=this.options.data;for(l=0,p=v.length;l<p;l++)i=v[l],s.push(function(){switch(typeofi[o]){case"number":returni[o];case"string":returnparseFloat(i[o]);default:returnnull}}());this.series.push(s)}this.options.parseTime?this.xvals=e.map(this.columnLabels,function(e){returnt.parseDate(e)}):this.xvals=function(){g=[];for(vare=m=this.columnLabels.length-1;m<=0?e<=0:e>=0;m<=0?e++:e--)g.push(e);returng}.apply(this),this.options.parseTime&&(this.columnLabels=e.map(this.columnLabels,function(e){returntypeofe=="number"?y.options.dateFormat(e):e})),this.xmin=Math.min.apply(null,this.xvals),this.xmax=Math.max.apply(null,this.xvals),this.xmin===this.xmax&&(this.xmin-=1,this.xmax+=1),typeofthis.options.ymax=="string"&&this.options.ymax.slice(0,4)==="auto"&&(u=Math.max.apply(null,Array.prototype.concat.apply([],this.series)),this.options.ymax.length>5?this.options.ymax=Math.max(parseInt(this.options.ymax.slice(5),10),u):this.options.ymax=u),typeofthis.options.ymin=="string"&&this.options.ymin.slice(0,4)==="auto"&&(a=Math.min.apply(null,Array.prototype.concat.apply([],this.series)),this.options.ymin.length>5?this.options.ymin=Math.min(parseInt(this.options.ymin.slice(5),10),a):this.options.ymin=a),this.yInterval=(this.options.ymax-this.options.ymin)/(this.options.numLines-1),this.yInterval>0&&this.yInterval<1?this.precision=-Math.floor(Math.log(this.yInterval)/Math.log(10)):this.precision=0,this.dirty=!0;if(r)returnthis.redraw()},n.prototype.calc=function(){vart,n,r,i,s,o,u,a,f=this;i=this.el.width(),t=this.el.height();if(this.elementWidth!==i||this.elementHeight!==t||this.dirty){this.ele