mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-11-11 05:46:37 +01:00
Merge branch 'feature/coffee_idioms' of https://github.com/sudodoki/morris.js into sudodoki-feature/coffee_idioms
Conflicts: lib/morris.grid.coffee
This commit is contained in:
commit
6422b543be
@ -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
|
||||
#
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user