Don't go negative on ymin if ymin==ymax==0 (fix #80).

This commit is contained in:
Olly Smith 2012-09-26 21:29:42 +01:00
parent 088233d8d2
commit e0b406feee
3 changed files with 5 additions and 3 deletions

View File

@ -153,7 +153,7 @@ class Morris.Line
else else
@ymin = @options.ymin @ymin = @options.ymin
if @ymin is @ymax if @ymin is @ymax
@ymin -= 1 if @ymin is not 0 then @ymin -= 1
@ymax += 1 @ymax += 1
@yInterval = (@ymax - @ymin) / (@options.numLines - 1) @yInterval = (@ymax - @ymin) / (@options.numLines - 1)

View File

@ -464,7 +464,9 @@
this.ymin = this.options.ymin; this.ymin = this.options.ymin;
} }
if (this.ymin === this.ymax) { if (this.ymin === this.ymax) {
this.ymin -= 1; if (this.ymin === !0) {
this.ymin -= 1;
}
this.ymax += 1; this.ymax += 1;
} }
this.yInterval = (this.ymax - this.ymin) / (this.options.numLines - 1); this.yInterval = (this.ymax - this.ymin) / (this.options.numLines - 1);

2
morris.min.js vendored

File diff suppressed because one or more lines are too long