From 4ab51f75d72a9e6c98a508b6788367c0198de4d9 Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Thu, 23 Feb 2012 10:14:38 -0500 Subject: [PATCH] Fixed Dygraph.Circles.Circle and custom circles. All working now. --- dygraph-utils.js | 2 +- tests/custom-circles.html | 60 +++++++++++++++++++++++++++++++++++++---------- 2 files changed, 48 insertions(+), 14 deletions(-) diff --git a/dygraph-utils.js b/dygraph-utils.js index f9cc85b..06eb666 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -884,7 +884,7 @@ Dygraph.Circles = { }, CIRCLE : function(g, name, ctx, cx, cy, color, radius) { ctx.beginPath(); - ctx.lineStyle = color; + ctx.strokeStyle = color; ctx.arc(cx, cy, radius, 0, 2 * Math.PI, false); ctx.stroke(); }, diff --git a/tests/custom-circles.html b/tests/custom-circles.html index 8b1d8bb..6d7caa1 100644 --- a/tests/custom-circles.html +++ b/tests/custom-circles.html @@ -32,7 +32,7 @@ ctx.fillStyle = "#000000"; ctx.beginPath(); - ctx.arc(cx, cy, radius - 2, -.3, Math.PI + .3, false); + ctx.arc(cx, cy + radius, radius - 2, Math.PI + .3, -.3, false); ctx.stroke(); }; @@ -75,18 +75,52 @@ }, { drawPoints : true, - pointSize : 6, - 'default' : { drawPointCallback : Dygraph.Circles.DEFAULT }, - 'triangle' : { drawPointCallback : Dygraph.Circles.TRIANGLE }, - 'square' : { drawPointCallback : Dygraph.Circles.SQUARE }, - 'diamond' : { drawPointCallback : Dygraph.Circles.DIAMOND }, - 'pentagon' : { drawPointCallback : Dygraph.Circles.PENTAGON }, - 'hexagon' : { drawPointCallback : Dygraph.Circles.HEXAGON }, - 'circle' : { drawPointCallback : Dygraph.Circles.CIRCLE }, - 'star' : { drawPointCallback : Dygraph.Circles.STAR }, - 'plus' : { drawPointCallback : Dygraph.Circles.PLUS }, - 'ex' : { drawPointCallback : Dygraph.Circles.EX }, - 'custom' : { drawPointCallback : smile, drawHighlightCallback : frown } + pointSize : 5, + highlightCircleSize : 8, + 'default' : { + drawPointCallback : Dygraph.Circles.DEFAULT, + drawHighlightCallback : Dygraph.Circles.DEFAULT + }, + 'triangle' : { + drawPointCallback : Dygraph.Circles.TRIANGLE, + drawHighlightCallback : Dygraph.Circles.TRIANGLE + }, + 'square' : { + drawPointCallback : Dygraph.Circles.SQUARE, + drawHighlightCallback : Dygraph.Circles.SQUARE + }, + 'diamond' : { + drawPointCallback : Dygraph.Circles.DIAMOND, + drawHighlightCallback : Dygraph.Circles.DIAMOND + }, + 'pentagon' : { + drawPointCallback : Dygraph.Circles.PENTAGON, + drawHighlightCallback : Dygraph.Circles.PENTAGON + }, + 'hexagon' : { + drawPointCallback : Dygraph.Circles.HEXAGON, + drawHighlightCallback : Dygraph.Circles.HEXAGON + }, + 'circle' : { + drawPointCallback : Dygraph.Circles.CIRCLE, + drawHighlightCallback : Dygraph.Circles.CIRCLE + }, + 'star' : { + drawPointCallback : Dygraph.Circles.STAR, + drawHighlightCallback : Dygraph.Circles.STAR + }, + 'plus' : { + drawPointCallback : Dygraph.Circles.PLUS, + drawHighlightCallback : Dygraph.Circles.PLUS + }, + 'ex' : { + drawPointCallback : Dygraph.Circles.EX, + drawHighlightCallback : Dygraph.Circles.EX + }, + 'custom' : { + drawPointCallback : frown, + drawHighlightCallback : smile + }, } ); -- 2.7.4