From e9a32469f3fb0fa4438993d5c46e046b07488bec Mon Sep 17 00:00:00 2001 From: Adil Date: Wed, 12 Dec 2012 13:17:09 -0500 Subject: [PATCH] - Refactored requestAnimFrame. - No longer need xIsEpochDate, so removed. --- dygraph-options-reference.js | 6 ------ dygraph-utils.js | 4 +++- dygraph.js | 8 +------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/dygraph-options-reference.js b/dygraph-options-reference.js index df19c7d..5aa7f05 100644 --- a/dygraph-options-reference.js +++ b/dygraph-options-reference.js @@ -748,12 +748,6 @@ Dygraph.OPTIONS_REFERENCE = // "type": "string", "description": "The range selector mini plot fill color. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\". You can also specify null or \"\" to turn off fill." }, - "xIsEpochDate": { - "default": "false", - "labels": ["CSV parsing"], - "type": "boolean", - "description": "When set the X axis is interpreted as Unix epoch date values." - }, "animatedZooms": { "default": "false", "labels": ["Interactive Elements"], diff --git a/dygraph-utils.js b/dygraph-utils.js index 10a393c..086d8f8 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -816,6 +816,8 @@ Dygraph.createIterator = function(array, start, length, opt_predicate) { // Shim layer with setTimeout fallback. // From: http://paulirish.com/2011/requestanimationframe-for-smart-animating/ +// Should be called with the window context: +// Dygraph.requestAnimFrame.call(window, function() {}) Dygraph.requestAnimFrame = (function(){ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || @@ -854,7 +856,7 @@ Dygraph.repeatAndCleanup = function(repeatFn, maxFrames, framePeriodInMillis, (function loop() { if (frameNumber >= maxFrames) return; - Dygraph.requestAnimFrame(function() { + Dygraph.requestAnimFrame.call(window, function() { // Determine which frame to draw based on the delay so far. Will skip // frames if necessary. var currentTime = new Date().getTime(); diff --git a/dygraph.js b/dygraph.js index ba8da98..97da32a 100644 --- a/dygraph.js +++ b/dygraph.js @@ -274,8 +274,6 @@ Dygraph.DEFAULT_ATTRS = { rangeSelectorPlotStrokeColor: "#808FAB", rangeSelectorPlotFillColor: "#A7B1C4", - xIsEpochDate: false, - // The ordering here ensures that central lines always appear above any // fill bars/error bars. plotter: [ @@ -3098,16 +3096,12 @@ Dygraph.prototype.parseArray_ = function(data) { } } - if (this.attr_("xIsEpochDate") || Dygraph.isDateLike(data[0][0])) { + if (Dygraph.isDateLike(data[0][0]) { // Some intelligent defaults for a date x-axis. this.attrs_.axes.x.valueFormatter = Dygraph.dateString_; this.attrs_.axes.x.axisLabelFormatter = Dygraph.dateAxisFormatter; this.attrs_.axes.x.ticker = Dygraph.dateTicker; - if (this.attr_("xIsEpochDate")) { - return data; - } - // Assume they're all dates. var parsedData = Dygraph.clone(data); for (i = 0; i < data.length; i++) { -- 2.7.4