Class ConsoleHistogramFormatter<T>

  • Type Parameters:
    T - The type of value the histogram counted, which this formatter will format using the provided upperBoundValueFormatter parameter.

    public class ConsoleHistogramFormatter<T>
    extends Object
    Format Histogram contents for a text display. The formatted output consists of a vertical list of labeled histogram buckets, with horizontal bar graphs showing the count in each bucket, followed by a percentage that represents the number of items counted in this bucket as a fraction of all items counted by this histogram.

    Example:

         <= 1 ******                                                         4%
         <= 2 *********************                                         15%
         <= 4 ************************************************************  43%
         <= 8 ************************************************              34%
         >  8 *****                                                          4%
     
    See Also:
    BucketingSystem
    • Constructor Detail

      • ConsoleHistogramFormatter

        public ConsoleHistogramFormatter​(Function<T,String> upperBoundValueFormatter,
                                         int maxBarGraphWidth)
        Create a ConsoleHistogramFormatter that formats upper bound values using upperBoundValueFormatter.
        Parameters:
        upperBoundValueFormatter - A Function that converts an upper bound value into a String representation.
        maxBarGraphWidth - The maximum width of the bar graph portion of the formatted representation.