projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #161 from klausw-g/is-series-locked
[dygraphs.git]
/
dygraph.js
diff --git
a/dygraph.js
b/dygraph.js
index
a0e55ab
..
b81789b
100644
(file)
--- a/
dygraph.js
+++ b/
dygraph.js
@@
-1536,7
+1536,8
@@
Dygraph.prototype.doUnzoom_ = function() {
newValueRanges = [];
for (i = 0; i < this.axes_.length; i++) {
var axis = this.axes_[i];
newValueRanges = [];
for (i = 0; i < this.axes_.length; i++) {
var axis = this.axes_[i];
- newValueRanges.push(axis.valueRange !== null ?
+ newValueRanges.push((axis.valueRange !== null &&
+ axis.valueRange !== undefined) ?
axis.valueRange : axis.extremeRange);
}
}
axis.valueRange : axis.extremeRange);
}
}
@@
-1669,7
+1670,7
@@
Dygraph.prototype.findClosestPoint = function(domX, domY) {
var minDist = Infinity;
var idx = -1;
var dist, dx, dy, point, closestPoint, closestSeries;
var minDist = Infinity;
var idx = -1;
var dist, dx, dy, point, closestPoint, closestSeries;
- for (
var setIdx = 0; setIdx < this.layout_.datasets.length; ++setIdx
) {
+ for (
var setIdx = this.layout_.datasets.length - 1 ; setIdx >= 0 ; --setIdx
) {
var points = this.layout_.points[setIdx];
for (var i = 0; i < points.length; ++i) {
var point = points[i];
var points = this.layout_.points[setIdx];
for (var i = 0; i < points.length; ++i) {
var point = points[i];
@@
-1770,7
+1771,7
@@
Dygraph.prototype.mouseMove_ = function(event) {
var highlightSeriesOpts = this.attr_("highlightSeriesOpts");
var selectionChanged = false;
var highlightSeriesOpts = this.attr_("highlightSeriesOpts");
var selectionChanged = false;
- if (highlightSeriesOpts && !this.
lockedSet_
) {
+ if (highlightSeriesOpts && !this.
isSeriesLocked()
) {
var closest;
if (this.attr_("stackedGraph")) {
closest = this.findStackedPoint(canvasx, canvasy);
var closest;
if (this.attr_("stackedGraph")) {
closest = this.findStackedPoint(canvasx, canvasy);
@@
-2063,6
+2064,14
@@
Dygraph.prototype.getHighlightSeries = function() {
};
/**
};
/**
+ * Returns true if the currently-highlighted series was locked
+ * via setSelection(..., seriesName, true).
+ */
+Dygraph.prototype.isSeriesLocked = function() {
+ return this.lockedSet_;
+};
+
+/**
* Fires when there's data available to be graphed.
* @param {String} data Raw CSV data to be plotted
* @private
* Fires when there's data available to be graphed.
* @param {String} data Raw CSV data to be plotted
* @private
@@
-2936,7
+2945,8
@@
Dygraph.prototype.parseFloat_ = function(x, opt_line_no, opt_line) {
*/
Dygraph.prototype.parseCSV_ = function(data) {
var ret = [];
*/
Dygraph.prototype.parseCSV_ = function(data) {
var ret = [];
- var lines = data.split("\n");
+ var line_delimiter = Dygraph.detectLineDelimiter(data);
+ var lines = data.split(line_delimiter || "\n");
var vals, j;
// Use the default delimiter or fall back to a tab if that makes sense.
var vals, j;
// Use the default delimiter or fall back to a tab if that makes sense.
@@
-3292,7
+3302,8
@@
Dygraph.prototype.start_ = function() {
this.predraw_();
} else if (typeof data == 'string') {
// Heuristic: a newline means it's CSV data. Otherwise it's an URL.
this.predraw_();
} else if (typeof data == 'string') {
// Heuristic: a newline means it's CSV data. Otherwise it's an URL.
- if (data.indexOf('\n') >= 0) {
+ var line_delimiter = Dygraph.detectLineDelimiter(data);
+ if (line_delimiter) {
this.loadedEvent_(data);
} else {
var req = new XMLHttpRequest();
this.loadedEvent_(data);
} else {
var req = new XMLHttpRequest();