Term::Vspark - Displays a graph in the terminal
use Term::Vspark qw/vspark/; binmode STDOUT, ':encoding(UTF-8)'; print vspark( values => [0,1,2,3,4,5], # required labels => [0,1,2,3,4,5], max => 7, # max value columns => 80, # width of the graph including labels ); # The output looks like this: # 0 # 1 ███████████ # 2 ██████████████████████ # 3 █████████████████████████████████ # 4 ████████████████████████████████████████████ # 5 ███████████████████████████████████████████████████████
This module displays beautiful graphs in the terminal. It is a companion to Term::Spark but instead of displaying normal sparklines it displays "vertical" sparklines.
show_graph() returns a string.
The 'values' parameter should be an ArrayRef of numbers. This is required.
The 'labels' parameter should be an ArrayRef of strings. This is optional. Each label will be used with the corresponding value.
The 'max' parameter is the maximum value of the graph. Without this parameter you cannot compare graphs because the scaling changes depending on the data. This parameter is optional.
The 'columns' parameter is the maximum width of the graph. This defaults to your terminal width or 80 characters -- whichever is smaller. Set 'columns' to 'max' if you want to use the full width of your terminal.
Eric Johnson (kablamo)
Gil Gonçalves <lurst@cpan.org> (original author)
Term::Spark
To install Term::Vspark, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Term::Vspark
CPAN shell
perl -MCPAN -e shell install Term::Vspark
For more information on module installation, please visit the detailed CPAN module installation guide.