Skip to content

Commit

Permalink
Merge branch 'feature/coffee_idioms' of https://github.com/sudodoki/m…
Browse files Browse the repository at this point in the history
…orris.js into sudodoki-feature/coffee_idioms

Conflicts:
	lib/morris.grid.coffee
  • Loading branch information
oesmith committed Nov 9, 2013
2 parents 221c837 + 9162df9 commit 6422b54
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/morris.area.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
8 changes: 3 additions & 5 deletions lib/morris.donut.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/morris.grid.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/morris.line.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down

0 comments on commit 6422b54

Please sign in to comment.