Dygraph.update(this.options, new_options ? new_options : {});
};
+/**
+ * Return a copy of the point at the indicated index, with its yval unstacked.
+ * @param int index of point in layout_.points
+ */
+DygraphLayout.prototype.unstackPointAtIndex_ = function(idx) {
+ var point = this.points[idx];
+
+ // Clone the point since we modify it
+ var unstackedPoint = {};
+ for (var i in point) {
+ unstackedPoint[i] = point[i];
+ }
+
+ if (!this.attr_("stackedGraph")) {
+ return unstackedPoint;
+ }
+
+ // The unstacked yval is equal to the current yval minus the yval of the
+ // next point at the same xval.
+ for (var i = idx+1; i < this.points.length; i++) {
+ if (this.points[i].xval == point.xval) {
+ unstackedPoint.yval -= this.points[i].yval;
+ break;
+ }
+ }
+
+ return unstackedPoint;
+}
+
// Subclass PlotKit.CanvasRenderer to add:
// 1. X/Y grid overlay
// 2. Ability to draw error bars (if required)
};
/**
- * Return a copy of the point at the indicated index, with its yval unstacked.
- * @param int index of point in this.layout_.points
- * @private
- */
-Dygraph.prototype.unstackPointAtIndex_ = function(idx) {
- var point = this.layout_.points[idx];
-
- // Clone the point since we modify it
- var unstackedPoint = {};
- for (var i in point) {
- unstackedPoint[i] = point[i];
- }
-
- if (!this.attr_("stackedGraph")) {
- return unstackedPoint;
- }
-
- // The unstacked yval is equal to the current yval minus the yval of the
- // next point at the same xval.
- for (var i = idx+1; i < this.layout_.points.length; i++) {
- if (this.layout_.points[i].xval == point.xval) {
- unstackedPoint.yval -= this.layout_.points[i].yval;
- break;
- }
- }
-
- return unstackedPoint;
-}
-
-/**
* Set manually set selected dots, and display information about them
* @param int row number that should by highlighted
* false value clears the selection
var point = this.layout_.points[pos+row];
if (this.attr_("stackedGraph")) {
- point = this.unstackPointAtIndex_(pos+row);
+ point = this.layout_.unstackPointAtIndex_(pos+row);
}
this.selPoints_.push(point);