Skip to content
This repository

Allow 'method chaining' for general flot methods #816

Closed
dnschnur opened this Issue September 28, 2012 · 0 comments

1 participant

David Schnur
David Schnur
Owner

Original author: changos...@gmail.com (August 14, 2012 18:39:46)

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).doSomeOtherMethod(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: http://code.google.com/p/flot/issues/detail?id=737

David Schnur dnschnur referenced this issue from a commit in dnschnur/flot February 07, 2013
David Schnur Add the plot function as a chainable property.
Resolves #734 and #816.
49cce02
David Schnur dnschnur closed this February 09, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.