From: Uemit Seren Date: Wed, 3 Apr 2013 12:45:36 +0000 (+0200) Subject: #Bug 333: Support for passing point index to drawPointCallback and drawHighlightPoint... X-Git-Tag: v1.0.0~42^2~4 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=b616fad11c12b9fff811b64ed6ceb97ea3700640;p=dygraphs.git #Bug 333: Support for passing point index to drawPointCallback and drawHighlightPointCallback added --- 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();