X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=src%2Fdygraph.js;h=d166f0311177960e76635b9a7f3808d8f8534fb8;hb=2cfded32d5da38aad8d9617654569f3e3f1c420d;hp=321b8fa81e50afa80451c0181e2d605290ef89ff;hpb=e8c70e4e0f4c124a2c68eb43d6ec4e781d1bf810;p=dygraphs.git diff --git a/src/dygraph.js b/src/dygraph.js index 321b8fa..d166f03 100644 --- a/src/dygraph.js +++ b/src/dygraph.js @@ -43,10 +43,6 @@ */ -// For "production" code, this gets set to false by uglifyjs. -// if (typeof(DEBUG) === 'undefined') DEBUG=true; -var DEBUG = true; - import DygraphLayout from './dygraph-layout'; import DygraphCanvasRenderer from './dygraph-canvas'; import DygraphOptions from './dygraph-options'; @@ -54,12 +50,15 @@ import DygraphInteraction from './dygraph-interaction-model'; import * as DygraphTickers from './dygraph-tickers'; import * as utils from './dygraph-utils'; import DEFAULT_ATTRS from './dygraph-default-attrs'; +import OPTIONS_REFERENCE from './dygraph-options-reference'; +import IFrameTarp from './iframe-tarp'; import DefaultHandler from './datahandler/default'; import ErrorBarsHandler from './datahandler/bars-error'; import CustomBarsHandler from './datahandler/bars-custom'; import DefaultFractionHandler from './datahandler/default-fractions'; import FractionsBarsHandler from './datahandler/bars-fractions'; +import BarsHandler from './datahandler/bars'; import AnnotationsPlugin from './plugins/annotations'; import AxesPlugin from './plugins/axes'; @@ -70,7 +69,6 @@ import RangeSelectorPlugin from './plugins/range-selector'; import GVizChart from './dygraph-gviz'; -/*global DygraphLayout:false, DygraphCanvasRenderer:false, DygraphOptions:false, G_vmlCanvasManager:false,ActiveXObject:false */ "use strict"; /** @@ -368,16 +366,17 @@ Dygraph.prototype.toString = function() { * @return { ... } The value of the option. */ Dygraph.prototype.attr_ = function(name, seriesName) { - // if (DEBUG) { - // if (typeof(Dygraph.OPTIONS_REFERENCE) === 'undefined') { - // console.error('Must include options reference JS for testing'); - // } else if (!Dygraph.OPTIONS_REFERENCE.hasOwnProperty(name)) { - // console.error('Dygraphs is using property ' + name + ', which has no ' + - // 'entry in the Dygraphs.OPTIONS_REFERENCE listing.'); - // // Only log this error once. - // Dygraph.OPTIONS_REFERENCE[name] = true; - // } - // } + // For "production" code, this gets removed by uglifyjs. + if (process.env.NODE_ENV != 'production') { + if (typeof(OPTIONS_REFERENCE) === 'undefined') { + console.error('Must include options reference JS for testing'); + } else if (!OPTIONS_REFERENCE.hasOwnProperty(name)) { + console.error('Dygraphs is using property ' + name + ', which has no ' + + 'entry in the Dygraphs.OPTIONS_REFERENCE listing.'); + // Only log this error once. + OPTIONS_REFERENCE[name] = true; + } + } return seriesName ? this.attributes_.getForSeries(name, seriesName) : this.attributes_.get(name); }; @@ -1151,7 +1150,7 @@ Dygraph.prototype.createDragInterface_ = function() { // We cover iframes during mouse interactions. See comments in // dygraph-utils.js for more info on why this is a good idea. - tarp: new utils.IFrameTarp(), + tarp: new IFrameTarp(), // contextB is the same thing as this context object but renamed. initializeMouseDown: function(event, g, contextB) { @@ -3554,6 +3553,51 @@ Dygraph.PLUGINS = [ GridPlugin ]; +// There are many symbols which have historically been available through the +// Dygraph class. These are exported here for backwards compatibility. Dygraph.GVizChart = GVizChart; +Dygraph.DASHED_LINE = utils.DASHED_LINE; +Dygraph.DOT_DASH_LINE = utils.DOT_DASH_LINE; +Dygraph.dateAxisLabelFormatter = utils.dateAxisLabelFormatter; +Dygraph.toRGB_ = utils.toRGB_; +Dygraph.findPos = utils.findPos; +Dygraph.pageX = utils.pageX; +Dygraph.pageY = utils.pageY; +Dygraph.dateString_ = utils.dateString_; +Dygraph.defaultInteractionModel = DygraphInteraction.defaultModel; +Dygraph.nonInteractiveModel = Dygraph.nonInteractiveModel_ = DygraphInteraction.nonInteractiveModel_; +Dygraph.Circles = utils.Circles; + +Dygraph.Plugins = { + Legend: LegendPlugin, + Axes: AxesPlugin, + Annotations: AnnotationsPlugin, + ChartLabels: ChartLabelsPlugin, + Grid: GridPlugin, + RangeSelector: RangeSelectorPlugin +}; + +Dygraph.DataHandlers = { + DefaultHandler, + BarsHandler, + CustomBarsHandler, + DefaultFractionHandler, + ErrorBarsHandler, + FractionsBarsHandler +}; + +Dygraph.startPan = DygraphInteraction.startPan; +Dygraph.startZoom = DygraphInteraction.startZoom; +Dygraph.movePan = DygraphInteraction.movePan; +Dygraph.moveZoom = DygraphInteraction.moveZoom; +Dygraph.endPan = DygraphInteraction.endPan; +Dygraph.endZoom = DygraphInteraction.endZoom; + +Dygraph.numericLinearTicks = DygraphTickers.numericLinearTicks; +Dygraph.numericTicks = DygraphTickers.numericTicks; +Dygraph.dateTicker = DygraphTickers.dateTicker; +Dygraph.Granularity = DygraphTickers.Granularity; +Dygraph.getDateAxis = DygraphTickers.getDateAxis; +Dygraph.floatFormat = utils.floatFormat; export default Dygraph;