Commits

Anonymous committed 1822ead

Fixed a number of undclared variables polluting the global scope. Updated
jsl.conf to turn back on "options.explicit" to catch these.

Comments (0)

Files changed (20)

src/jqplot.core.js

         catchErrors: false,
         defaultTickFormatString: "%.1f"
     };
-	
-	
+    
+    
     $.jqplot.arrayMax = function( array ){
         return Math.max.apply( Math, array );
     };
-	
+    
     $.jqplot.arrayMin = function( array ){
         return Math.min.apply( Math, array );
     };
         this.borderColor = null;
         // minimum and maximum values on the axis.
         this._dataBounds = {min:null, max:null};
-		// statistics (min, max, mean) as well as actual data intervals for each series attached to axis.
-		// holds collection of {intervals:[], min:, max:, mean: } objects for each series on axis.
-		this._intervalStats = [];
+        // statistics (min, max, mean) as well as actual data intervals for each series attached to axis.
+        // holds collection of {intervals:[], min:, max:, mean: } objects for each series on axis.
+        this._intervalStats = [];
         // pixel position from the top left of the min value and max value on the axis.
         this._offsets = {min:null, max:null};
         this._ticks=[];
     };
     
     Axis.prototype.resetScale = function(opts) {
-		$.extend(true, this, {min: null, max: null, numberTicks: null, tickInterval: null, _ticks: [], ticks: []}, opts);
-		this.resetDataBounds();
+        $.extend(true, this, {min: null, max: null, numberTicks: null, tickInterval: null, _ticks: [], ticks: []}, opts);
+        this.resetDataBounds();
     };
-	
-	Axis.prototype.resetDataBounds = function() {
+    
+    Axis.prototype.resetDataBounds = function() {
         // Go through all the series attached to this axis and find
         // the min/max bounds for this axis.
-		var db = this._dataBounds;
-		db.min = null;
-		db.max = null;
+        var db = this._dataBounds;
+        db.min = null;
+        db.max = null;
         for (var i=0; i<this._series.length; i++) {
             var s = this._series[i];
             var d = s._plotData;
                 }              
             }
         }
