create image histograms in js