Commit 49cce02b authored by David Schnur's avatar David Schnur

Add the plot function as a chainable property.

Resolves #734 and #816.
parent 78f2dfdf
...@@ -2681,6 +2681,8 @@ Licensed under the MIT license. ...@@ -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);
...@@ -2692,6 +2694,14 @@ Licensed under the MIT license. ...@@ -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);
......
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