From 49cce02be913b5b35a350a3fc89359150e351e3a Mon Sep 17 00:00:00 2001 From: David Schnur Date: Thu, 7 Feb 2013 21:31:51 -0500 Subject: [PATCH] Add the plot function as a chainable property. Resolves #734 and #816. --- jquery.flot.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jquery.flot.js b/jquery.flot.js index bbb6c68..7a0b04e 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -2681,6 +2681,8 @@ Licensed under the MIT license. } } + // Add the plot function to the top level of the jQuery object + $.plot = function(placeholder, data, options) { //var t0 = new Date(); var plot = new Plot($(placeholder), data, options, $.plot.plugins); @@ -2692,6 +2694,14 @@ Licensed under the MIT license. $.plot.plugins = []; + // Also add the plot function as a chainable property + + $.fn.plot = function(data, options) { + return this.each(function() { + $.plot(this, data, options); + }); + } + // round to nearby lower multiple of base function floorInBase(n, base) { return base * Math.floor(n / base);