zhaoweikai / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

Allow 'method chaining' for general flot methods #737

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
feature request:
allow for jquery-style 'method chaining' for those flot (& flot plugin) methods 
that return 'void', i.e. those methods that dont return a value (such as the 
'getData()' method);

accomplish this goal by adding 'return this;' to end of each utility function.
this will return the plot object and allow for method chaining (which is a 
standard jquery construct).

example:
var plt=$.plot(obj,data,opts);
plt.highlight(hiPt).setCrosshair(chOpts).doSomePluginMethod(pOpts).doSomeOtherMe
thod(xOpts).doSomethingElse(yOpts);

this change would need to be applied to each existing 'void' method in both the 
base flot library & in each flot plugin. plugin developers would consequently 
be expected to follow the same coding guideline of returning the plot object 
from all general purpose 'void-returning' utility functions.

Original issue reported on code.google.com by changos...@gmail.com on 14 Aug 2012 at 6:39

GoogleCodeExporter commented 9 years ago

Original comment by dnsch...@gmail.com on 16 Aug 2012 at 2:50