Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-11103

Provide an ascii barchart method

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0.0-alpha-1
    • None
    • None

    Description

      Groovy could provide an ascii barchart method. Python and DuckDB both provide methods for doing a simple barchart. Use would be something like this:

      ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'].each{
        println "\n${it.padRight(12)}${bar(it.size(), 0, 10, 10)}"
      }
      

      With this output:

      This isn't trying to be a fully-fledged chart package, just providing one simple option which can be handy when working with the console, command-line or groovysh.

      References:
      https://duckdb.org/docs/sql/functions/char
      https://alexwlchan.net/2018/ascii-bar-charts/
      https://groovy.apache.org/blog/groovy-dauphine

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              paulk Paul King
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: