this.selPoints_ = [];
var cumulative_sum = 0; // used only if we have a stackedGraph.
var l = points.length;
- for (var i = 0; i < l; i++) {
+ var isStacked = this.attr_("stackedGraph");
+ for (var i = l - 1; i >= 0; i--) {
if (points[i].xval == lastx) {
- if (!this.attr_("stackedGraph")) {
+ if (!isStacked) {
- this.selPoints_.push(points[i]);
+ this.selPoints_.unshift(points[i]);
} else {
// Clone the point, since we need to 'unstack' it below. Stacked points
// are in reverse order.