created window function for histogram