helper constructor for histogram