Sha256: 08215d907ff10985a49545e9c05257dc66fd1f84620d6b9b14eddc4499e278d7

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

define("dojox/color/MeanColorModel", ["dojo/_base/array", "dojo/_base/declare", "./NeutralColorModel"],
	function(arr, declare, NeutralColorModel){
	
	return declare("dojox.color.MeanColorModel", NeutralColorModel, {
		// summary:
		//		A color model that returns a color from a data value
		//		using an interpolation between two extremum colors around the mean value.
			
		constructor: function(startColor, endColor){
			// startColor: dojo/_base/Color
			//		The start color.
			// endColor: dojo/_base/Color?
			//		The end color.
		},
			
		computeNeutral: function(min, max, sum, values){
			// summary:
			//		Return the neutral value in this case the mean value of the data values.
			// min: Number
			//		The minimal value.
			// max: Number
			//		The maximum value.
			// sum: Number
			//		The sum of all values.
			// values: Number[]
			//		The sorted array of values used to compute colors.			
			var median = min;
			if(values.length != 0){
				if(values.length < 3){
					median = sum / values.length;
				}else if((values.length & 1) == 0){
					median = (values[values.length / 2 - 1] + values[values.length / 2]) / 2;
				}else{
					median = values[Math.floor(values.length / 2)];
				}
			}
			return median;
		}
	});
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dojox-rails-0.11.0 vendor/assets/javascripts/color/MeanColorModel.js.uncompressed.js