Commits

zeratul2099 committed 868f43d

added documentation to multipleFillBettween plugin

Comments (0)

Files changed (1)

src/plugins/jqplot.multipleFillBetween.js

         //
         //prop: show
         this.show = $.jqplot.config.enablePlugins;
+        //prop: fillConfigs
+        // Array of configurations for the fills. Each configuation must have the following attributes:
+        // series1: Required, if missing won't fill. Index of the first series.
+        // series2: Required, if missing won't fill. Index of the second series.
+        // color: Optional, defaults to fillColor of series1.
+        // baseSeries:  Optional.  Put fill on a layer below this series
+        // index.  Defaults to 0 (first series).  If an index higher than 0 is
+        // used, fill will hide series below it.
+        // fill:  Optional, defaults to true.  False to turn off fill.  
         this.fillConfigs = [];
 
         $.extend(true, this, options);
     $.jqplot.MultipleFillBetween.postPlotDraw = function() {
         for (idx in this.plugins.multipleFillBetween.fillConfigs) {
             var fb = this.plugins.multipleFillBetween.fillConfigs[idx];
-            var sid1 = fb.series1;
-            var sid2 = fb.series2;
-            // first series should always be lowest index
-            var id1 = (sid1 < sid2) ? sid1 : sid2;
-            var id2 = (sid2 >  sid1) ? sid2 : sid1;
+            if (fb.fill) {
+                var sid1 = fb.series1;
+                var sid2 = fb.series2;
+                // first series should always be lowest index
+                var id1 = (sid1 < sid2) ? sid1 : sid2;
+                var id2 = (sid2 >  sid1) ? sid2 : sid1;
 
-            var series1 = this.series[id1];
-            var series2 = this.series[id2];
-            if (series2.renderer.smooth) {
-                var tempgd = series2.renderer._smoothedData.slice(0).reverse();
-            }
-            else {
-                var tempgd = series2.gridData.slice(0).reverse();
-            }
+                var series1 = this.series[id1];
+                var series2 = this.series[id2];
+                if (series2.renderer.smooth) {
+                    var tempgd = series2.renderer._smoothedData.slice(0).reverse();
+                }
+                else {
+                    var tempgd = series2.gridData.slice(0).reverse();
+                }
 
-            if (series1.renderer.smooth) {
-                var gd = series1.renderer._smoothedData.concat(tempgd);
-            }
-            else {
-                var gd = series1.gridData.concat(tempgd);
-            }
+                if (series1.renderer.smooth) {
+                    var gd = series1.renderer._smoothedData.concat(tempgd);
+                }
+                else {
+                    var gd = series1.gridData.concat(tempgd);
+                }
 
-            var color = (fb.color !== null) ? fb.color : this.series[sid1].fillColor;
-            var baseSeries = (fb.baseSeries !== null) ? fb.baseSeries : id1;
+                var color = (fb.color !== null) ? fb.color : this.series[sid1].fillColor;
+                var baseSeries = (fb.baseSeries !== null) ? fb.baseSeries : id1;
 
-            // now apply a fill to the shape on the lower series shadow canvas,
-            // so it is behind both series.
-            var sr = this.series[baseSeries].renderer.shapeRenderer;
-            var opts = {fillStyle: color, fill: true, closePath: true};
-            sr.draw(series1.shadowCanvas._ctx, gd, opts);
+                // now apply a fill to the shape on the lower series shadow canvas,
+                // so it is behind both series.
+                var sr = this.series[baseSeries].renderer.shapeRenderer;
+                var opts = {fillStyle: color, fill: true, closePath: true};
+                sr.draw(series1.shadowCanvas._ctx, gd, opts);
+            };
         };
     };