From 49c312c36d073bc77688f0c877918a836c541f1c Mon Sep 17 00:00:00 2001 From: David Schnur Date: Mon, 27 May 2013 23:13:10 -0400 Subject: [PATCH] Fix lines incorrectly broken before an operator. --- jquery.flot.js | 30 ++++++++++++++---------------- jquery.flot.pie.js | 7 ++++--- jquery.flot.stack.js | 8 ++++---- jquery.flot.threshold.js | 3 +-- jquery.flot.time.js | 11 +++++------ 5 files changed, 28 insertions(+), 31 deletions(-) diff --git a/jquery.flot.js b/jquery.flot.js index b8e8c86..1365c00 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1191,10 +1191,10 @@ Licensed under the MIT license. // a little bit of line specific stuff that // perhaps shouldn't be here, but lacking // better means... - if (insertSteps && k > 0 - && points[k - ps] != null - && points[k - ps] != points[k] - && points[k - ps + 1] != points[k + 1]) { + if (insertSteps && k > 0 && + points[k - ps] != null && + points[k - ps] != points[k] && + points[k - ps + 1] != points[k + 1]) { // copy the point to make room for a middle point for (m = 0; m < ps; ++m) { points[k + ps + m] = points[k + m]; @@ -2084,11 +2084,11 @@ Licensed under the MIT license. xoff = yoff = 0; - if (isNaN(v) || v < axis.min || v > axis.max + if (isNaN(v) || v < axis.min || v > axis.max || ( // skip those lying on the axes if we got a border - || (t == "full" - && ((typeof bw == "object" && bw[axis.position] > 0) || bw > 0) - && (v == axis.min || v == axis.max))) { + t == "full" && ((typeof bw == "object" && bw[axis.position] > 0) || bw > 0) && + (v == axis.min || v == axis.max) + )) { continue; } @@ -2997,10 +2997,11 @@ Licensed under the MIT license. // clear auto-highlights for (var i = 0; i < highlights.length; ++i) { var h = highlights[i]; - if (h.auto == eventname && - !(item && h.series == item.series && - h.point[0] == item.datapoint[0] && - h.point[1] == item.datapoint[1])) { + if (h.auto == eventname && !( + item && h.series == item.series && + h.point[0] == item.datapoint[0] && + h.point[1] == item.datapoint[1] + )) { unhighlight(h.series, h.point); } } @@ -3061,7 +3062,6 @@ Licensed under the MIT license. var i = indexOfHighlight(s, point); if (i == -1) { highlights.push({ series: s, point: point, auto: auto }); - triggerRedrawOverlay(); } else if (!auto) { highlights[i].auto = false; @@ -3087,7 +3087,6 @@ Licensed under the MIT license. var i = indexOfHighlight(s, point); if (i != -1) { highlights.splice(i, 1); - triggerRedrawOverlay(); } } @@ -3095,8 +3094,7 @@ Licensed under the MIT license. function indexOfHighlight(s, p) { for (var i = 0; i < highlights.length; ++i) { var h = highlights[i]; - if (h.series == s && h.point[0] == p[0] - && h.point[1] == p[1]) { + if (h.series === s && h.point[0] === p[0] && h.point[1] === p[1]) { return i; } } diff --git a/jquery.flot.pie.js b/jquery.flot.pie.js index 981fe89..66e1c79 100644 --- a/jquery.flot.pie.js +++ b/jquery.flot.pie.js @@ -564,9 +564,10 @@ More detail and specific examples can be found in the included HTML file. function isPointInPoly(poly, pt) { for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) { - ((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || (poly[j][1] <= pt[1] && pt[1]< poly[i][1])) - && (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0]) - && (c = !c); + ((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || + (poly[j][1] <= pt[1] && pt[1]< poly[i][1])) && + (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0]) && + (c = !c); } return c; } diff --git a/jquery.flot.stack.js b/jquery.flot.stack.js index 795eccc..993b63f 100644 --- a/jquery.flot.stack.js +++ b/jquery.flot.stack.js @@ -176,10 +176,10 @@ charts or filled areas). } // maintain the line steps invariant - if (withsteps && l != newpoints.length && l > 0 - && newpoints[l] != null - && newpoints[l] != newpoints[l - ps] - && newpoints[l + 1] != newpoints[l - ps + 1]) { + if (withsteps && l != newpoints.length && l > 0 && + newpoints[l] != null && + newpoints[l] != newpoints[l - ps] && + newpoints[l + 1] != newpoints[l - ps + 1]) { for (m = 0; m < ps; ++m) { newpoints[l + ps + m] = newpoints[l + m]; } diff --git a/jquery.flot.threshold.js b/jquery.flot.threshold.js index 1798b9c..f8e1283 100644 --- a/jquery.flot.threshold.js +++ b/jquery.flot.threshold.js @@ -77,8 +77,7 @@ You may need to check for this in hover events. p = newpoints; } - if (addCrossingPoints && prevp != p && x != null - && i > 0 && origpoints[i - ps] != null) { + if (addCrossingPoints && prevp != p && x != null && i > 0 && origpoints[i - ps] != null) { var interx = x + (below - y) * (x - origpoints[i - ps]) / (y - origpoints[i - ps + 1]); prevp.push(interx); prevp.push(below); diff --git a/jquery.flot.time.js b/jquery.flot.time.js index f0454f4..471b602 100644 --- a/jquery.flot.time.js +++ b/jquery.flot.time.js @@ -224,9 +224,9 @@ API.txt for details. } for (var i = 0; i < spec.length - 1; ++i) { - if (axis.delta < (spec[i][0] * timeUnitSize[spec[i][1]] - + spec[i + 1][0] * timeUnitSize[spec[i + 1][1]]) / 2 - && spec[i][0] * timeUnitSize[spec[i][1]] >= minSize) { + if (axis.delta < (spec[i][0] * timeUnitSize[spec[i][1]] + + spec[i + 1][0] * timeUnitSize[spec[i + 1][1]]) / 2 && + spec[i][0] * timeUnitSize[spec[i][1]] >= minSize) { break; } } @@ -335,8 +335,7 @@ API.txt for details. d.setDate(1); var start = d.getTime(); - d.setMonth(d.getMonth() + - (unit == "quarter" ? 3 : 1)); + d.setMonth(d.getMonth() + (unit == "quarter" ? 3 : 1)); var end = d.getTime(); d.setTime(v + carry * timeUnitSize.hour + (end - start) * tickSize); carry = d.getHours(); @@ -370,7 +369,7 @@ API.txt for details. var useQuarters = (axis.options.tickSize && axis.options.tickSize[1] == "quarter") || - (axis.options.minTickSize && + (axis.options.minTickSize && axis.options.minTickSize[1] == "quarter"); var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]];