Skip to content

compute range

kgryte edited this page May 12, 2015 · 1 revision

Computes the arithmetic range of an array.

var data = [ 2, 4, 2, 7, 3 ];

var range = compute.range( data );
// returns [2,7]

For object arrays, provide an accessor function for accessing array values

var data = [
	[1,2],
	[2,4],
	[3,2],
	[4,7],
	[5,3]
];

function getValue( d ) {
	return d[ 1 ];
}

var range = compute.range( data, getValue );
// returns [2,7]
Clone this wiki locally