This commit is contained in:
Olly Smith 2012-08-17 13:23:59 +01:00
parent eacbc01149
commit 8d7522a2f0
3 changed files with 17 additions and 1 deletions

View File

@ -144,12 +144,20 @@ class Morris.Line
@ymax = Math.max parseInt(@options.ymax[5..], 10), ymax
else
@ymax = ymax
else if typeof @options.ymax is 'string'
@ymax = parseInt(@options.ymax, 10)
else
@ymax = @options.ymax
if typeof @options.ymin is 'string' and @options.ymin[0..3] is 'auto'
ymin = Math.min.apply null, Array.prototype.concat.apply([], @series)
if @options.ymin.length > 5
@ymin = Math.min parseInt(@options.ymin[5..], 10), ymin
else
@ymin = ymin
else if typeof @options.ymin is 'string'
@ymin = parseInt(@options.ymin, 10)
else
@ymin = @options.ymin
if @ymin is @ymax
@ymin -= 1
@ymax += 1

View File

@ -175,6 +175,10 @@
} else {
this.ymax = ymax;
}
} else if (typeof this.options.ymax === 'string') {
this.ymax = parseInt(this.options.ymax, 10);
} else {
this.ymax = this.options.ymax;
}
if (typeof this.options.ymin === 'string' && this.options.ymin.slice(0, 4) === 'auto') {
ymin = Math.min.apply(null, Array.prototype.concat.apply([], this.series));
@ -183,6 +187,10 @@
} else {
this.ymin = ymin;
}
} else if (typeof this.options.ymin === 'string') {
this.ymin = parseInt(this.options.ymin, 10);
} else {
this.ymin = this.options.ymin;
}
if (this.ymin === this.ymax) {
this.ymin -= 1;

2
morris.min.js vendored

File diff suppressed because one or more lines are too long