diff --git a/jquery.flot.threshold.js b/jquery.flot.threshold.js index 70ac8f4..f265bc2 100644 --- a/jquery.flot.threshold.js +++ b/jquery.flot.threshold.js @@ -103,8 +103,11 @@ You may need to check for this in hover events. datapoints.points = newpoints; thresholded.datapoints.points = threspoints; - if (thresholded.datapoints.points.length > 0) - plot.getData().push(thresholded); + if (thresholded.datapoints.points.length > 0) { + var origIndex = $.inArray(s, plot.getData()); + // Insert newly-generated series right after original one (to prevent it from becoming top-most) + plot.getData().splice(origIndex + 1, 0, thresholded); + } // FIXME: there are probably some edge cases left in bars }