process data to histogram