diff --git a/lib/morris.area.coffee b/lib/morris.area.coffee index 0e1cec5..b48d042 100644 --- a/lib/morris.area.coffee +++ b/lib/morris.area.coffee @@ -29,7 +29,7 @@ class Morris.Area extends Morris.Line else total += (y || 0) @transY(total) - row._ymax = Math.max.apply Math, row._y + row._ymax = Math.max row._y... # draw the data series # diff --git a/lib/morris.donut.coffee b/lib/morris.donut.coffee index eae05fc..e12fb8f 100644 --- a/lib/morris.donut.coffee +++ b/lib/morris.donut.coffee @@ -29,16 +29,14 @@ class Morris.Donut extends Morris.EventEmitter # Create and render a donut chart. # constructor: (options) -> - if not (this instanceof Morris.Donut) - return new Morris.Donut(options) + return new Morris.Donut(options) unless (@ instanceof Morris.Donut) + @options = $.extend {}, @defaults, options if typeof options.element is 'string' @el = $ document.getElementById(options.element) else @el = $ options.element - @options = $.extend {}, @defaults, options - if @el == null || @el.length == 0 throw new Error("Graph placeholder not found.") @@ -88,7 +86,7 @@ class Morris.Donut extends Morris.EventEmitter @text1 = @drawEmptyDonutLabel(cx, cy - 10, @options.labelColor, 15, 800) @text2 = @drawEmptyDonutLabel(cx, cy + 10, @options.labelColor, 14) - max_value = Math.max.apply(null, value for value in @values) + max_value = Math.max @values... idx = 0 for value in @values if value == max_value diff --git a/lib/morris.grid.coffee b/lib/morris.grid.coffee index 3c485a5..321b70a 100644 --- a/lib/morris.grid.coffee +++ b/lib/morris.grid.coffee @@ -139,8 +139,8 @@ class Morris.Grid extends Morris.EventEmitter ymin = if @cumulative then 0 else null if @options.goals.length > 0 - minGoal = Math.min.apply(null, @options.goals) - maxGoal = Math.max.apply(null, @options.goals) + minGoal = Math.min @options.goals... + maxGoal = Math.max @options.goals... ymin = if ymin? then Math.min(ymin, minGoal) else minGoal ymax = if ymax? then Math.max(ymax, maxGoal) else maxGoal @@ -191,8 +191,8 @@ class Morris.Grid extends Morris.EventEmitter @events = (Morris.parseDate(e) for e in @options.events) else @events = @options.events - @xmax = Math.max(@xmax, Math.max.apply(null, @events)) - @xmin = Math.min(@xmin, Math.min.apply(null, @events)) + @xmax = Math.max(@xmax, Math.max(@events...)) + @xmin = Math.min(@xmin, Math.min(@events...)) if @xmin is @xmax @xmin -= 1 diff --git a/lib/morris.line.coffee b/lib/morris.line.coffee index f12f808..c23dc0e 100644 --- a/lib/morris.line.coffee +++ b/lib/morris.line.coffee @@ -52,7 +52,7 @@ class Morris.Line extends Morris.Grid row._x = @transX(row.x) row._y = for y in row.y if y? then @transY(y) else y - row._ymax = Math.min.apply(null, [@bottom].concat(y for y in row._y when y?)) + row._ymax = Math.min [@bottom].concat(y for y in row._y when y?)... # hit test - returns the index of the row at the given x-coordinate #