Fix defaults check.

This commit is contained in:
Olly Smith 2013-04-01 21:41:13 +01:00
parent 5d9bf447c5
commit 347533c8dd
3 changed files with 6 additions and 6 deletions

View File

@ -165,7 +165,8 @@ class Morris.Grid extends Morris.EventEmitter
@ymax += 1 @ymax += 1
if @options.axes is true or @options.grid is true if @options.axes is true or @options.grid is true
if @options.ymax == @defaults.ymax and @options.ymin == @defaults.ymin if (@options.ymax == @gridDefaults.ymax and
@options.ymin == @gridDefaults.ymin)
# calculate 'magic' grid placement # calculate 'magic' grid placement
@grid = @autoGridLines(@ymin, @ymax, @options.numLines) @grid = @autoGridLines(@ymin, @ymax, @options.numLines)
@ymin = Math.min(@ymin, @grid[0]) @ymin = Math.min(@ymin, @grid[0])

View File

@ -253,7 +253,7 @@
this.ymax += 1; this.ymax += 1;
} }
if (this.options.axes === true || this.options.grid === true) { if (this.options.axes === true || this.options.grid === true) {
if (this.options.ymax === this.defaults.ymax && this.options.ymin === this.defaults.ymin) { if (this.options.ymax === this.gridDefaults.ymax && this.options.ymin === this.gridDefaults.ymin) {
this.grid = this.autoGridLines(this.ymin, this.ymax, this.options.numLines); this.grid = this.autoGridLines(this.ymin, this.ymax, this.options.numLines);
this.ymin = Math.min(this.ymin, this.grid[0]); this.ymin = Math.min(this.ymin, this.grid[0]);
this.ymax = Math.max(this.ymax, this.grid[this.grid.length - 1]); this.ymax = Math.max(this.ymax, this.grid[this.grid.length - 1]);
@ -1528,7 +1528,7 @@
for (i = _j = 0, _len1 = _ref1.length; _j < _len1; i = ++_j) { for (i = _j = 0, _len1 = _ref1.length; _j < _len1; i = ++_j) {
value = _ref1[i]; value = _ref1[i];
next = last + min + C * (value / total); next = last + min + C * (value / total);
seg = new Morris.DonutSegment(cx, cy, w * 2, w, last, next, this.options.colors[idx % this.options.colors.length], this.options.backgroundColor, this.data[i], idx, this.raphael); seg = new Morris.DonutSegment(cx, cy, w * 2, w, last, next, this.options.colors[idx % this.options.colors.length], this.options.backgroundColor, idx, this.raphael);
seg.render(); seg.render();
this.segments.push(seg); this.segments.push(seg);
seg.on('hover', this.select); seg.on('hover', this.select);
@ -1628,14 +1628,13 @@
__extends(DonutSegment, _super); __extends(DonutSegment, _super);
function DonutSegment(cx, cy, inner, outer, p0, p1, color, backgroundColor, data, index, raphael) { function DonutSegment(cx, cy, inner, outer, p0, p1, color, backgroundColor, index, raphael) {
this.cx = cx; this.cx = cx;
this.cy = cy; this.cy = cy;
this.inner = inner; this.inner = inner;
this.outer = outer; this.outer = outer;
this.color = color; this.color = color;
this.backgroundColor = backgroundColor; this.backgroundColor = backgroundColor;
this.data = data;
this.index = index; this.index = index;
this.raphael = raphael; this.raphael = raphael;
this.deselect = __bind(this.deselect, this); this.deselect = __bind(this.deselect, this);

2
morris.min.js vendored

File diff suppressed because one or more lines are too long