var minValue = maxValue - valueRange;
self.valueWindow_ = [ minValue, maxValue ];
}
- self.drawGraph_(self.rawData_);
+ self.drawGraph_();
}
});
*/
Dygraph.prototype.doZoomXDates_ = function(minDate, maxDate) {
this.dateWindow_ = [minDate, maxDate];
- this.drawGraph_(this.rawData_);
+ this.drawGraph_();
if (this.attr_("zoomCallback")) {
var yRange = this.yAxisRange();
this.attr_("zoomCallback")(minDate, maxDate, yRange[0], yRange[1]);
*/
Dygraph.prototype.doZoomYValues_ = function(minValue, maxValue) {
this.valueWindow_ = [minValue, maxValue];
- this.drawGraph_(this.rawData_);
+ this.drawGraph_();
if (this.attr_("zoomCallback")) {
var xRange = this.xAxisRange();
this.attr_("zoomCallback")(xRange[0], xRange[1], minValue, maxValue);
if (dirty) {
// Putting the drawing operation before the callback because it resets
// yAxisRange.
- this.drawGraph_(this.rawData_);
+ this.drawGraph_();
if (this.attr_("zoomCallback")) {
var minDate = this.rawData_[0][0];
var maxDate = this.rawData_[this.rawData_.length - 1][0];
*/
Dygraph.prototype.loadedEvent_ = function(data) {
this.rawData_ = this.parseCSV_(data);
- this.drawGraph_(this.rawData_);
+ this.drawGraph_();
};
Dygraph.prototype.months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
};
/**
- * Update the graph with new data. Data is in the format
- * [ [date1, val1, val2, ...], [date2, val1, val2, ...] if errorBars=false
- * or, if errorBars=true,
- * [ [date1, [val1,stddev1], [val2,stddev2], ...], [date2, ...], ...]
- * @param {Array.<Object>} data The data (see above)
+ * Update the graph with new data. This method is called when the viewing area
+ * has changed. If the underlying data or options have changed, predraw_ will
+ * be called before drawGraph_ is called.
* @private
*/
-Dygraph.prototype.drawGraph_ = function(data) {
+Dygraph.prototype.drawGraph_ = function() {
+ var data = this.rawData_;
+
// This is used to set the second parameter to drawCallback, below.
var is_initial_draw = this.is_initial_draw_;
this.is_initial_draw_ = false;
this.loadedEvent_(this.file_());
} else if (Dygraph.isArrayLike(this.file_)) {
this.rawData_ = this.parseArray_(this.file_);
- this.drawGraph_(this.rawData_);
+ this.drawGraph_();
} else if (typeof this.file_ == 'object' &&
typeof this.file_.getColumnRange == 'function') {
// must be a DataTable from gviz.
this.parseDataTable_(this.file_);
- this.drawGraph_(this.rawData_);
+ this.drawGraph_();
} else if (typeof this.file_ == 'string') {
// Heuristic: a newline means it's CSV data. Otherwise it's an URL.
if (this.file_.indexOf('\n') >= 0) {
this.file_ = attrs['file'];
this.start_();
} else {
- this.drawGraph_(this.rawData_);
+ this.drawGraph_();
}
};
}
this.createInterface_();
- this.drawGraph_(this.rawData_);
+ this.drawGraph_();
this.resize_lock = false;
};
*/
Dygraph.prototype.adjustRoll = function(length) {
this.rollPeriod_ = length;
- this.drawGraph_(this.rawData_);
+ this.drawGraph_();
};
/**
this.warn("invalid series number in setVisibility: " + num);
} else {
x[num] = value;
- this.drawGraph_(this.rawData_);
+ this.drawGraph_();
}
};
this.annotations_ = ann;
this.layout_.setAnnotations(this.annotations_);
if (!suppressDraw) {
- this.drawGraph_(this.rawData_);
+ this.drawGraph_();
}
};