From 16db900413b645ad240b3addeb76aa1e7187d32d Mon Sep 17 00:00:00 2001 From: Mark Abbott Date: Tue, 13 Mar 2012 23:35:17 +0000 Subject: [PATCH] Fixed problem with performance improvement - Relabelled variables to make them more meaningful - Fixed bug with the way that the pointsPerPixel was calculated --- morris.coffee | 8 ++++---- morris.js | 10 +++++----- morris.min.js | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/morris.coffee b/morris.coffee index 8868691..73ec874 100644 --- a/morris.coffee +++ b/morris.coffee @@ -148,17 +148,17 @@ class Morris.Line # draw x axis labels prevLabelMargin = null xLabelMargin = 50 # make this an option? - xstep = width / @xvals.length - next_x = null + pointsPerPixel = (Math.floor(@xmax) - Math.ceil(@xmin)) / width + nextPoint = null for i in [Math.ceil(@xmin)..Math.floor(@xmax)] - if xstep < 1 or null == next_x or i >= next_x + if null == nextPoint or i >= nextPoint labelText = if @options.parseTime then i else @columnLabels[@columnLabels.length-i-1] label = @r.text(transX(i), @options.marginTop + height + @options.marginBottom / 2, labelText) .attr('font-size', @options.gridTextSize) .attr('fill', @options.gridTextColor) labelBox = label.getBBox() # Calculate the next value of i to use - next_x = (labelBox.x + labelBox.width + xLabelMargin) * xstep + nextPoint = (labelBox.x + labelBox.width + xLabelMargin) * pointsPerPixel # ensure a minimum of `xLabelMargin` pixels between labels if prevLabelMargin is null or prevLabelMargin <= labelBox.x prevLabelMargin = labelBox.x + labelBox.width + xLabelMargin diff --git a/morris.js b/morris.js index 6beea95..0ca31b5 100644 --- a/morris.js +++ b/morris.js @@ -105,7 +105,7 @@ }; Line.prototype.redraw = function() { - var c, circle, columns, coords, dx, dy, firstY, height, hideHover, hilight, hover, hoverHeight, hoverMargins, hoverSet, i, label, labelBox, labelText, lastY, left, lineY, maxYLabelWidth, next_x, path, pointGrow, pointShrink, prevHilight, prevLabelMargin, s, seriesCoords, seriesPoints, touchHandler, transX, transY, updateHilight, updateHover, v, width, x, xLabel, xLabelMargin, xstep, y, yInterval, yLabel, yLabels, _i, _j, _len, _len2, _ref, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, + var c, circle, columns, coords, dx, dy, firstY, height, hideHover, hilight, hover, hoverHeight, hoverMargins, hoverSet, i, label, labelBox, labelText, lastY, left, lineY, maxYLabelWidth, nextPoint, path, pointGrow, pointShrink, pointsPerPixel, prevHilight, prevLabelMargin, s, seriesCoords, seriesPoints, touchHandler, transX, transY, updateHilight, updateHover, v, width, x, xLabel, xLabelMargin, y, yInterval, yLabel, yLabels, _i, _j, _len, _len2, _ref, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _this = this; this.el.empty(); this.r = new Raphael(this.el[0]); @@ -136,14 +136,14 @@ } prevLabelMargin = null; xLabelMargin = 50; - xstep = width / this.xvals.length; - next_x = null; + pointsPerPixel = (Math.floor(this.xmax) - Math.ceil(this.xmin)) / width; + nextPoint = null; for (i = _ref = Math.ceil(this.xmin), _ref2 = Math.floor(this.xmax); _ref <= _ref2 ? i <= _ref2 : i >= _ref2; _ref <= _ref2 ? i++ : i--) { - if (xstep < 1 || null === next_x || i >= next_x) { + if (null === nextPoint || i >= nextPoint) { labelText = this.options.parseTime ? i : this.columnLabels[this.columnLabels.length - i - 1]; label = this.r.text(transX(i), this.options.marginTop + height + this.options.marginBottom / 2, labelText).attr('font-size', this.options.gridTextSize).attr('fill', this.options.gridTextColor); labelBox = label.getBBox(); - next_x = (labelBox.x + labelBox.width + xLabelMargin) * xstep; + nextPoint = (labelBox.x + labelBox.width + xLabelMargin) * pointsPerPixel; if (prevLabelMargin === null || prevLabelMargin <= labelBox.x) { prevLabelMargin = labelBox.x + labelBox.width + xLabelMargin; } else { diff --git a/morris.min.js b/morris.min.js index 7e9c68b..c8e5937 100644 --- a/morris.min.js +++ b/morris.min.js @@ -1 +1 @@ -((function(){var a,b;a=jQuery,b={},b.Line=function(){function c(c){if(!(this instanceof b.Line))return new b.Line(c);typeof c.element=="string"?this.el=a(document.getElementById(c.element)):this.el=a(c.element),this.options=a.extend({},this.defaults,c);if(this.options.data===void 0||this.options.data.length===0)return;this.el.addClass("graph-initialised"),this.precalc(),this.redraw()}return c.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,units:""},c.prototype.precalc=function(){var b,c,d,e,f,g,h,i,j,k=this;this.options.data.sort(function(a,b){return(a[k.options.xkey]=0;i<=0?a++:a--)j.push(a);return j}.apply(this),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),typeof this.options.ymax=="string"&&this.options.ymax.slice(0,4)==="auto"&&(c=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),c):this.options.ymax=c);if(typeof this.options.ymin=="string"&&this.options.ymin.slice(0,4)==="auto")return d=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),d):this.options.ymin=d},c.prototype.redraw=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,ba,bb,bc,bd,be,bf=this;this.el.empty(),this.r=new Raphael(this.el[0]),w=Math.max(this.measureText(this.options.ymin+this.options.units,this.options.gridTextSize).width,this.measureText(this.options.ymax+this.options.units,this.options.gridTextSize).width),u=w+this.options.marginLeft,M=this.el.width()-u-this.options.marginRight,i=this.el.height()-this.options.marginTop-this.options.marginBottom,f=M/(this.xmax-this.xmin),g=i/(this.options.ymax-this.options.ymin),H=function(a){return bf.xvals.length===1?u+M/2:u+(a-bf.xmin)*f},I=function(a){return bf.options.marginTop+i-(a-bf.options.ymin)*g},S=(this.options.ymax-this.options.ymin)/(this.options.numLines-1),h=Math.ceil(this.options.ymin/S)*S,t=Math.floor(this.options.ymax/S)*S;for(v=h;h<=t?v<=t:v>=t;v+=S)L=Math.floor(v),R=I(L),this.r.text(u-this.options.marginLeft/2,R,L+this.options.units).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor).attr("text-anchor","end"),this.r.path("M"+u+","+R+"H"+(u+M)).attr("stroke",this.options.gridLineColor).attr("stroke-width",this.options.gridStrokeWidth);C=null,P=50,Q=M/this.xvals.length,x=null;for(p=Z=Math.ceil(this.xmin),_=Math.floor(this.xmax);Z<=_?p<=_:p>=_;Z<=_?p++:p--)if(Q<1||null===x||p>=x)s=this.options.parseTime?p:this.columnLabels[this.columnLabels.length-p-1],q=this.r.text(H(p),this.options.marginTop+i+this.options.marginBottom/2,s).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor),r=q.getBBox(),x=(r.x+r.width+P)*Q,C===null||C<=r.x?C=r.x+r.width+P:q.remove();d=function(){var a,b,c,d;c=this.xvals,d=[];for(a=0,b=c.length;a=0;bb<=0?p++:p--)e=E[p],e.length>1&&(y=this.createPath(e,this.options.marginTop,u,this.options.marginTop+i,u+M),this.r.path(y).attr("stroke",this.options.lineColors[p]).attr("stroke-width",this.options.lineWidth));F=function(){var a,b;b=[];for(p=0,a=E.length-1;0<=a?p<=a:p>=a;0<=a?p++:p--)b.push([]);return b}();for(p=bc=E.length-1;bc<=0?p<=0:p>=0;bc<=0?p++:p--){bd=E[p];for(W=0,Y=bd.length;W=be;0<=be?p++:p--)T=this.r.text(0,this.options.hoverFontSize*1.5*(p+1.5)-m/2,"").attr("fill",this.options.lineColors[p]).attr("font-size",this.options.hoverFontSize),U.push(T),o.push(T);return K=function(b){var c,e,f,g,h;o.show(),O.attr("text",bf.columnLabels[b]);for(c=0,h=bf.series.length-1;0<=h?c<=h:c>=h;0<=h?c++:c--)U[c].attr("text",""+bf.seriesLabels[c]+": "+bf.commas(bf.series[c][b])+bf.options.units);return e=Math.max.apply(null,a.map(U,function(a){return a.getBBox().width})),e=Math.max(e,O.getBBox().width),l.attr("width",e+bf.options.hoverPaddingX*2),l.attr("x",-bf.options.hoverPaddingX-e/2),g=Math.min.apply(null,a.map(bf.series,function(a){return I(a[b])})),g>m+bf.options.hoverPaddingY*2+bf.options.hoverMargin+bf.options.marginTop?g=g-m/2-bf.options.hoverPaddingY-bf.options.hoverMargin:g=g+m/2+bf.options.hoverPaddingY+bf.options.hoverMargin,g=Math.max(bf.options.marginTop+m/2+bf.options.hoverPaddingY,g),g=Math.min(bf.options.marginTop+i-m/2-bf.options.hoverPaddingY,g),f=Math.min(u+M-e/2-bf.options.hoverPaddingX,d[b]),f=Math.max(u+e/2+bf.options.hoverPaddingX,f),o.attr("transform","t"+f+","+g)},j=function(){return o.hide()},n=a.map(d.slice(1),function(a,b){return(a+d[b])/2}),B=null,z=Raphael.animation({r:this.options.pointSize+3},25,"linear"),A=Raphael.animation({r:this.options.pointSize},25,"linear"),k=function(a){var b,c,d;if(B!==null&&B!==a)for(b=0,c=F.length-1;0<=c?b<=c:b>=c;0<=c?b++:b--)F[b][B].animate(A);if(a!==null&&B!==a){for(b=0,d=F.length-1;0<=d?b<=d:b>=d;0<=d?b++:b--)F[b][a].animate(z);K(a)}B=a;if(a===null)return j()},J=function(a){var b,c,d;a-=bf.el.offset().left,d=[];for(b=c=n.length;c<=0?b<=0:b>=0;c<=0?b++:b--){if(b===0||n[b-1]>a){k(b);break}d.push(void 0)}return d},this.el.mousemove(function(a){return J(a.pageX)}),this.options.hideHover&&this.el.mouseout(function(a){return k(null)}),G=function(a){var b;return b=a.originalEvent.touches[0]||a.originalEvent.changedTouches[0],J(b.pageX),b},this.el.bind("touchstart",G),this.el.bind("touchmove",G),this.el.bind("touchend",G),k(this.options.hideHover?null:0)},c.prototype.createPath=function(b,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s;n="";if(this.options.smooth){i=this.gradients(b);for(j=0,s=b.length-1;0<=s?j<=s:j>=s;0<=s?j++:j--)g=b[j],j===0?n+="M"+g.x+","+g.y:(h=i[j],l=b[j-1],m=i[j-1],k=(g.x-l.x)/4,o=l.x+k,q=Math.min(e,l.y+k*m),p=g.x-k,r=Math.min(e,g.y-k*h),n+="C"+o+","+q+","+p+","+r+","+g.x+","+g.y)}else n="M"+a.map(b,function(a){return""+a.x+","+a.y}).join("L");return n},c.prototype.gradients=function(b){return a.map(b,function(a,c){return c===0?(b[1].y-a.y)/(b[1].x-a.x):c===b.length-1?(a.y-b[c-1].y)/(a.x-b[c-1].x):(b[c+1].y-b[c-1].y)/(b[c+1].x-b[c-1].x)})},c.prototype.measureText=function(a,b){var c,d;return b==null&&(b=12),d=this.r.text(100,100,a).attr("font-size",b),c=d.getBBox(),d.remove(),c},c.prototype.parseYear=function(a){var b,c,d,e,f,g,h,i,j,k,l,m;return h=a.toString(),c=h.match(/^(\d+) Q(\d)$/),e=h.match(/^(\d+)-(\d+)$/),f=h.match(/^(\d+)-(\d+)-(\d+)$/),g=h.match(/^(\d+) W(\d+)$/),c?parseInt(c[1],10)+(parseInt(c[2],10)*3-1)/12:g?(m=parseInt(g[1],10),k=new Date(m,0,1),l=new Date(m+1,0,1),k.getDay()!==4&&k.setMonth(0,1+(4-k.getDay()+7)%7),l.getDay()!==4&&l.setMonth(0,1+(4-l.getDay()+7)%7),j=Math.ceil((l-k)/6048e5),parseInt(g[1],10)+(parseInt(g[2],10)-1)/j):e?parseInt(e[1],10)+(parseInt(e[2],10)-1)/12:f?(m=parseInt(f[1],10),d=parseInt(f[2],10),b=parseInt(f[3],10),i=(new Date(m,d-1,b)).getTime(),k=(new Date(m,0,1)).getTime(),l=(new Date(m+1,0,1)).getTime(),m+(i-k)/(l-k)):parseInt(a,10)},c.prototype.commas=function(a){var b;return b=a<0?"-":"",b+Math.abs(a).toFixed(0).replace(/(?=(?:\d{3})+$)(?!^)/g,",")},c}(),window.Morris=b})).call(this); \ No newline at end of file +((function(){var a,b;a=jQuery,b={},b.Line=function(){function c(c){if(!(this instanceof b.Line))return new b.Line(c);typeof c.element=="string"?this.el=a(document.getElementById(c.element)):this.el=a(c.element),this.options=a.extend({},this.defaults,c);if(this.options.data===void 0||this.options.data.length===0)return;this.el.addClass("graph-initialised"),this.precalc(),this.redraw()}return c.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,units:""},c.prototype.precalc=function(){var b,c,d,e,f,g,h,i,j,k=this;this.options.data.sort(function(a,b){return(a[k.options.xkey]=0;i<=0?a++:a--)j.push(a);return j}.apply(this),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),typeof this.options.ymax=="string"&&this.options.ymax.slice(0,4)==="auto"&&(c=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),c):this.options.ymax=c);if(typeof this.options.ymin=="string"&&this.options.ymin.slice(0,4)==="auto")return d=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),d):this.options.ymin=d},c.prototype.redraw=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,ba,bb,bc,bd,be,bf=this;this.el.empty(),this.r=new Raphael(this.el[0]),w=Math.max(this.measureText(this.options.ymin+this.options.units,this.options.gridTextSize).width,this.measureText(this.options.ymax+this.options.units,this.options.gridTextSize).width),u=w+this.options.marginLeft,N=this.el.width()-u-this.options.marginRight,i=this.el.height()-this.options.marginTop-this.options.marginBottom,f=N/(this.xmax-this.xmin),g=i/(this.options.ymax-this.options.ymin),I=function(a){return bf.xvals.length===1?u+N/2:u+(a-bf.xmin)*f},J=function(a){return bf.options.marginTop+i-(a-bf.options.ymin)*g},S=(this.options.ymax-this.options.ymin)/(this.options.numLines-1),h=Math.ceil(this.options.ymin/S)*S,t=Math.floor(this.options.ymax/S)*S;for(v=h;h<=t?v<=t:v>=t;v+=S)M=Math.floor(v),R=J(M),this.r.text(u-this.options.marginLeft/2,R,M+this.options.units).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor).attr("text-anchor","end"),this.r.path("M"+u+","+R+"H"+(u+N)).attr("stroke",this.options.gridLineColor).attr("stroke-width",this.options.gridStrokeWidth);D=null,Q=50,B=(Math.floor(this.xmax)-Math.ceil(this.xmin))/N,x=null;for(p=Z=Math.ceil(this.xmin),_=Math.floor(this.xmax);Z<=_?p<=_:p>=_;Z<=_?p++:p--)if(null===x||p>=x)s=this.options.parseTime?p:this.columnLabels[this.columnLabels.length-p-1],q=this.r.text(I(p),this.options.marginTop+i+this.options.marginBottom/2,s).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor),r=q.getBBox(),x=(r.x+r.width+Q)*B,D===null||D<=r.x?D=r.x+r.width+Q:q.remove();d=function(){var a,b,c,d;c=this.xvals,d=[];for(a=0,b=c.length;a=0;bb<=0?p++:p--)e=F[p],e.length>1&&(y=this.createPath(e,this.options.marginTop,u,this.options.marginTop+i,u+N),this.r.path(y).attr("stroke",this.options.lineColors[p]).attr("stroke-width",this.options.lineWidth));G=function(){var a,b;b=[];for(p=0,a=F.length-1;0<=a?p<=a:p>=a;0<=a?p++:p--)b.push([]);return b}();for(p=bc=F.length-1;bc<=0?p<=0:p>=0;bc<=0?p++:p--){bd=F[p];for(W=0,Y=bd.length;W=be;0<=be?p++:p--)T=this.r.text(0,this.options.hoverFontSize*1.5*(p+1.5)-m/2,"").attr("fill",this.options.lineColors[p]).attr("font-size",this.options.hoverFontSize),U.push(T),o.push(T);return L=function(b){var c,e,f,g,h;o.show(),P.attr("text",bf.columnLabels[b]);for(c=0,h=bf.series.length-1;0<=h?c<=h:c>=h;0<=h?c++:c--)U[c].attr("text",""+bf.seriesLabels[c]+": "+bf.commas(bf.series[c][b])+bf.options.units);return e=Math.max.apply(null,a.map(U,function(a){return a.getBBox().width})),e=Math.max(e,P.getBBox().width),l.attr("width",e+bf.options.hoverPaddingX*2),l.attr("x",-bf.options.hoverPaddingX-e/2),g=Math.min.apply(null,a.map(bf.series,function(a){return J(a[b])})),g>m+bf.options.hoverPaddingY*2+bf.options.hoverMargin+bf.options.marginTop?g=g-m/2-bf.options.hoverPaddingY-bf.options.hoverMargin:g=g+m/2+bf.options.hoverPaddingY+bf.options.hoverMargin,g=Math.max(bf.options.marginTop+m/2+bf.options.hoverPaddingY,g),g=Math.min(bf.options.marginTop+i-m/2-bf.options.hoverPaddingY,g),f=Math.min(u+N-e/2-bf.options.hoverPaddingX,d[b]),f=Math.max(u+e/2+bf.options.hoverPaddingX,f),o.attr("transform","t"+f+","+g)},j=function(){return o.hide()},n=a.map(d.slice(1),function(a,b){return(a+d[b])/2}),C=null,z=Raphael.animation({r:this.options.pointSize+3},25,"linear"),A=Raphael.animation({r:this.options.pointSize},25,"linear"),k=function(a){var b,c,d;if(C!==null&&C!==a)for(b=0,c=G.length-1;0<=c?b<=c:b>=c;0<=c?b++:b--)G[b][C].animate(A);if(a!==null&&C!==a){for(b=0,d=G.length-1;0<=d?b<=d:b>=d;0<=d?b++:b--)G[b][a].animate(z);L(a)}C=a;if(a===null)return j()},K=function(a){var b,c,d;a-=bf.el.offset().left,d=[];for(b=c=n.length;c<=0?b<=0:b>=0;c<=0?b++:b--){if(b===0||n[b-1]>a){k(b);break}d.push(void 0)}return d},this.el.mousemove(function(a){return K(a.pageX)}),this.options.hideHover&&this.el.mouseout(function(a){return k(null)}),H=function(a){var b;return b=a.originalEvent.touches[0]||a.originalEvent.changedTouches[0],K(b.pageX),b},this.el.bind("touchstart",H),this.el.bind("touchmove",H),this.el.bind("touchend",H),k(this.options.hideHover?null:0)},c.prototype.createPath=function(b,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s;n="";if(this.options.smooth){i=this.gradients(b);for(j=0,s=b.length-1;0<=s?j<=s:j>=s;0<=s?j++:j--)g=b[j],j===0?n+="M"+g.x+","+g.y:(h=i[j],l=b[j-1],m=i[j-1],k=(g.x-l.x)/4,o=l.x+k,q=Math.min(e,l.y+k*m),p=g.x-k,r=Math.min(e,g.y-k*h),n+="C"+o+","+q+","+p+","+r+","+g.x+","+g.y)}else n="M"+a.map(b,function(a){return""+a.x+","+a.y}).join("L");return n},c.prototype.gradients=function(b){return a.map(b,function(a,c){return c===0?(b[1].y-a.y)/(b[1].x-a.x):c===b.length-1?(a.y-b[c-1].y)/(a.x-b[c-1].x):(b[c+1].y-b[c-1].y)/(b[c+1].x-b[c-1].x)})},c.prototype.measureText=function(a,b){var c,d;return b==null&&(b=12),d=this.r.text(100,100,a).attr("font-size",b),c=d.getBBox(),d.remove(),c},c.prototype.parseYear=function(a){var b,c,d,e,f,g,h,i,j,k,l,m;return h=a.toString(),c=h.match(/^(\d+) Q(\d)$/),e=h.match(/^(\d+)-(\d+)$/),f=h.match(/^(\d+)-(\d+)-(\d+)$/),g=h.match(/^(\d+) W(\d+)$/),c?parseInt(c[1],10)+(parseInt(c[2],10)*3-1)/12:g?(m=parseInt(g[1],10),k=new Date(m,0,1),l=new Date(m+1,0,1),k.getDay()!==4&&k.setMonth(0,1+(4-k.getDay()+7)%7),l.getDay()!==4&&l.setMonth(0,1+(4-l.getDay()+7)%7),j=Math.ceil((l-k)/6048e5),parseInt(g[1],10)+(parseInt(g[2],10)-1)/j):e?parseInt(e[1],10)+(parseInt(e[2],10)-1)/12:f?(m=parseInt(f[1],10),d=parseInt(f[2],10),b=parseInt(f[3],10),i=(new Date(m,d-1,b)).getTime(),k=(new Date(m,0,1)).getTime(),l=(new Date(m+1,0,1)).getTime(),m+(i-k)/(l-k)):parseInt(a,10)},c.prototype.commas=function(a){var b;return b=a<0?"-":"",b+Math.abs(a).toFixed(0).replace(/(?=(?:\d{3})+$)(?!^)/g,",")},c}(),window.Morris=b})).call(this); \ No newline at end of file