Skip to content

Commit

Permalink
Add the plot function as a chainable property.
Browse files Browse the repository at this point in the history
Resolves flot#734 and flot#816.
  • Loading branch information
dnschnur committed Feb 8, 2013
1 parent 78f2dfd commit 49cce02
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions jquery.flot.js
Expand Up @@ -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) { $.plot = function(placeholder, data, options) {
//var t0 = new Date(); //var t0 = new Date();
var plot = new Plot($(placeholder), data, options, $.plot.plugins); var plot = new Plot($(placeholder), data, options, $.plot.plugins);
Expand All @@ -2692,6 +2694,14 @@ Licensed under the MIT license.


$.plot.plugins = []; $.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 // round to nearby lower multiple of base
function floorInBase(n, base) { function floorInBase(n, base) {
return base * Math.floor(n / base); return base * Math.floor(n / base);
Expand Down

0 comments on commit 49cce02

Please sign in to comment.