From 4ecffd8d773f0928fbae9723ac5f8978f568d925 Mon Sep 17 00:00:00 2001 From: Olly Smith Date: Thu, 14 Mar 2013 21:43:59 +0000 Subject: [PATCH] Ensure @width / @height are positive. --- lib/morris.grid.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/morris.grid.coffee b/lib/morris.grid.coffee index a07f5e3..ef5204a 100644 --- a/lib/morris.grid.coffee +++ b/lib/morris.grid.coffee @@ -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