From: Robert Konigsberg Date: Thu, 27 Jan 2011 22:56:20 +0000 (-0500) Subject: Log scale graphs no longer show points with values less than zero. X-Git-Tag: v1.0.0~587^2~12^2~10 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=6e6a2b0a85d2d34deb4fcecc2b8a32f6eb91a964;p=dygraphs.git Log scale graphs no longer show points with values less than zero. --- diff --git a/dygraph.js b/dygraph.js index ccc79b7..0390a6f 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2136,12 +2136,24 @@ Dygraph.prototype.drawGraph_ = function() { var seriesName = this.attr_("labels")[i]; var connectSeparatedPoints = this.attr_('connectSeparatedPoints', i); + var logScale = this.attr_('logscale', i); var series = []; for (var j = 0; j < data.length; j++) { - if (data[j][i] != null || !connectSeparatedPoints) { - var date = data[j][0]; - series.push([date, data[j][i]]); + var date = data[j][0]; + var point = data[j][i]; + if (logScale) { + // On the log scale, points less than zero do not exist. + // This will create a gap in the chart. Note that this ignores + // connectSeparatedPoints. + if (point < 0) { + point = null; + } + series.push([date, point]); + } else { + if (point != null || !connectSeparatedPoints) { + series.push([date, point]); + } } } diff --git a/tests/logscale-zero.html b/tests/logscale-zero.html new file mode 100644 index 0000000..4eb83b3 --- /dev/null +++ b/tests/logscale-zero.html @@ -0,0 +1,45 @@ + + + log scale + + + + + + + + +

Log scale demo - work in progress

+
+ + + + + + +