#Bug 333: Support for passing point index to drawPointCallback and drawHighlightPoint...
authorUemit Seren <uemit.seren+git@gmail.com>
Wed, 3 Apr 2013 12:45:36 +0000 (14:45 +0200)
committerUemit Seren <uemit.seren+git@gmail.com>
Thu, 4 Apr 2013 14:37:57 +0000 (16:37 +0200)
dygraph-canvas.js
dygraph-layout.js
dygraph.js

index 99ad493..ee325c6 100644 (file)
@@ -373,7 +373,7 @@ DygraphCanvasRenderer._drawSeries = function(e,
         ctx.moveTo(point.canvasx, point.canvasy);
       }
       if (drawPoints || isIsolated) {
-        pointsOnLine.push([point.canvasx, point.canvasy]);
+        pointsOnLine.push([point.canvasx, point.canvasy, point.idx]);
       }
       prevCanvasX = point.canvasx;
       prevCanvasY = point.canvasy;
@@ -398,7 +398,7 @@ DygraphCanvasRenderer._drawPointsOnLine = function(
     var cb = pointsOnLine[idx];
     ctx.save();
     drawPointCallback(
-        e.dygraph, e.setName, ctx, cb[0], cb[1], color, pointSize);
+        e.dygraph, e.setName, ctx, cb[0], cb[1], color, pointSize,cb[2]);
     ctx.restore();
   }
 };
index 4caafc0..b67fe2c 100644 (file)
@@ -242,7 +242,8 @@ DygraphLayout.prototype._evaluateLineCharts = function() {
         y: yNormal,
         xval: xValue,
         yval: yValue,
-        name: setName  // TODO(danvk): is this really necessary?
+        name: setName,  // TODO(danvk): is this really necessary?
+        idx: j + this.dygraph_.boundaryIds_[setIdx][0]
       };
     }
 
index 4316ac3..6e4d2ce 100644 (file)
@@ -1988,7 +1988,7 @@ Dygraph.prototype.updateSelection_ = function(opt_animFraction) {
       ctx.strokeStyle = color;
       ctx.fillStyle = color;
       callback(this.g, pt.name, ctx, canvasx, pt.canvasy,
-          color, circleSize);
+          color, circleSize,pt.idx);
     }
     ctx.restore();