Create JavaScript image histograms with Canvas