From 563c70ca88b5c168b6497955710f4312dfe4a6ac Mon Sep 17 00:00:00 2001 From: Adam Vartanian Date: Mon, 8 Mar 2010 15:44:06 -0500 Subject: [PATCH] Fix bugs in connectSeparatedPoints implementation. Add test. --- dygraph.js | 6 +++--- tests/connect-separated.html | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 tests/connect-separated.html diff --git a/dygraph.js b/dygraph.js index 6aa6bf4..4b9b6f1 100644 --- a/dygraph.js +++ b/dygraph.js @@ -958,7 +958,7 @@ Dygraph.prototype.updateSelection_ = function() { replace += "
"; } var point = this.selPoints_[i]; - var c = new RGBColor(this.plotter_.colors_[point.name]); + var c = new RGBColor(this.plotter_.colors[point.name]); replace += " " + point.name + ":" + this.round_(point.yval, 2); @@ -970,7 +970,7 @@ Dygraph.prototype.updateSelection_ = function() { for (var i = 0; i < this.selPoints_.length; i++) { if (!isOK(this.selPoints_[i].canvasy)) continue; ctx.beginPath(); - ctx.fillStyle = this.plotter_.colors_[this.selPoints_[i].name]; + ctx.fillStyle = this.plotter_.colors[this.selPoints_[i].name]; ctx.arc(canvasx, this.selPoints_[i].canvasy, circleSize, 0, 2 * Math.PI, false); ctx.fill(); @@ -1486,7 +1486,7 @@ Dygraph.prototype.drawGraph_ = function(data) { for (var j = 0; j < data.length; j++) { if (data[j][i] || !connectSeparatedPoints) { var date = data[j][0]; - series[j] = [date, data[j][i]]; + series.push([date, data[j][i]]); } } series = this.rollingAverage(series, this.rollPeriod_); diff --git a/tests/connect-separated.html b/tests/connect-separated.html new file mode 100644 index 0000000..5993375 --- /dev/null +++ b/tests/connect-separated.html @@ -0,0 +1,34 @@ + + + connect separated + + + + + + +

Connecting separated points. All three of the series should have their points + connected with lines, and hovering over them should produce dot and legend + overlays in the proper color.

+ +
+ + + -- 2.7.4