@@ -21,11 +21,6 @@ class Morris.Grid extends Morris.EventEmitter
21
21
if typeof @options .units is ' string'
22
22
@options .postUnits = options .units
23
23
24
- # backwards compatibility for axes -> xaxis, yaxis
25
- if @options .axes is false
26
- @options .xaxis = false
27
- @options .yaxis = false
28
-
29
24
# the raphael drawing instance
30
25
@raphael = new Raphael (@el [0 ])
31
26
@@ -64,8 +59,7 @@ class Morris.Grid extends Morris.EventEmitter
64
59
#
65
60
gridDefaults :
66
61
dateFormat : null
67
- xaxis : true
68
- yaxis : true
62
+ axes : true
69
63
grid : true
70
64
gridLineColor : ' #aaa'
71
65
gridStrokeWidth : 0.5
@@ -178,7 +172,7 @@ class Morris.Grid extends Morris.EventEmitter
178
172
@ymin -= 1 if ymin
179
173
@ymax += 1
180
174
181
- if @options .yaxis is true or @options .grid is true
175
+ if @options .axes in [ true , ' both ' , ' y ' ] or @options .grid is true
182
176
if (@options .ymax == @gridDefaults .ymax and
183
177
@options .ymin == @gridDefaults .ymin )
184
178
# calculate 'magic' grid placement
@@ -247,11 +241,11 @@ class Morris.Grid extends Morris.EventEmitter
247
241
@right = @elementWidth - @options .padding
248
242
@top = @options .padding
249
243
@bottom = @elementHeight - @options .padding
250
- if @options .yaxis
244
+ if @options .axes in [ true , ' both ' , ' y ' ]
251
245
yLabelWidths = for gridLine in @grid
252
246
@ measureText (@ yAxisFormat (gridLine)).width
253
247
@left += Math .max (yLabelWidths... )
254
- if @options .xaxis
248
+ if @options .axes in [ true , ' both ' , ' x ' ]
255
249
bottomOffsets = for i in [0 ... @data .length ]
256
250
@ measureText (@data [i].text , - @options .xLabelAngle ).height
257
251
@bottom -= Math .max (bottomOffsets... )
@@ -314,10 +308,10 @@ class Morris.Grid extends Morris.EventEmitter
314
308
# draw y axis labels, horizontal lines
315
309
#
316
310
drawGrid : ->
317
- return if @options .grid is false and @options .yaxis is false
311
+ return if @options .grid is false and @options .axes not in [ true , ' both ' , ' y ' ]
318
312
for lineY in @grid
319
313
y = @ transY (lineY)
320
- if @options .yaxis
314
+ if @options .axes in [ true , ' both ' , ' y ' ]
321
315
@ drawYAxisLabel (@left - @options .padding / 2 , y, @ yAxisFormat (lineY))
322
316
if @options .grid
323
317
@ drawGridLine (" M#{ @left } ,#{ y} H#{ @left + @width } " )
0 commit comments