-	};
+    };
 
     /**
      * Class: Legend
     Series.prototype.draw = function(sctx, opts, plot) {
         var options = (opts == undefined) ? {} : opts;
         sctx = (sctx == undefined) ? this.canvas._ctx : sctx;
-		
-		var j, data, gridData;
-		
+        
+        var j, data, gridData;
+        
         // hooks get called even if series not shown
         // we don't clear canvas here, it would wipe out all other series as well.
         for (j=0; j<$.jqplot.preDrawSeriesHooks.length; j++) {
         for (j=0; j<$.jqplot.postDrawSeriesHooks.length; j++) {
             $.jqplot.postDrawSeriesHooks[j].call(this, sctx, options);
         }
-		
-		sctx = opts = plot = j = data = gridData = null;
+        
+        sctx = opts = plot = j = data = gridData = null;
     };
     
     Series.prototype.drawShadow = function(sctx, opts, plot) {
         var options = (opts == undefined) ? {} : opts;
         sctx = (sctx == undefined) ? this.shadowCanvas._ctx : sctx;
-		
-		var j, data, gridData;
-		
+        
+        var j, data, gridData;
+        
         // hooks get called even if series not shown
         // we don't clear canvas here, it would wipe out all other series as well.
         for (j=0; j<$.jqplot.preDrawSeriesShadowHooks.length; j++) {
         for (j=0; j<$.jqplot.postDrawSeriesShadowHooks.length; j++) {
             $.jqplot.postDrawSeriesShadowHooks[j].call(this, sctx, options);
         }
-		
-		sctx = opts = plot = j = data = gridData = null;
+        
+        sctx = opts = plot = j = data = gridData = null;
         
     };
     
         this.dataRendererOptions;
         // prop noDataIndicator
         // Options to set up a mock plot with a data loading indicator if no data is specified.
-        this.noDataIndicator = {	
-			show: false,
-			indicator: 'Loading Data...',
-			axes: {
-				xaxis: {
-					min: 0,
-					max: 10,
-					tickInterval: 2,
-					show: true
-				},
-				yaxis: {
-					min: 0,
-					max: 12,
-					tickInterval: 3,
-					show: true
-				}
-			}
-		};
+        this.noDataIndicator = {    
+            show: false,
+            indicator: 'Loading Data...',
+            axes: {
+                xaxis: {
+                    min: 0,
+                    max: 10,
+                    tickInterval: 2,
+                    show: true
+                },
+                yaxis: {
+                    min: 0,
+                    max: 12,
+                    tickInterval: 3,
+                    show: true
+                }
+            }
+        };
         // The id of the dom element to render the plot into
         this.targetId = null;
         // the jquery object for the dom target.
             }
             
             if (options.noDataIndicator && jQuery.isPlainObject(options.noDataIndicator)) {
-				$.extend(true, this.noDataIndicator, options.noDataIndicator);
+                $.extend(true, this.noDataIndicator, options.noDataIndicator);
             }
             
             if (data == null) {
             
             if (jQuery.isArray(data) == false || data.length == 0 || jQuery.isArray(data[0]) == false || data[0].length == 0) {
                 
-				if (this.noDataIndicator.show == false) {
-					throw{
-						name: "DataError",
-						message: "No data to plot."
-					};
-				}
-				
-				else {
-					
-					for (ax in this.noDataIndicator.axes) {
-						for (prop in this.noDataIndicator.axes[ax]) {
-							this.axes[ax][prop] = this.noDataIndicator.axes[ax][prop];
-						}
-					}
-					
-					this.postDrawHooks.add(function() {
-						var eh = this.eventCanvas.getHeight();
-						var ew = this.eventCanvas.getWidth();
-						var temp = $('<div class="jqplot-noData-container" style="position:absolute;"></div>');
-						this.target.append(temp);
-						temp.height(eh);
-						temp.width(ew);
-						temp.css('top', this.eventCanvas._offsets.top);
-						temp.css('left', this.eventCanvas._offsets.left);
-						
-						temp2 = $('<div class="jqplot-noData-contents" style="text-align:center; position:relative; margin-left:auto; margin-right:auto;"></div>');
-						temp.append(temp2);
-						temp2.html(this.noDataIndicator.indicator);
-						var th = temp2.height();
-						var tw = temp2.width();
-						temp2.height(th);
-						temp2.width(tw);
-						temp2.css('top', (eh - th)/2 + 'px');
-					});
+                if (this.noDataIndicator.show == false) {
+                    throw{
+                        name: "DataError",
+                        message: "No data to plot."
+                    };
+                }
+                
+                else {
+                    
+                    for (var ax in this.noDataIndicator.axes) {
+                        for (var prop in this.noDataIndicator.axes[ax]) {
+                            this.axes[ax][prop] = this.noDataIndicator.axes[ax][prop];
+                        }
+                    }
+                    
+                    this.postDrawHooks.add(function() {
+                        var eh = this.eventCanvas.getHeight();
+                        var ew = this.eventCanvas.getWidth();
+                        var temp = $('<div class="jqplot-noData-container" style="position:absolute;"></div>');
+                        this.target.append(temp);
+                        temp.height(eh);
+                        temp.width(ew);
+                        temp.css('top', this.eventCanvas._offsets.top);
+                        temp.css('left', this.eventCanvas._offsets.left);
+                        
+                        var temp2 = $('<div class="jqplot-noData-contents" style="text-align:center; position:relative; margin-left:auto; margin-right:auto;"></div>');
+                        temp.append(temp2);
+                        temp2.html(this.noDataIndicator.indicator);
+                        var th = temp2.height();
+                        var tw = temp2.width();
+                        temp2.height(th);
+                        temp2.width(tw);
+                        temp2.css('top', (eh - th)/2 + 'px');
+                    });
 
-				}
+                }
             }
             
             this.data = data;
         // Parameters:
         // axes - Boolean to reset or not reset all axes or an array or object of axis names to reset.
         this.resetAxesScale = function(axes, options) {
-			var opts = options || {};
+            var opts = options || {};
             var ax = axes || this.axes;
             if (ax === true) {
                 ax = this.axes;
             // If plot doesn't have height and width for some
             // reason, set it by other means.  Plot must not have
             // a display:none attribute, however.
+            
+            //
+            // Wont have options here
+            /*
             if (!this.target.height()) {
                 var h;
                 if (options && options.height) {
             else {
                 this._width = this.target.width();
             }
+            */
+            
+            this._height = this.target.height();
+            this._width = this.target.width();
             
             if (this._height <=0 || this._width <=0 || !this._height || !this._width) {
                 throw "Target dimension not set";
             var resetAxes = opts.resetAxes || false;
             this.target.trigger('jqplotPreReplot');
             if (clear) {
-            	// Couple of posts on Stack Overflow indicate that empty() doesn't
-	            // always cear up the dom and release memory.  Sometimes setting
-	            // innerHTML property to null is needed.  Particularly on IE, may 
-	            // have to directly set it to null, bypassing jQuery.
+                // Couple of posts on Stack Overflow indicate that empty() doesn't
+                // always cear up the dom and release memory.  Sometimes setting
+                // innerHTML property to null is needed.  Particularly on IE, may 
+                // have to directly set it to null, bypassing jQuery.
                 this.target.empty();
             }
             if (resetAxes) {
             clear = (clear != null) ? clear : true;
             this.target.trigger('jqplotPreRedraw');
             if (clear) {
-            	// Couple of posts on Stack Overflow indicate that empty() doesn't
-	            // always cear up the dom and release memory.  Sometimes setting
-	            // innerHTML property to null is needed.  Particularly on IE, may 
-	            // have to directly set it to null, bypassing jQuery.
+                // Couple of posts on Stack Overflow indicate that empty() doesn't
+                // always cear up the dom and release memory.  Sometimes setting
+                // innerHTML property to null is needed.  Particularly on IE, may 
+                // have to directly set it to null, bypassing jQuery.
                 this.target.empty();
             }
              for (var ax in this.axes) {
                 }
                 else {  // draw series before legend
                     this.drawSeries();
-					if (this.series.length) {
-						$(this.series[this.series.length-1].canvas._elem).after(legendElem);
-					}
+                    if (this.series.length) {
+                        $(this.series[this.series.length-1].canvas._elem).after(legendElem);
+                    }
                     this.legend.pack(legendPadding);                
                 }
             
             if (this.captureRightClick) {
                 this.eventCanvas._elem.bind('mouseup', {plot:this}, this.onRightClick);
                 this.eventCanvas._elem.get(0).oncontextmenu = function() {
-					return false;
-				};
+                    return false;
+                };
             }
             else {
                 this.eventCanvas._elem.bind('mouseup', {plot:this}, this.onMouseUp);
                         y = gridpos.y;
                         for (j=0; j<s._barPoints.length; j++) {
                             points = s._barPoints[j];
-							p = s.gridData[j];
+                            p = s.gridData[j];
                             if (x>points[0][0] && x<points[2][0] && y>points[2][1] && y<points[0][1]) {
                                 return {seriesIndex:s.index, pointIndex:j, gridData:p, data:s.data[j], points:s._barPoints[j]};
                             }
                             vfirst = v[0],
                             vlast = v[v.length-1],
                             lex,
-                            rex;
+                            rex,
+                            cv;
     
                         // equations of right and left sides, returns x, y values given height of section (y value and 2 points)
     
                                     var j = numPoints-1;
 
                                     for(var ii=0; ii < numPoints; ii++) { 
-                                    	var vertex1 = [s._areaPoints[ii][0], s._areaPoints[ii][1]];
-                                    	var vertex2 = [s._areaPoints[j][0], s._areaPoints[j][1]];
+                                        var vertex1 = [s._areaPoints[ii][0], s._areaPoints[ii][1]];
+                                        var vertex2 = [s._areaPoints[j][0], s._areaPoints[j][1]];
 
-                                    	if (vertex1[1] < y && vertex2[1] >= y || vertex2[1] < y && vertex1[1] >= y)	 {
-                                    		if (vertex1[0] + (y - vertex1[1]) / (vertex2[1] - vertex1[1]) * (vertex2[0] - vertex1[0]) < x) {
-                                    			inside = !inside;
-                                    		}
-                                    	}
+                                        if (vertex1[1] < y && vertex2[1] >= y || vertex2[1] < y && vertex1[1] >= y)     {
+                                            if (vertex1[0] + (y - vertex1[1]) / (vertex2[1] - vertex1[1]) * (vertex2[0] - vertex1[0]) < x) {
+                                                inside = !inside;
+                                            }
+                                        }
 
-                                    	j = ii;
+                                        j = ii;
                                     }        
                                 }
                                 if (inside) {
                     series.draw(ctx, options, this);
                 }
             }
-			options = idx = i = series = ctx = null;
+            options = idx = i = series = ctx = null;
         };
         
         // method: moveSeriesToFront
         // Useful to put a series back where it belongs after moving
         // it to the front.
         this.restorePreviousSeriesOrder = function () {
-            var i, j, serelem, shadelem, temp;
+            var i, j, serelem, shadelem, temp, move, keep;
             // if no change, return.
             if (this.seriesStack == this.previousSeriesStack) {
                 return;
         // Restore the series canvas order to its original order
         // when the plot was created.
         this.restoreOriginalSeriesOrder = function () {
-            var i, j, arr=[];
+            var i, j, arr=[], serelem, shadelem;
             for (i=0; i<this.series.length; i++) {
                 arr.push(i);
             }
         var pat = /rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *(?:, *[0-9.]*)?\)/;
         var m = s.match(pat);
         var h = '#';
-        for (i=1; i<4; i++) {
+        for (var i=1; i<4; i++) {
             var temp;
             if (m[i].search(/%/) != -1) {
                 temp = parseInt(255*m[i]/100, 10).toString(16);
         var pat = /rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *,? *([0-9.]* *)?\)/;
         var m = rgb.match(pat);
         var ret = [];
-        for (i=1; i<4; i++) {
+        for (var i=1; i<4; i++) {
             if (m[i].search(/%/) != -1) {
                 ret[i-1] = parseInt(255*m[i]/100, 10);
             }

src/jqplot.lineRenderer.js

                             var gridymin = ctx.canvas.height;
                             // IE doesn't return new length on unshift
                             gd.unshift([gd[0][0], gridymin]);
-                            len = gd.length;
+                            var len = gd.length;
                             gd.push([gd[len - 1][0], gridymin]);                   
                         }
                         // if stacked, fill to line below 
     // called with scope of plot.
     // make sure to not leave anything highlighted.
     function postInit(target, data, options) {
-        for (i=0; i<this.series.length; i++) {
+        for (var i=0; i<this.series.length; i++) {
             if (this.series[i].renderer.constructor == $.jqplot.LineRenderer) {
                 // don't allow mouseover and mousedown at same time.
                 if (this.series[i].highlightMouseOver) {

src/jqplot.linearAxisRenderer.js

         
         if (this.show) {
             if (this.name == 'xaxis' || this.name == 'x2axis') {
-                for (i=0; i<ticks.length; i++) {
+                for (var i=0; i<ticks.length; i++) {
                     var t = ticks[i];
                     if (t.show && t.showLabel) {
                         var shim;
                 }
             }
             else {
-                for (i=0; i<ticks.length; i++) {
+                for (var i=0; i<ticks.length; i++) {
                     var t = ticks[i];
                     if (t.show && t.showLabel) {                        
                         var shim;

src/jqplot.sprintf.js

         }
 
 		function thousand_separate(value) {
-			value_str = new String(value);
+			var value_str = new String(value);
 			for (var i=10; i>0; i--) {
 				if (value_str == (value_str = value_str.replace(/^(\d+)(\d{3})/, "$1"+$.jqplot.sprintf.thousandsSeparator+"$2"))) break;
 			}
                 return '';
               }
               var prefix = number < 0 ? '-' : positivePrefix;
-              number_str = thousandSeparation ? thousand_separate(String(Math.abs(number))): String(Math.abs(number));
+              var number_str = thousandSeparation ? thousand_separate(String(Math.abs(number))): String(Math.abs(number));
 			  value = prefix + pad(number_str, precision, '0', false);
               //value = prefix + pad(String(Math.abs(number)), precision, '0', false);
               return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace);
                 return '';
               }
               var prefix = number < 0 ? '-' : positivePrefix;
-              number_str = thousandSeparation ? thousand_separate(String(Math.abs(number))): String(Math.abs(number));
+              var number_str = thousandSeparation ? thousand_separate(String(Math.abs(number))): String(Math.abs(number));
 			  value = prefix + pad(number_str, precision, '0', false);
               return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace);
                   }
                       var prefix = number < 0 ? '-' : positivePrefix;
                       var method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())];
                       var textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) % 2];
-                      number_str = Math.abs(number)[method](precision);
+                      var number_str = Math.abs(number)[method](precision);
                       number_str = thousandSeparation ? thousand_separate(number_str): number_str;
                       value = prefix + number_str;
                       return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace)[textTransform]();

src/jqplot.themeEngine.js

                 }
             }
             
-            for (axname in plot.axes) {
+            for (var axname in plot.axes) {
                 var axis = plot.axes[axname];
                 if (axis.show) {
                     var thaxis = th.axes[axname] || {};
                         redrawPlot = true;
                     }
                     if (axis._ticks && axis._ticks[0]) {
-                        for (nn in thax.ticks) {
+                        for (var nn in thax.ticks) {
                             // val = null;
                             // if (th.axesStyles.ticks && th.axesStyles.ticks[nn] != null) {
                             //     val = th.axesStyles.ticks[nn];
                         }
                     }
                     if (axis._label && axis._label.show) {
-                        for (nn in thax.label) {
+                        for (var nn in thax.label) {
                             // val = null;
                             // if (th.axesStyles.label && th.axesStyles.label[nn] != null) {
                             //     val = th.axesStyles.label[nn];
     
         // Use the jQuery 1.3.2 extend function since behaviour in jQuery 1.4 seems problematic
     $.jqplot.extend = function() {
-    	// copy reference to target object
-    	var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
+        // copy reference to target object
+        var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
 
-    	// Handle a deep copy situation
-    	if ( typeof target === "boolean" ) {
-    		deep = target;
-    		target = arguments[1] || {};
-    		// skip the boolean and the target
-    		i = 2;
-    	}
+        // Handle a deep copy situation
+        if ( typeof target === "boolean" ) {
+            deep = target;
+            target = arguments[1] || {};
+            // skip the boolean and the target
+            i = 2;
+        }
 
-    	// Handle case when target is a string or something (possible in deep copy)
-    	if ( typeof target !== "object" && !toString.call(target) === "[object Function]" ) {
-    	    target = {};
-    	}
+        // Handle case when target is a string or something (possible in deep copy)
+        if ( typeof target !== "object" && !toString.call(target) === "[object Function]" ) {
+            target = {};
+        }
 
-    	for ( ; i < length; i++ ){
-    		// Only deal with non-null/undefined values
-    		if ( (options = arguments[ i ]) != null ) {
-    			// Extend the base object
-    			for ( var name in options ) {
-    				var src = target[ name ], copy = options[ name ];
+        for ( ; i < length; i++ ){
+            // Only deal with non-null/undefined values
+            if ( (options = arguments[ i ]) != null ) {
+                // Extend the base object
+                for ( var name in options ) {
+                    var src = target[ name ], copy = options[ name ];
 
-    				// Prevent never-ending loop
-    				if ( target === copy ) {
-    					continue;
-    				}
+                    // Prevent never-ending loop
+                    if ( target === copy ) {
+                        continue;
+                    }
 
-    				// Recurse if we're merging object values
-    				if ( deep && copy && typeof copy === "object" && !copy.nodeType ) {
-    					target[ name ] = $.jqplot.extend( deep, 
-    						// Never move original objects, clone them
-    						src || ( copy.length != null ? [ ] : { } )
-    					, copy );
+                    // Recurse if we're merging object values
+                    if ( deep && copy && typeof copy === "object" && !copy.nodeType ) {
+                        target[ name ] = $.jqplot.extend( deep, 
+                            // Never move original objects, clone them
+                            src || ( copy.length != null ? [ ] : { } )
+                        , copy );
                     }
-    				// Don't bring in undefined values
-    				else if ( copy !== undefined ) {
-    					target[ name ] = copy;
-    				}
-    			}
-    		}
+                    // Don't bring in undefined values
+                    else if ( copy !== undefined ) {
+                        target[ name ] = copy;
+                    }
+                }
+            }
         }
-    	// Return the modified object
-    	return target;
+        // Return the modified object
+        return target;
     };
 
     /**
             }
             pattern = jsDate.matchers[i];
             if (typeof pattern == 'function') {
-                obj = pattern.call(jsDate, current);
+                var obj = pattern.call(jsDate, current);
                 if (obj instanceof Date) {
                     return obj;
                 }
 ### Defining identifiers
 # By default, "option explicit" is enabled on a per-file basis.
 # To enable this for all files, use "+always_use_option_explicit"
--always_use_option_explicit
++always_use_option_explicit
 
 # Define certain identifiers of which the lint is not aware.
 # (Use this in conjunction with the "undeclared identifier" warning.)
 #
 # Common uses for webpages might be:
-#+define window
-#+define document
++define window
++define document
++define jQuery
++define console
 
 
 ### Files

src/plugins/jqplot.barRenderer.js

         var yaxis = this.yaxis;
         var xp = this._xaxis.series_u2p;
         var yp = this._yaxis.series_u2p;
-        var pointx, pointy, nvals, nseries, pos;
+        var pointx, pointy;
         // clear out data colors.
         this._dataColors = [];
         this._barPoints = [];
         }
         
         var temp = this._plotSeriesInfo = this.renderer.calcSeriesNumbers.call(this);
-        nvals = temp[0];
-        nseries = temp[1];
-        pos = temp[2];
+        var nvals = temp[0];
+        var nseries = temp[1];
+        var pos = temp[2];
+		var points = [];
         
         if (this._stack) {
             this._barNudge = 0;
                 negativeColor = opts.fillStyle;
             }
             var positiveColor = opts.fillStyle;
+			var base;
+			var xstart; 
+			var ystart;
             
             if (this.barDirection == 'vertical') {
                 for (var i=0; i<gridData.length; i++) {
                         continue;
                     }
                     points = [];
-                    var base = gridData[i][0] + this._barNudge;
-                    var ystart;
+                    base = gridData[i][0] + this._barNudge;
+                    ystart;
                     
                     // stacked
                     if (this._stack && this._prevGridData.length) {
                         continue;
                     }
                     points = [];
-                    var base = gridData[i][1] - this._barNudge;
-                    var xstart;
+                    base = gridData[i][1] - this._barNudge;
+                    xstart;
                     
                     if (this._stack && this._prevGridData.length) {
                         xstart = this._prevGridData[i][0];
         var yaxis = this.yaxis;
         var xp = this._xaxis.series_u2p;
         var yp = this._yaxis.series_u2p;
-        var pointx, pointy, nvals, nseries, pos;
+        var pointx, points, pointy, nvals, nseries, pos;
         
         if (this._stack && this.shadow) {
             if (this.barWidth == null) {
     };
     
     function postInit(target, data, options) {
-        for (i=0; i<this.series.length; i++) {
+        for (var i=0; i<this.series.length; i++) {
             if (this.series[i].renderer.constructor == $.jqplot.BarRenderer) {
                 // don't allow mouseover and mousedown at same time.
                 if (this.series[i].highlightMouseOver) {

src/plugins/jqplot.bubbleRenderer.js

         
         // adjust the series colors for options colors passed in with data or for alpha.
         // note, this can leave undefined holes in the seriesColors array.
+        var comps;
         for (var i=0; i<this.data.length; i++) {
             var color = null;
             var d = this.data[i];
             var idx = this.radii[i][0];
             var t=null;
             var color = null;
-            var el = tel = null;
+            var el = null;
+            var tel = null;
             var d = this.data[idx];
             var gd = this.gridData[idx];
             if (d[3]) {
     $.jqplot.BubbleAxisRenderer.prototype.init = function(options){
         $.extend(true, this, options);
         var db = this._dataBounds;
-        var minsidx=minpidx=maxsids=maxpidx=maxr=minr=minMaxRadius=maxMaxRadius=maxMult=minMult=0;
+        var minsidx = 0,
+            minpidx = 0,
+            maxsidx = 0,
+            maxpidx = 0,
+            maxr = 0,
+            minr = 0,
+            minMaxRadius = 0,
+            maxMaxRadius = 0,
+            maxMult = 0,
+            minMult = 0;
         // Go through all the series attached to this axis and find
         // the min/max bounds for this axis.
         for (var i=0; i<this._series.length; i++) {

src/plugins/jqplot.canvasTextRenderer.js

         var total = 0;
         var len = str.length;
  
-        for ( i = 0; i < len; i++) {
+        for (var i = 0; i < len; i++) {
             var c = this.letter(str.charAt(i));
             if (c) {
                 total += c.width * this.normalizedFontSize / 25.0 * this.fontStretch;

src/plugins/jqplot.categoryAxisRenderer.js

         var offmax = offsets.max;
         var offmin = offsets.min;
         var lshow = (this._label == null) ? false : this._label.show;
-        
+        var i;
+		
         for (var p in pos) {
             this._elem.css(p, pos[p]);
         }

src/plugins/jqplot.ciParser.js

     $.jqplot.ciParser = function (data, plot) {
         var ret = [],
             line,
+			temp,
             i, j, k, kk;
     
          if (typeof(data) == "string") {

src/plugins/jqplot.cursor.js

         var zaxes = c._zoom.axes;
         var start = zaxes.start;
         var end = zaxes.end;
-        var min, max;
+        var min, max, dp, span;
         var ctx = plot.plugins.cursor.zoomCanvas._ctx;
         // don't zoom is zoom area is too small (in pixels)
         if ((c.constrainZoomTo == 'none' && Math.abs(gridpos.x - c._zoom.start[0]) > 6 && Math.abs(gridpos.y - c._zoom.start[1]) > 6) || (c.constrainZoomTo == 'x' && Math.abs(gridpos.x - c._zoom.start[0]) > 6) ||  (c.constrainZoomTo == 'y' && Math.abs(gridpos.y - c._zoom.start[1]) > 6)) {
         
     function getIntersectingPoints(plot, x, y) {
         var ret = {indices:[], data:[]};
-        var s, i, d0, d, j, r;
+        var s, i, d0, d, j, r, p;
         var threshold;
         var c = plot.plugins.cursor;
         for (var i=0; i<plot.series.length; i++) {
     // called in context of a Legend
     $.jqplot.CursorLegendRenderer.prototype.draw = function() {
         if (this.show) {
-            var series = this._series;
+            var series = this._series, s;
             // make a table.  one line label per row.
             this._elem = $('<table class="jqplot-legend jqplot-cursor-legend" style="position:absolute"></table>');
         

src/plugins/jqplot.dateAxisRenderer.js

 				sum += intv;              
             }
 			
-			var tempf=tempn=0;
-			for (n in stats.frequencies) {
+			var tempf = 0,
+				tempn=0;
+			for (var n in stats.frequencies) {
 				stats.sortedIntervals.push({interval:n, frequency:stats.frequencies[n]});
 			}
 			stats.sortedIntervals.sort(function(a, b){

src/plugins/jqplot.enhancedLegendRenderer.js

         var legend = this;
         if (this.show) {
             var series = this._series;
+			var s;
             var ss = 'position:absolute;';
             ss += (this.background) ? 'background:'+this.background+';' : '';
             ss += (this.border) ? 'border:'+this.border+';' : '';
     };
     
     // called with scope of plot.
-    postDraw = function () {
+    var postDraw = function () {
         if (this.legend.renderer.constructor == $.jqplot.EnhancedLegendRenderer && this.legend.seriesToggle){
             var e = this.legend._elem.detach();
             this.eventCanvas._elem.after(e);

src/plugins/jqplot.funnelRenderer.js

     function postInit(target, data, options) {
         // if multiple series, add a reference to the previous one so that
         // funnel rings can nest.
-        for (i=0; i<this.series.length; i++) {
+        for (var i=0; i<this.series.length; i++) {
             if (this.series[i].renderer.constructor == $.jqplot.FunnelRenderer) {
                 // don't allow mouseover and mousedown at same time.
                 if (this.series[i].highlightMouseOver) {

src/plugins/jqplot.logAxisRenderer.js

         var ticks = this._ticks;
         var trans = function (v) { return Math.log(v)/Math.log(lb); };
         var invtrans = function (v) { return Math.pow(Math.E, (Math.log(lb)*v)); };
-        max = trans(this.max);
-        min = trans(this.min);
+        var max = trans(this.max);
+        var min = trans(this.min);
         var offmax = offsets.max;
         var offmin = offsets.min;
         var lshow = (this._label == null) ? false : this._label.show;
         
         if (this.show) {
             if (this.name == 'xaxis' || this.name == 'x2axis') {
-                for (i=0; i<ticks.length; i++) {
+                for (var i=0; i<ticks.length; i++) {
                     var t = ticks[i];
                     if (t.show && t.showLabel) {
                         var shim;
                 }
             }
             else {
-                for (i=0; i<ticks.length; i++) {
+                for (var i=0; i<ticks.length; i++) {
                     var t = ticks[i];
                     if (t.show && t.showLabel) {                        
                         var shim;

src/plugins/jqplot.mekkoAxisRenderer.js

         
         if (this.show) {
             if (this.name == 'xaxis' || this.name == 'x2axis') {
-                for (i=0; i<ticks.length; i++) {
+                for (var i=0; i<ticks.length; i++) {
                     var t = ticks[i];
                     if (t.show && t.showLabel) {
                         var shim;
                 }
                 // now show the labels under the bars.
                 var b, l, r;
-                for (i=0; i<this.barLabels.length; i++) {
+                for (var i=0; i<this.barLabels.length; i++) {
                     b = this._barLabels[i];
                     if (b.show) {
                         w = b.getWidth();
                 }
             }
             else {
-                for (i=0; i<ticks.length; i++) {
+                for (var i=0; i<ticks.length; i++) {
                     var t = ticks[i];
                     if (t.show && t.showLabel) {                        
                         var shim;

src/plugins/jqplot.meterGaugeRenderer.js

         
     function getnmt(pos, interval, fact) {
         var temp;
-        for (i=pos.length-1; i>=0; i--) {
+        for (var i=pos.length-1; i>=0; i--) {
             temp = interval/(pos[i] * Math.pow(10, fact));
             if (temp == 4 || temp == 5) {
                 return temp - 1;
                     this.numberMinorTicks = 1;
                     var nums = [4, 5, 3, 6, 2];
                     for (i=0; i<5; i++) {
-                        temp = this.tickInterval/nums[i];
-                        if (temp == parseInt(temp)) {
+                        var temp = this.tickInterval/nums[i];
+                        if (temp == parseInt(temp, 10)) {
                             this.numberMinorTicks = nums[i]-1;
                             break;
                         }
             
             // draw the tick labels
             if (this.showTickLabels) {
-                var elem, l, t, ew, dim, maxdim=0;
+                var elem, l, t, ew, eh, dim, maxdim=0;
                 var tp = this.tickPadding * (1 - 1/(this.diameter/80+1));
                 for (i=0; i<this.ticks.length; i++) {
                     elem = $('<div class="jqplot-meterGauge-tick" style="position:absolute;">'+this.ticks[i][1]+'</div>');

src/plugins/jqplot.pieRenderer.js

             
             var pad = false, 
                 reverse = false,
-                nr, nc;
+                nr, 
+				nc;
             var s = series[0];
             var colorGenerator = new $.jqplot.ColorGenerator(s.seriesColors);
             
     }
     
     function postInit(target, data, options) {
-        for (i=0; i<this.series.length; i++) {
+        for (var i=0; i<this.series.length; i++) {
             if (this.series[i].renderer.constructor == $.jqplot.PieRenderer) {
                 // don't allow mouseover and mousedown at same time.
                 if (this.series[i].highlightMouseOver) {