From: Dan Vanderkam Date: Mon, 31 Jan 2011 15:55:05 +0000 (-0500) Subject: add comment to PREFERRED_LOG_TICK_VALUES X-Git-Tag: v1.0.0~587^2~11 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=c1bc242a0326dc48ee2de27321195090a3eb486a;p=dygraphs.git add comment to PREFERRED_LOG_TICK_VALUES --- diff --git a/dygraph.js b/dygraph.js index 8f69337..661ebfb 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1921,6 +1921,9 @@ Dygraph.dateTicker = function(startDate, endDate, self) { } }; +// This is a list of human-friendly values at which to show tick marks on a log +// scale. It is k * 10^n, where k=1..9 and n=-39..+39, so: +// ..., 1, 2, 3, 4, 5, ..., 9, 10, 20, 30, ..., 90, 100, 200, 300, ... Dygraph.PREFERRED_LOG_TICK_VALUES = function() { var vals = []; for (var power = -39; power <= 39; power++) { @@ -1966,7 +1969,7 @@ Dygraph.binarySearch = function(val, arry, abs, low, high) { return mid; } } - return Dygraph.binarySearch(val, arry, abs, low, mid - 1); + return Dygraph.binarySearch(val, arry, abs, low, mid - 1); } if (element < val) { if (abs < 0) { @@ -2036,7 +2039,7 @@ Dygraph.numericTicks = function(minV, maxV, self, axis_props, vals) { domCoord : domCoord }; } else { - tick.label = ""; + tick.label = ""; } } ticks.push(tick); @@ -2045,6 +2048,7 @@ Dygraph.numericTicks = function(minV, maxV, self, axis_props, vals) { ticks.reverse(); } } + // ticks.length won't be 0 if the log scale function finds values to insert. if (ticks.length == 0) { // Basic idea: