Permalink
Browse files

Add the plot function as a chainable property.

Resolves #734 and #816.
  • Loading branch information...
1 parent 78f2dfd commit 49cce02be913b5b35a350a3fc89359150e351e3a @dnschnur committed Feb 8, 2013
Showing with 10 additions and 0 deletions.
  1. +10 −0 jquery.flot.js
View
@@ -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);

0 comments on commit 49cce02

Please sign in to comment.