Calculate max count when building the histogram

Calculate max count when building the histogram since we are already
looping through the histogram instead of delaying until when displaying
the histogram