ascii_utils.hpp

Tools for working with ascii output.

Note

Status: ALPHA

Functions

template<typename T>
void AsciiBarGraph(vector<T> data, size_t max_width = 80, bool show_scale = true, bool max_scale_1 = true, std::ostream &os = std::cout)

The following function prints an ascii bar graph on to the screen (or provided stream).

Parameters:
  • data – Data to graph

  • max_width – What’s the widest bars allowed?

  • show_scale – Should we show the scale at bottom.

  • max_scale_1 – Should we limit scaling to 1:1?

  • os – Where to output the bar graph?

template<typename T>
void AsciiHistogram(vector<T> data, size_t num_bins = 40, size_t max_width = 80, bool show_scale = true, std::ostream &os = std::cout)

Take the input data, break it into bins, and print it as a bar graph.

Parameters:
  • data – Data to graph

  • num_bins – How many bins in histogram?

  • max_width – What’s the widest bars allowed?

  • show_scale – Should we show the scale at bottom?

  • os – Where to output the bar graph?