generate histogram