Skip to content
Browse files

add option to set maximum y value

  • Loading branch information...
1 parent 738f53e commit 3b4934003efecdc1475c82cf18f5f39c5fa02140 @thedjinn committed Feb 28, 2012
Showing with 20 additions and 14 deletions.
  1. +9 −6 morris.coffee
  2. +10 −7 morris.js
  3. +1 −1 morris.min.js
View
15 morris.coffee
@@ -31,6 +31,7 @@ class Morris.Line
'#cb4b4b'
'#9440ed'
]
+ ymax: 'auto'
marginTop: 25
marginRight: 25
marginBottom: 30
@@ -71,9 +72,11 @@ class Morris.Line
@xmin -= 1
@xmax += 1
- # use $.map to flatten arrays and find the max y value
- all_y_vals = $.map @series, (x) -> Math.max.apply null, x
- @ymax = Math.max(20, Math.max.apply(null, all_y_vals))
+ # Compute the vertical range of the graph if desired
+ if @options.ymax == 'auto'
+ # use $.map to flatten arrays and find the max y value
+ all_y_vals = $.map @series, (x) -> Math.max.apply null, x
+ @options.ymax = Math.max(20, Math.max.apply(null, all_y_vals))
# Clear and redraw the graph
#
@@ -85,11 +88,11 @@ class Morris.Line
@r = new Raphael(@el[0])
# calculate grid dimensions
- left = @measureText(@ymax, @options.gridTextSize).width + @options.marginLeft
+ left = @measureText(@options.ymax, @options.gridTextSize).width + @options.marginLeft
width = @el.width() - left - @options.marginRight
height = @el.height() - @options.marginTop - @options.marginBottom
dx = width / (@xmax - @xmin)
- dy = height / @ymax
+ dy = height / @options.ymax
# quick translation helpers
transX = (x) =>
@@ -104,7 +107,7 @@ class Morris.Line
lineInterval = height / (@options.numLines - 1)
for i in [0..@options.numLines-1]
y = @options.marginTop + i * lineInterval
- v = Math.round((@options.numLines - 1 - i) * @ymax / (@options.numLines - 1))
+ v = Math.round((@options.numLines - 1 - i) * @options.ymax / (@options.numLines - 1))
@r.text(left - @options.marginLeft/2, y, v)
.attr('font-size', @options.gridTextSize)
.attr('fill', @options.gridTextColor)
View
17 morris.js
@@ -19,6 +19,7 @@
lineWidth: 3,
pointSize: 4,
lineColors: ['#0b62a4', '#7A92A3', '#4da74d', '#afd8f8', '#edc240', '#cb4b4b', '#9440ed'],
+ ymax: 'auto',
marginTop: 25,
marginRight: 25,
marginBottom: 30,
@@ -63,22 +64,24 @@
this.xmin -= 1;
this.xmax += 1;
}
- all_y_vals = $.map(this.series, function(x) {
- return Math.max.apply(null, x);
- });
- return this.ymax = Math.max(20, Math.max.apply(null, all_y_vals));
+ if (this.options.ymax === 'auto') {
+ all_y_vals = $.map(this.series, function(x) {
+ return Math.max.apply(null, x);
+ });
+ return this.options.ymax = Math.max(20, Math.max.apply(null, all_y_vals));
+ }
};
Line.prototype.redraw = function() {
var c, circle, columns, coords, dx, dy, height, hideHover, hilight, hover, hoverHeight, hoverMargins, hoverSet, i, label, labelBox, left, lineInterval, path, pointGrow, pointShrink, prevHilight, prevLabelMargin, s, seriesCoords, seriesPoints, touchHandler, transX, transY, updateHilight, updateHover, v, width, x, xLabel, xLabelMargin, y, yLabel, yLabels, _i, _j, _len, _len2, _ref, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
_this = this;
this.el.empty();
this.r = new Raphael(this.el[0]);
- left = this.measureText(this.ymax, this.options.gridTextSize).width + this.options.marginLeft;
+ left = this.measureText(this.options.ymax, this.options.gridTextSize).width + this.options.marginLeft;
width = this.el.width() - left - this.options.marginRight;
height = this.el.height() - this.options.marginTop - this.options.marginBottom;
dx = width / (this.xmax - this.xmin);
- dy = height / this.ymax;
+ dy = height / this.options.ymax;
transX = function(x) {
if (_this.xvals.length === 1) {
return left + width / 2;
@@ -92,7 +95,7 @@
lineInterval = height / (this.options.numLines - 1);
for (i = 0, _ref = this.options.numLines - 1; 0 <= _ref ? i <= _ref : i >= _ref; 0 <= _ref ? i++ : i--) {
y = this.options.marginTop + i * lineInterval;
- v = Math.round((this.options.numLines - 1 - i) * this.ymax / (this.options.numLines - 1));
+ v = Math.round((this.options.numLines - 1 - i) * this.options.ymax / (this.options.numLines - 1));
this.r.text(left - this.options.marginLeft / 2, y, v).attr('font-size', this.options.gridTextSize).attr('fill', this.options.gridTextColor).attr('text-anchor', 'end');
this.r.path("M" + left + "," + y + 'H' + (left + width)).attr('stroke', this.options.gridLineColor).attr('stroke-width', this.options.gridStrokeWidth);
}
View
2 morris.min.js
@@ -1 +1 @@
-((function(){var a;a={},a.Line=function(){function b(b){if(!(this instanceof a.Line))return new a.Line(b);this.el=$(document.getElementById(b.element)),this.options=$.extend(this.defaults,b);if(this.options.data===void 0||this.options.data.length===0)return;this.el.addClass("graph-initialised"),this.precalc(),this.redraw()}return b.prototype.defaults={lineWidth:3,pointSize:4,lineColors:["#0b62a4","#7A92A3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],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},b.prototype.precalc=function(){var a,b,c,d,e,f=this;this.columnLabels=$.map(this.options.data,function(a){return a[f.options.xkey]}),this.seriesLabels=this.options.labels,this.series=[],e=this.options.ykeys;for(c=0,d=e.length;c<d;c++)b=e[c],this.series.push($.map(this.options.data,function(a){return a[b]}));return this.xvals=$.map(this.columnLabels,function(a){return f.parseYear(a)}),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),a=$.map(this.series,function(a){return Math.max.apply(null,a)}),this.ymax=Math.max(20,Math.max.apply(null,a))},b.prototype.redraw=function(){var 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,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=this;this.el.empty(),this.r=new Raphael(this.el[0]),q=this.measureText(this.ymax,this.options.gridTextSize).width+this.options.marginLeft,G=this.el.width()-q-this.options.marginRight,g=this.el.height()-this.options.marginTop-this.options.marginBottom,e=G/(this.xmax-this.xmin),f=g/this.ymax,B=function(a){return Z.xvals.length===1?q+G/2:q+(a-Z.xmin)*e},C=function(a){return Z.options.marginTop+g-a*f},r=g/(this.options.numLines-1);for(n=0,R=this.options.numLines-1;0<=R?n<=R:n>=R;0<=R?n++:n--)K=this.options.marginTop+n*r,F=Math.round((this.options.numLines-1-n)*this.ymax/(this.options.numLines-1)),this.r.text(q-this.options.marginLeft/2,K,F).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor).attr("text-anchor","end"),this.r.path("M"+q+","+K+"H"+(q+G)).attr("stroke",this.options.gridLineColor).attr("stroke-width",this.options.gridStrokeWidth);w=null,J=50;for(n=S=Math.ceil(this.xmin),T=Math.floor(this.xmax);S<=T?n<=T:n>=T;S<=T?n++:n--)o=this.r.text(B(n),this.options.marginTop+g+this.options.marginBottom/2,n).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor),p=o.getBBox(),w===null||w<=p.x?w=p.x+p.width+J:o.remove();c=function(){var a,b,c,d;c=this.xvals,d=[];for(a=0,b=c.length;a<b;a++)H=c[a],d.push(B(H));return d}.call(this),y=[],U=this.series;for(N=0,P=U.length;N<P;N++)x=U[N],y.push($.map(x,function(a,b){return{x:c[b],y:C(a)}}));for(n=V=y.length-1;V<=0?n<=0:n>=0;V<=0?n++:n--)d=y[n],d.length>1&&(s=this.createPath(d,this.options.marginTop,q,this.options.marginTop+g,q+G),this.r.path(s).attr("stroke",this.options.lineColors[n]).attr("stroke-width",this.options.lineWidth));z=function(){var a,b;b=[];for(n=0,a=y.length-1;0<=a?n<=a:n>=a;0<=a?n++:n--)b.push([]);return b}();for(n=W=y.length-1;W<=0?n<=0:n>=0;W<=0?n++:n--){X=y[n];for(O=0,Q=X.length;O<Q;O++)a=X[O],b=this.r.circle(a.x,a.y,this.options.pointSize).attr("fill",this.options.lineColors[n]).attr("stroke-width",1).attr("stroke","#ffffff"),z[n].push(b)}k=this.options.hoverFontSize*1.5*(this.series.length+1),j=this.r.rect(-10,-k/2-this.options.hoverPaddingY,20,k+this.options.hoverPaddingY*2,10).attr("fill",this.options.hoverFillColor).attr("stroke",this.options.hoverBorderColor).attr("stroke-width",this.options.hoverBorderWidth).attr("opacity",this.options.hoverOpacity),I=this.r.text(0,this.options.hoverFontSize*.75-k/2,"").attr("fill",this.options.hoverLabelColor).attr("font-weight","bold").attr("font-size",this.options.hoverFontSize),m=this.r.set(),m.push(j),m.push(I),M=[];for(n=0,Y=this.series.length-1;0<=Y?n<=Y:n>=Y;0<=Y?n++:n--)L=this.r.text(0,this.options.hoverFontSize*1.5*(n+1.5)-k/2,"").attr("fill",this.options.lineColors[n]).attr("font-size",this.options.hoverFontSize),M.push(L),m.push(L);return E=function(a){var b,d,e,f,h;m.show(),I.attr("text",Z.columnLabels[a]);for(b=0,h=Z.series.length-1;0<=h?b<=h:b>=h;0<=h?b++:b--)M[b].attr("text",""+Z.seriesLabels[b]+": "+Z.commas(Z.series[b][a]));return d=Math.max.apply(null,$.map(M,function(a){return a.getBBox().width})),d=Math.max(d,I.getBBox().width),j.attr("width",d+Z.options.hoverPaddingX*2),j.attr("x",-Z.options.hoverPaddingX-d/2),f=Math.min.apply(null,$.map(Z.series,function(b){return C(b[a])})),f>k+Z.options.hoverPaddingY*2+Z.options.hoverMargin+Z.options.marginTop?f=f-k/2-Z.options.hoverPaddingY-Z.options.hoverMargin:f=f+k/2+Z.options.hoverPaddingY+Z.options.hoverMargin,f=Math.max(Z.options.marginTop+k/2+Z.options.hoverPaddingY,f),f=Math.min(Z.options.marginTop+g-k/2-Z.options.hoverPaddingY,f),e=Math.min(q+G-d/2-Z.options.hoverPaddingX,c[a]),e=Math.max(q+d/2+Z.options.hoverPaddingX,e),m.attr("transform","t"+e+","+f)},h=function(){return m.hide()},l=$.map(c.slice(1),function(a,b){return(a+c[b])/2}),v=null,t=Raphael.animation({r:this.options.pointSize+3},25,"linear"),u=Raphael.animation({r:this.options.pointSize},25,"linear"),i=function(a){var b,c,d;if(v!==null&&v!==a)for(b=0,d=z.length-1;0<=d?b<=d:b>=d;0<=d?b++:b--)z[b][v].animate(u);if(a!==null&&v!==a){for(b=0,c=z.length-1;0<=c?b<=c:b>=c;0<=c?b++:b--)z[b][a].animate(t);E(a)}v=a;if(a===null)return h()},D=function(a){var b,c;a-=Z.el.offset().left;for(b=c=l.length;c<=1?b<=1:b>=1;c<=1?b++:b--)if(l[b-1]>a)break;return i(b)},this.el.mousemove(function(a){return D(a.pageX)}),A=function(a){var b;return b=a.originalEvent.touches[0]||a.originalEvent.changedTouches[0],D(b.pageX),b},this.el.bind("touchstart",A),this.el.bind("touchmove",A),this.el.bind("touchend",A),i(0)},b.prototype.createPath=function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r;m="",h=this.gradients(a);for(i=0,r=a.length-1;0<=r?i<=r:i>=r;0<=r?i++:i--)f=a[i],i===0?m+="M"+f.x+","+f.y:(g=h[i],k=a[i-1],l=h[i-1],j=(f.x-k.x)/4,n=k.x+j,p=Math.min(d,k.y+j*l),o=f.x-j,q=Math.min(d,f.y-j*g),m+="C"+n+","+p+","+o+","+q+","+f.x+","+f.y);return m},b.prototype.gradients=function(a){return $.map(a,function(b,c){return c===0?(a[1].y-b.y)/(a[1].x-b.x):c===a.length-1?(b.y-a[c-1].y)/(b.x-a[c-1].x):(a[c+1].y-a[c-1].y)/(a[c+1].x-a[c-1].x)})},b.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},b.prototype.parseYear=function(a){var b,c,d,e,f,g,h,i,j,k;return g=a.toString(),c=g.match(/^(\d+) Q(\d)$/),e=g.match(/^(\d+)-(\d+)$/),f=g.match(/^(\d+)-(\d+)-(\d+)$/),c?parseInt(c[1],10)+(parseInt(c[2],10)*3-1)/12:e?parseInt(e[1],10)+(parseInt(e[2],10)-1)/12:f?(k=parseInt(f[1],10),d=parseInt(f[2],10),b=parseInt(f[3],10),h=(new Date(k,d-1,b)).getTime(),i=(new Date(k,0,1)).getTime(),j=(new Date(k+1,0,1)).getTime(),k+(h-i)/(j-i)):parseInt(a,10)},b.prototype.commas=function(a){return Math.max(0,a).toFixed(0).replace(/(?=(?:\d{3})+$)(?!^)/g,",")},b}(),window.Morris=a})).call(this);
+((function(){var a;a={},a.Line=function(){function b(b){if(!(this instanceof a.Line))return new a.Line(b);this.el=$(document.getElementById(b.element)),this.options=$.extend(this.defaults,b);if(this.options.data===void 0||this.options.data.length===0)return;this.el.addClass("graph-initialised"),this.precalc(),this.redraw()}return b.prototype.defaults={lineWidth:3,pointSize:4,lineColors:["#0b62a4","#7A92A3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],ymax:"auto",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},b.prototype.precalc=function(){var a,b,c,d,e,f=this;this.columnLabels=$.map(this.options.data,function(a){return a[f.options.xkey]}),this.seriesLabels=this.options.labels,this.series=[],e=this.options.ykeys;for(c=0,d=e.length;c<d;c++)b=e[c],this.series.push($.map(this.options.data,function(a){return a[b]}));this.xvals=$.map(this.columnLabels,function(a){return f.parseYear(a)}),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);if(this.options.ymax==="auto")return a=$.map(this.series,function(a){return Math.max.apply(null,a)}),this.options.ymax=Math.max(20,Math.max.apply(null,a))},b.prototype.redraw=function(){var 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,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=this;this.el.empty(),this.r=new Raphael(this.el[0]),q=this.measureText(this.options.ymax,this.options.gridTextSize).width+this.options.marginLeft,G=this.el.width()-q-this.options.marginRight,g=this.el.height()-this.options.marginTop-this.options.marginBottom,e=G/(this.xmax-this.xmin),f=g/this.options.ymax,B=function(a){return Z.xvals.length===1?q+G/2:q+(a-Z.xmin)*e},C=function(a){return Z.options.marginTop+g-a*f},r=g/(this.options.numLines-1);for(n=0,R=this.options.numLines-1;0<=R?n<=R:n>=R;0<=R?n++:n--)K=this.options.marginTop+n*r,F=Math.round((this.options.numLines-1-n)*this.options.ymax/(this.options.numLines-1)),this.r.text(q-this.options.marginLeft/2,K,F).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor).attr("text-anchor","end"),this.r.path("M"+q+","+K+"H"+(q+G)).attr("stroke",this.options.gridLineColor).attr("stroke-width",this.options.gridStrokeWidth);w=null,J=50;for(n=S=Math.ceil(this.xmin),T=Math.floor(this.xmax);S<=T?n<=T:n>=T;S<=T?n++:n--)o=this.r.text(B(n),this.options.marginTop+g+this.options.marginBottom/2,n).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor),p=o.getBBox(),w===null||w<=p.x?w=p.x+p.width+J:o.remove();c=function(){var a,b,c,d;c=this.xvals,d=[];for(a=0,b=c.length;a<b;a++)H=c[a],d.push(B(H));return d}.call(this),y=[],U=this.series;for(N=0,P=U.length;N<P;N++)x=U[N],y.push($.map(x,function(a,b){return{x:c[b],y:C(a)}}));for(n=V=y.length-1;V<=0?n<=0:n>=0;V<=0?n++:n--)d=y[n],d.length>1&&(s=this.createPath(d,this.options.marginTop,q,this.options.marginTop+g,q+G),this.r.path(s).attr("stroke",this.options.lineColors[n]).attr("stroke-width",this.options.lineWidth));z=function(){var a,b;b=[];for(n=0,a=y.length-1;0<=a?n<=a:n>=a;0<=a?n++:n--)b.push([]);return b}();for(n=W=y.length-1;W<=0?n<=0:n>=0;W<=0?n++:n--){X=y[n];for(O=0,Q=X.length;O<Q;O++)a=X[O],b=this.r.circle(a.x,a.y,this.options.pointSize).attr("fill",this.options.lineColors[n]).attr("stroke-width",1).attr("stroke","#ffffff"),z[n].push(b)}k=this.options.hoverFontSize*1.5*(this.series.length+1),j=this.r.rect(-10,-k/2-this.options.hoverPaddingY,20,k+this.options.hoverPaddingY*2,10).attr("fill",this.options.hoverFillColor).attr("stroke",this.options.hoverBorderColor).attr("stroke-width",this.options.hoverBorderWidth).attr("opacity",this.options.hoverOpacity),I=this.r.text(0,this.options.hoverFontSize*.75-k/2,"").attr("fill",this.options.hoverLabelColor).attr("font-weight","bold").attr("font-size",this.options.hoverFontSize),m=this.r.set(),m.push(j),m.push(I),M=[];for(n=0,Y=this.series.length-1;0<=Y?n<=Y:n>=Y;0<=Y?n++:n--)L=this.r.text(0,this.options.hoverFontSize*1.5*(n+1.5)-k/2,"").attr("fill",this.options.lineColors[n]).attr("font-size",this.options.hoverFontSize),M.push(L),m.push(L);return E=function(a){var b,d,e,f,h;m.show(),I.attr("text",Z.columnLabels[a]);for(b=0,h=Z.series.length-1;0<=h?b<=h:b>=h;0<=h?b++:b--)M[b].attr("text",""+Z.seriesLabels[b]+": "+Z.commas(Z.series[b][a]));return d=Math.max.apply(null,$.map(M,function(a){return a.getBBox().width})),d=Math.max(d,I.getBBox().width),j.attr("width",d+Z.options.hoverPaddingX*2),j.attr("x",-Z.options.hoverPaddingX-d/2),f=Math.min.apply(null,$.map(Z.series,function(b){return C(b[a])})),f>k+Z.options.hoverPaddingY*2+Z.options.hoverMargin+Z.options.marginTop?f=f-k/2-Z.options.hoverPaddingY-Z.options.hoverMargin:f=f+k/2+Z.options.hoverPaddingY+Z.options.hoverMargin,f=Math.max(Z.options.marginTop+k/2+Z.options.hoverPaddingY,f),f=Math.min(Z.options.marginTop+g-k/2-Z.options.hoverPaddingY,f),e=Math.min(q+G-d/2-Z.options.hoverPaddingX,c[a]),e=Math.max(q+d/2+Z.options.hoverPaddingX,e),m.attr("transform","t"+e+","+f)},h=function(){return m.hide()},l=$.map(c.slice(1),function(a,b){return(a+c[b])/2}),v=null,t=Raphael.animation({r:this.options.pointSize+3},25,"linear"),u=Raphael.animation({r:this.options.pointSize},25,"linear"),i=function(a){var b,c,d;if(v!==null&&v!==a)for(b=0,d=z.length-1;0<=d?b<=d:b>=d;0<=d?b++:b--)z[b][v].animate(u);if(a!==null&&v!==a){for(b=0,c=z.length-1;0<=c?b<=c:b>=c;0<=c?b++:b--)z[b][a].animate(t);E(a)}v=a;if(a===null)return h()},D=function(a){var b,c;a-=Z.el.offset().left;for(b=c=l.length;c<=1?b<=1:b>=1;c<=1?b++:b--)if(l[b-1]>a)break;return i(b)},this.el.mousemove(function(a){return D(a.pageX)}),A=function(a){var b;return b=a.originalEvent.touches[0]||a.originalEvent.changedTouches[0],D(b.pageX),b},this.el.bind("touchstart",A),this.el.bind("touchmove",A),this.el.bind("touchend",A),i(0)},b.prototype.createPath=function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r;m="",h=this.gradients(a);for(i=0,r=a.length-1;0<=r?i<=r:i>=r;0<=r?i++:i--)f=a[i],i===0?m+="M"+f.x+","+f.y:(g=h[i],k=a[i-1],l=h[i-1],j=(f.x-k.x)/4,n=k.x+j,p=Math.min(d,k.y+j*l),o=f.x-j,q=Math.min(d,f.y-j*g),m+="C"+n+","+p+","+o+","+q+","+f.x+","+f.y);return m},b.prototype.gradients=function(a){return $.map(a,function(b,c){return c===0?(a[1].y-b.y)/(a[1].x-b.x):c===a.length-1?(b.y-a[c-1].y)/(b.x-a[c-1].x):(a[c+1].y-a[c-1].y)/(a[c+1].x-a[c-1].x)})},b.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},b.prototype.parseYear=function(a){var b,c,d,e,f,g,h,i,j,k;return g=a.toString(),c=g.match(/^(\d+) Q(\d)$/),e=g.match(/^(\d+)-(\d+)$/),f=g.match(/^(\d+)-(\d+)-(\d+)$/),c?parseInt(c[1],10)+(parseInt(c[2],10)*3-1)/12:e?parseInt(e[1],10)+(parseInt(e[2],10)-1)/12:f?(k=parseInt(f[1],10),d=parseInt(f[2],10),b=parseInt(f[3],10),h=(new Date(k,d-1,b)).getTime(),i=(new Date(k,0,1)).getTime(),j=(new Date(k+1,0,1)).getTime(),k+(h-i)/(j-i)):parseInt(a,10)},b.prototype.commas=function(a){return Math.max(0,a).toFixed(0).replace(/(?=(?:\d{3})+$)(?!^)/g,",")},b}(),window.Morris=a})).call(this);

0 comments on commit 3b49340

Please sign in to comment.
Something went wrong with that request. Please try again.