projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Check that setRow is not negative, fixes #644. (#773)
[dygraphs.git]
/
src
/
dygraph.js
diff --git
a/src/dygraph.js
b/src/dygraph.js
index
e5053ba
..
3ffc2e6
100644
(file)
--- a/
src/dygraph.js
+++ b/
src/dygraph.js
@@
-1813,7
+1813,7
@@
Dygraph.prototype.setSelection = function(row, opt_seriesName, opt_locked) {
// for. If it is, just use it, otherwise search the array for a point
// in the proper place.
var setRow = row - this.getLeftBoundary_(setIdx);
// for. If it is, just use it, otherwise search the array for a point
// in the proper place.
var setRow = row - this.getLeftBoundary_(setIdx);
- if (setRow < points.length && points[setRow].idx == row) {
+ if (setRow
>= 0 && setRow
< points.length && points[setRow].idx == row) {
var point = points[setRow];
if (point.yval !== null) this.selPoints_.push(point);
} else {
var point = points[setRow];
if (point.yval !== null) this.selPoints_.push(point);
} else {
@@
-2304,16
+2304,15
@@
Dygraph.prototype.drawGraph_ = function() {
this.setIndexByName_ = {};
var labels = this.attr_("labels");
this.setIndexByName_ = {};
var labels = this.attr_("labels");
- if (labels.length > 0) {
- this.setIndexByName_[labels[0]] = 0;
- }
var dataIdx = 0;
for (var i = 1; i < points.length; i++) {
var dataIdx = 0;
for (var i = 1; i < points.length; i++) {
- this.setIndexByName_[labels[i]] = i;
if (!this.visibility()[i - 1]) continue;
this.layout_.addDataset(labels[i], points[i]);
this.datasetIndex_[i] = dataIdx++;
}
if (!this.visibility()[i - 1]) continue;
this.layout_.addDataset(labels[i], points[i]);
this.datasetIndex_[i] = dataIdx++;
}
+ for (var i = 0; i < labels.length; i++) {
+ this.setIndexByName_[labels[i]] = i;
+ }
this.computeYAxisRanges_(extremes);
this.layout_.setYAxes(this.axes_);
this.computeYAxisRanges_(extremes);
this.layout_.setYAxes(this.axes_);