From b616fad11c12b9fff811b64ed6ceb97ea3700640 Mon Sep 17 00:00:00 2001 From: Uemit Seren Date: Wed, 3 Apr 2013 14:45:36 +0200 Subject: [PATCH] #Bug 333: Support for passing point index to drawPointCallback and drawHighlightPointCallback added --- dygraph-canvas.js | 4 ++-- dygraph-layout.js | 3 ++- dygraph.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dygraph-canvas.js b/dygraph-canvas.js index 99ad493..ee325c6 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -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(); } }; diff --git a/dygraph-layout.js b/dygraph-layout.js index 4caafc0..b67fe2c 100644 --- a/dygraph-layout.js +++ b/dygraph-layout.js @@ -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] }; } diff --git a/dygraph.js b/dygraph.js index 4316ac3..6e4d2ce 100644 --- a/dygraph.js +++ b/dygraph.js @@ -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(); -- 2.7.4