+/**
+ * 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;
+}
+