Skip to content

josephturnerjr/termbar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TermBar draws bar charts in ascii in the terminal. Like this:

                        Monthly Chart
           __________|______________________________
  January !          |#####                         ! 10
 February !          |##########                    ! 20
    March !          |###############               ! 30
    April !          |                              ! 0
      May !          |###############               ! 30
     June !          |###############               ! 30
     July !          |#########################     ! 50
   August !          |##############################! 60
September !     #####|                              ! -10
  October !##########|                              ! -20
 November !          |###########################   ! 55
 December !          |###########                   ! 23
           ----------|------------------------------
         -20                                       60

You can use it by piping in from the command line, like spark:

> awk '{ print length($0)}' termbar | grep -Ev 0 | termbar


  |________________________________________
 !|###########                             ! 21.0
 !|#######                                 ! 14.0
 !|##############                          ! 26.0
 !|###############                         ! 27.0
 !|###########################             ! 49.0
 !|########################################! 72.0
 !|######                                  ! 12.0
 !|##                                      ! 4.0
  |----------------------------------------
 0                                        72.0

Or you can use it as a Python module, in which case you get a little more. You can go minimal...

  __________|______________________________
 !          |#####                         !
 !          |##########                    !
 !          |###############               !
 !          |                              !
 !          |###############               !
 !          |###############               !
 !          |#########################     !
 !          |##############################!
 !     #####|                              !
 !##########|                              !
 !          |###########################   !
 !          |###########                   !
  ----------|------------------------------

...add a title...

             This is the title
  __________|______________________________
 !          |#####                         !
 !          |##########                    !
 !          |###############               !
 !          |                              !
 !          |###############               !
 !          |###############               !
 !          |#########################     !
 !          |##############################!
 !     #####|                              !
 !##########|                              !
 !          |###########################   !
 !          |###########                   !
  ----------|------------------------------

...add series labels...

                      This is the title
           __________|______________________________
  January !          |#####                         !
 February !          |##########                    !
    March !          |###############               !
    April !          |                              !
      May !          |###############               !
     June !          |###############               !
     July !          |#########################     !
   August !          |##############################!
September !     #####|                              !
  October !##########|                              !
 November !          |###########################   !
 December !          |###########                   !
           ----------|------------------------------

...add data labels...

                      This is the title
           __________|______________________________
  January !          |#####                         ! 10
 February !          |##########                    ! 20
    March !          |###############               ! 30
    April !          |                              ! 0
      May !          |###############               ! 30
     June !          |###############               ! 30
     July !          |#########################     ! 50
   August !          |##############################! 60
September !     #####|                              ! -10
  October !##########|                              ! -20
 November !          |###########################   ! 55
 December !          |###########                   ! 23
           ----------|------------------------------

...and add axis labels.

                      This is the title
           __________|______________________________
  January !          |#####                         ! 10
 February !          |##########                    ! 20
    March !          |###############               ! 30
    April !          |                              ! 0
      May !          |###############               ! 30
     June !          |###############               ! 30
     July !          |#########################     ! 50
   August !          |##############################! 60
September !     #####|                              ! -10
  October !##########|                              ! -20
 November !          |###########################   ! 55
 December !          |###########                   ! 23
           ----------|------------------------------
         -20                                       60

About

Draws bar charts in the terminal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages