X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=src%2Fdygraph.js;h=4f3ce77a93cbf1502f0b68fae7fd760042164d60;hb=refs%2Fheads%2Fissue-524;hp=735ddca0bddcd9085f8bc6ff0a1f915522d9f5f7;hpb=5db9ad5da775ff73aa8d859c334935d01f01b930;p=dygraphs.git diff --git a/src/dygraph.js b/src/dygraph.js index 735ddca..4f3ce77 100644 --- a/src/dygraph.js +++ b/src/dygraph.js @@ -2671,7 +2671,7 @@ Dygraph.prototype.renderGraph_ = function(is_initial_draw) { this.canvas_.getContext('2d').clearRect(0, 0, this.width_, this.height_); if (this.getFunctionOption("drawCallback") !== null) { - this.getFunctionOption("drawCallback")(this, is_initial_draw); + this.getFunctionOption("drawCallback").call(this, this, is_initial_draw); } if (is_initial_draw) { this.readyFired_ = true; @@ -3247,9 +3247,9 @@ Dygraph.prototype.parseDataTable_ = function(data) { this.attrs_.axes.x.ticker = Dygraph.numericTicks; this.attrs_.axes.x.axisLabelFormatter = this.attrs_.axes.x.valueFormatter; } else { - console.error("only 'date', 'datetime' and 'number' types are supported " + - "for column 1 of DataTable input (Got '" + indepType + "')"); - return null; + throw new Error( + "only 'date', 'datetime' and 'number' types are supported " + + "for column 1 of DataTable input (Got '" + indepType + "')"); } // Array of the column indices which contain data (and not annotations). @@ -3271,8 +3271,9 @@ Dygraph.prototype.parseDataTable_ = function(data) { } hasAnnotations = true; } else { - console.error("Only 'number' is supported as a dependent type with Gviz." + - " 'string' is only supported if displayAnnotations is true"); + throw new Error( + "Only 'number' is supported as a dependent type with Gviz." + + " 'string' is only supported if displayAnnotations is true"); } } @@ -3746,6 +3747,10 @@ Dygraph.addAnnotationRule = function() { console.warn("Unable to add default annotation CSS rule; display may be off."); }; +if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = Dygraph; +} + return Dygraph; })();