fix some tests & gallery entries
[dygraphs.git] / src / extras / smooth-plotter.js
index 119bf3f..d0182f4 100644 (file)
@@ -1,6 +1,13 @@
-var smoothPlotter = (function() {
+(function() {
 "use strict";
 
+var Dygraph;
+if (window.Dygraph) {
+  Dygraph = window.Dygraph;
+} else if (typeof(module) !== 'undefined') {
+  Dygraph = require('../dygraph');
+}
+
 /**
  * Given three sequential points, p0, p1 and p2, find the left and right
  * control points for p1.
@@ -121,6 +128,10 @@ function smoothPlotter(e) {
 smoothPlotter.smoothing = 1/3;
 smoothPlotter._getControlPoints = getControlPoints;  // for testing
 
-return smoothPlotter;
+// older versions exported a global.
+// This will be removed in the future.
+// The preferred way to access smoothPlotter is via Dygraph.smoothPlotter.
+window.smoothPlotter = smoothPlotter;
+Dygraph.smoothPlotter = smoothPlotter;
 
 })();