From c6c1878b3848a1e734ef9a8e573bf9b62522be25 Mon Sep 17 00:00:00 2001 From: Lars Djerf Date: Sun, 28 Apr 2013 19:52:11 +0200 Subject: [PATCH 1/3] Add missing semicolon. --- js/plugins/hit.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/plugins/hit.js b/js/plugins/hit.js index 696af05a..7557d7d1 100644 --- a/js/plugins/hit.js +++ b/js/plugins/hit.js @@ -278,9 +278,9 @@ Flotr.addPlugin('hit', { drawMouseTrack : function (n) { var - pos = '', + pos = '', s = n.series, - p = n.mouse.position, + p = n.mouse.position, m = n.mouse.margin, x = n.x, y = n.y, @@ -334,7 +334,7 @@ Flotr.addPlugin('hit', { } if (!n.mouse.relative) { // absolute to the canvas - pos += 'top:' + pos += 'top:'; if (p.charAt(0) == 'n') pos += (oTop + m + top); else if (p.charAt(0) == 's') pos += (oTop - m + top + this.plotHeight - size.height); pos += 'px;bottom:auto;left:'; @@ -350,13 +350,13 @@ Flotr.addPlugin('hit', { }, radius = (Math.min(this.canvasWidth, this.canvasHeight) * s.pie.sizeRatio) / 2, bisection = n.sAngle Date: Fri, 10 May 2013 13:38:40 +0200 Subject: [PATCH 2/3] Add hit-testing to timeline. --- js/types/timeline.js | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/js/types/timeline.js b/js/types/timeline.js index 59ea6094..d183f05c 100644 --- a/js/types/timeline.js +++ b/js/types/timeline.js @@ -38,7 +38,7 @@ Flotr.addType('timeline', { Flotr._.each(data, function (timeline) { - var + var x = timeline[0], y = timeline[1], w = timeline[2], @@ -58,6 +58,40 @@ Flotr.addType('timeline', { }); }, + hit : function (options) { + var + data = options.data, + args = options.args, + n = args[1], + mouse = args[0], + x = options.xInverse(mouse.relX), + y = options.yInverse(mouse.relY), + h = options.barWidth, + x0, x1, y0, y1, i; + + for (i = data.length; i--;) { + w = data[i][2]; + x0 = data[i][0]; + x1 = x0 + w; + + y0 = data[i][1] + h; + y1 = data[i][1] - h; + + if ((x >= x0) && (x <= x1) && (y <= y0) && (y >= y1)) { + n.x = x0; + n.y = y0 - h; + n.index = i; + n.seriesIndex = options.index; + } + } + }, + + drawHit : function(options) { + }, + + clearHit : function(options) { + }, + extendRange : function (series) { var From ee0e2c657994d0dbe6f33a1bde26ed4287f00473 Mon Sep 17 00:00:00 2001 From: Lars Djerf Date: Fri, 31 May 2013 10:19:58 +0200 Subject: [PATCH 3/3] Whitespace. --- js/types/timeline.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/types/timeline.js b/js/types/timeline.js index d183f05c..8905df52 100644 --- a/js/types/timeline.js +++ b/js/types/timeline.js @@ -70,7 +70,7 @@ Flotr.addType('timeline', { x0, x1, y0, y1, i; for (i = data.length; i--;) { - w = data[i][2]; + w = data[i][2]; x0 = data[i][0]; x1 = x0 + w; @@ -82,7 +82,7 @@ Flotr.addType('timeline', { n.y = y0 - h; n.index = i; n.seriesIndex = options.index; - } + } } },