Term::Vspark
Displays beautiful graphs to use in the terminal
Returns a string with a single utf8 bar according to the values
Term::Vspark::show_bar($value_for_this_bar, $max_value, $number_of_columns_to_display);
Returns a string with a various utf8 bars according to the values
Term::Vspark::show_graph('values' => \@values_for_this_graph, 'max' => $max_value, 'columns' => $number_of_columns_to_display);
Example:
use Term::Vspark; use Term::Size; chomp( @ARGV = <STDIN> ) unless @ARGV; my @list = sort { $a <=> $b } @ARGV; my ($columns, $rows) = Term::Size::chars *STDOUT{IO}; print Term::Vspark::show_graph( 'max' => $list[-1], 'columns' => $columns, 'values' => \@ARGV, );
Example 2:
chomp( @ARGV = <STDIN> ) unless @ARGV; my %k_values = @ARGV; my @list = sort { $a <=> $b } values %k_values; print Term::Vspark::show_labeled_graph( 'max' => $list[-1], 'columns' => 10, 'k_values' => \%k_values, );
This will receive numbers from ARGV or STDIN and print out beutiful graph based on that data.
Term::Vspark - Perl extension for dispaying bars in the terminal
Original repo: https://github.com/LuRsT/vspark
Gil Gonçalves <lurst@cpan.org>
This software is copyright (c) 2013 by Gil Gonçalves.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
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.