Ensure @width / @height are positive.

This commit is contained in:
Olly Smith 2013-03-14 21:43:59 +00:00
parent cb854c0086
commit 4ecffd8d77

View File

@ -203,8 +203,8 @@ class Morris.Grid extends Morris.EventEmitter
@measureText(@yAxisFormat(@ymax), @options.gridTextSize).width)
@left += maxYLabelWidth
@bottom -= 1.5 * @options.gridTextSize
@width = @right - @left
@height = @bottom - @top
@width = Math.max(1, @right - @left)
@height = Math.max(1, @bottom - @top)
@dx = @width / (@xmax - @xmin)
@dy = @height / (@ymax - @ymin)
@calc() if @calc