From: Mitch Foley Date: Tue, 19 Feb 2013 21:21:44 +0000 (-0500) Subject: Since we can't change constants, checking to see if they exist instead of always... X-Git-Tag: v1.0.0~56^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=4294a33fd594129f8931f28cc18113c82a599134;p=dygraphs.git Since we can't change constants, checking to see if they exist instead of always changing the value. --- 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; +}