From: Dan Vanderkam Date: Tue, 26 Jan 2010 08:50:55 +0000 (-0800) Subject: Fix issue #65 X-Git-Tag: v1.0.0~750 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=93dfacfda12a171edd804adf15c9f2f09bb96702;p=dygraphs.git Fix issue #65 --- diff --git a/dygraph.js b/dygraph.js index d187aa9..30bb7e6 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1290,6 +1290,8 @@ Dygraph.prototype.drawGraph_ = function(data) { } else { // Add some padding and round up to an integer to be human-friendly. var span = maxY - minY; + // special case: if we have no sense of scale, use +/-10% of the sole value. + if (span == 0) { span = maxY; } var maxAxisY = maxY + 0.1 * span; var minAxisY = minY - 0.1 * span; diff --git a/tests/no-range.html b/tests/no-range.html new file mode 100644 index 0000000..ba31dc1 --- /dev/null +++ b/tests/no-range.html @@ -0,0 +1,19 @@ + + + no range + + + + + + +
+ + +