Histogram

Plots a histogram. The following example plots the Gaussian distribution of a Box Müller algorithm. See example below:

Example code

var graph = new Graph({
	appendTo : "container",
	canvasWidth : 800,
	canvasHeight : 800/Math.sqrt(2),
	colorList : ["#00F"],
	barWidth : 0.8,
	barPosition : "center",
	title : "Box Müller Histogram"
}); 

var y = [];
			
for (var i = 0; i < 1000; i++) {
	r = Math.random();
	s = Math.random();
	y.push(Math.sqrt(-2*Math.log(1-r))*Math.cos(Math.PI*2*s));
}

graph.histogram(y, 40);