X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=6bdb1433bea3233da61508d146a0af0e1351f979;hb=c0cef1fa7418206e16229e4ae201af16c3dc8305;hp=8f6933799e0f374c32a2fef4ec5851d51aad79c5;hpb=4127accfc05f5b051c84b6a623f11c7230e237d9;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 8f69337..6bdb143 100644 --- a/dygraph.js +++ b/dygraph.js @@ -966,7 +966,8 @@ Dygraph.movePan = function(event, g, context) { var maxValue = axis.initialTopValue + unitsDragged; var minValue = maxValue - axis.dragValueRange; if (axis.logscale) { - axis.valueWindow = [ Math.pow(10, minValue), Math.pow(10, maxValue) ]; + axis.valueWindow = [ Math.pow(Dygraph.LOG_SCALE, minValue), + Math.pow(Dygraph.LOG_SCALE, maxValue) ]; } else { axis.valueWindow = [ minValue, maxValue ]; } @@ -1410,10 +1411,6 @@ Dygraph.prototype.mouseMove_ = function(event) { idx = i; } if (idx >= 0) lastx = points[idx].xval; - // Check that you can really highlight the last day's data - var last = points[points.length-1]; - if (last != null && canvasx > last.canvasx) - lastx = points[points.length-1].xval; // Extract the points we've selected this.selPoints_ = []; @@ -1921,6 +1918,10 @@ 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, ... +// NOTE: this assumes that Dygraph.LOG_SCALE = 10. Dygraph.PREFERRED_LOG_TICK_VALUES = function() { var vals = []; for (var power = -39; power <= 39; power++) { @@ -1966,7 +1967,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) { @@ -1978,7 +1979,7 @@ Dygraph.binarySearch = function(val, arry, abs, low, high) { } return Dygraph.binarySearch(val, arry, abs, mid + 1, high); } -} +}; /** * Add ticks when the x axis has numbers on it (instead of dates) @@ -2036,7 +2037,7 @@ Dygraph.numericTicks = function(minV, maxV, self, axis_props, vals) { domCoord : domCoord }; } else { - tick.label = ""; + tick.label = ""; } } ticks.push(tick); @@ -2045,6 +2046,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: @@ -2177,7 +2179,7 @@ Dygraph.prototype.extremeValues_ = function(series) { * number of axes, rolling averages, etc. */ Dygraph.prototype.predraw_ = function() { - // TODO(danvk): movabilitye more computations out of drawGraph_ and into here. + // TODO(danvk): move more computations out of drawGraph_ and into here. this.computeYAxes_(); // Create a new plotter.