Commit 7f906431 authored by David Schnur's avatar David Schnur

Merge pull request #1285 from dnschnur/jquery-attr-fix

Fix zoom to selection box when using jQuery 1.9+.
parents 095799cd 4964dcb3
...@@ -12,6 +12,15 @@ ...@@ -12,6 +12,15 @@
$(function() { $(function() {
// Shim allowing us to get the state of the check-box on jQuery versions
// prior to 1.6, when prop was added. The reason we don't just use attr
// is because it doesn't work in jQuery versions 1.9.x and later.
// TODO: Remove this once Flot's minimum supported jQuery reaches 1.6.
if (typeof $.fn.prop != 'function') {
$.fn.prop = $.fn.attr;
}
var data = [{ var data = [{
label: "United States", label: "United States",
data: [[1990, 18.9], [1991, 18.7], [1992, 18.4], [1993, 19.3], [1994, 19.5], [1995, 19.3], [1996, 19.4], [1997, 20.2], [1998, 19.8], [1999, 19.9], [2000, 20.4], [2001, 20.1], [2002, 20.0], [2003, 19.8], [2004, 20.4]] data: [[1990, 18.9], [1991, 18.7], [1992, 18.4], [1993, 19.3], [1994, 19.5], [1995, 19.3], [1996, 19.4], [1997, 20.2], [1998, 19.8], [1999, 19.9], [2000, 20.4], [2001, 20.1], [2002, 20.0], [2003, 19.8], [2004, 20.4]]
...@@ -64,7 +73,7 @@ ...@@ -64,7 +73,7 @@
$("#selection").text(ranges.xaxis.from.toFixed(1) + " to " + ranges.xaxis.to.toFixed(1)); $("#selection").text(ranges.xaxis.from.toFixed(1) + " to " + ranges.xaxis.to.toFixed(1));
var zoom = $("#zoom").attr("checked"); var zoom = $("#zoom").prop("checked");
if (zoom) { if (zoom) {
$.each(plot.getXAxes(), function(_, axis) { $.each(plot.getXAxes(), function(_, axis) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment