Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#17029 closed defect (fixed)

commonStacked chart unintentionally overrides global variable

Reported by: neville1355 Owned by: Eugene Lazutkin
Priority: undecided Milestone: 1.9
Component: Charting Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:

Description

Some of our JS code uses google closures's advanced compilation which will rename functions to an unpredictable variable name.

In one specific case, the global variable "v" was chosen, which commonStacked.js unintentionally overrides.

in dojox/charting/plot2d/commonStacked.js

getValue: function(series, i, x){
	var value = null, j, z;
	for(j = 0; j <= i; ++j){
		for(z = 0; z < series[j].data.length; z++){
			v = series[j].data[z];
			if(v !== null){
				if(v.x == x){
					if(!value){
						value = {x: x};
					}
					if(v.y != null){
						if(value.y == null){
							value.y = 0;
						}
						value.y += v.y;
					}
					break;
				}else if(v.x > x){break;}
			}
		}
	}
	return value;
}

Notice that "v" is used but never initialized as a variable. This overrides the global variable if it's being used.

I believe the fix is as simple as adding "v" to the variable initialization near the start of the function.

Change History (2)

comment:1 Changed 6 years ago by bill

Milestone: tbd1.9
Resolution: fixed
Status: newclosed

Fixed already in [29673] right?

comment:2 Changed 6 years ago by neville1355

Looks like it, thanks!

Note: See TracTickets for help on using tickets.