projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add plugins option to Dygraphs. Add demo-test. Add test.
[dygraphs.git]
/
dygraph.js
diff --git
a/dygraph.js
b/dygraph.js
index
1ac7d43
..
29c343b
100644
(file)
--- a/
dygraph.js
+++ b/
dygraph.js
@@
-282,6
+282,8
@@
Dygraph.DEFAULT_ATTRS = {
Dygraph.Plotters.linePlotter
],
Dygraph.Plotters.linePlotter
],
+ plugins : [ ],
+
// per-axis options
axes: {
x: {
// per-axis options
axes: {
x: {
@@
-452,8
+454,9
@@
Dygraph.prototype.__init__ = function(div, file, attrs) {
// Activate plugins.
this.plugins_ = [];
// Activate plugins.
this.plugins_ = [];
- for (var i = 0; i < Dygraph.PLUGINS.length; i++) {
- var Plugin = Dygraph.PLUGINS[i];
+ var plugins = Dygraph.PLUGINS.concat(this.getOption('plugins'));
+ for (var i = 0; i < plugins.length; i++) {
+ var Plugin = plugins[i];
var pluginInstance = new Plugin();
var pluginDict = {
plugin: pluginInstance,
var pluginInstance = new Plugin();
var pluginDict = {
plugin: pluginInstance,