From 4294a33fd594129f8931f28cc18113c82a599134 Mon Sep 17 00:00:00 2001
From: Mitch Foley <mitch@thefoley.net>
Date: Tue, 19 Feb 2013 16:21:44 -0500
Subject: [PATCH] Since we can't change constants, checking to see if they
 exist instead of always changing the value.

---
 dygraph-tickers.js | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/dygraph-tickers.js b/dygraph-tickers.js
index c6939cb..4909909 100644
--- a/dygraph-tickers.js
+++ b/dygraph-tickers.js
@@ -459,11 +459,13 @@ Dygraph.getDateAxis = function(start_time, end_time, granularity, opts, dg) {
 
 // These are set here so that this file can be included after dygraph.js
 // or independently.
-Dygraph.DEFAULT_ATTRS = Dygraph.DEFAULT_ATTRS || {};
-Dygraph.DEFAULT_ATTRS['axes'] = Dygraph.DEFAULT_ATTRS['axes'] || {};
-Dygraph.DEFAULT_ATTRS['axes']['x'] = Dygraph.DEFAULT_ATTRS['axes']['x'] || {};
-Dygraph.DEFAULT_ATTRS['axes']['y'] = Dygraph.DEFAULT_ATTRS['axes']['y'] || {};
-Dygraph.DEFAULT_ATTRS['axes']['y2'] = Dygraph.DEFAULT_ATTRS['axes']['y2'] || {};
-Dygraph.DEFAULT_ATTRS['axes']['x']['ticker'] = Dygraph.dateTicker;
-Dygraph.DEFAULT_ATTRS['axes']['y']['ticker'] = Dygraph.numericTicks;
-Dygraph.DEFAULT_ATTRS['axes']['y2']['ticker'] = Dygraph.numericTicks;
+if (Dygraph &&
+    Dygraph.DEFAULT_ATTRS &&
+    Dygraph.DEFAULT_ATTRS['axes'] &&
+    Dygraph.DEFAULT_ATTRS['axes']['x'] &&
+    Dygraph.DEFAULT_ATTRS['axes']['y'] &&
+    Dygraph.DEFAULT_ATTRS['axes']['y2']) {
+  Dygraph.DEFAULT_ATTRS['axes']['x']['ticker'] = Dygraph.dateTicker;
+  Dygraph.DEFAULT_ATTRS['axes']['y']['ticker'] = Dygraph.numericTicks;
+  Dygraph.DEFAULT_ATTRS['axes']['y2']['ticker'] = Dygraph.numericTicks;
+}
-- 
2.7.4