Day 23: App::chart and Text::chart

About the series: perlancar's 2014 Advent Calendar: Introduction to a selection of 24 modules which I published in 2014. Table of contents.

Text::Graph module, which I have also used, but ran into some minor problems and limitations in formatting. Unfortunately there's not much thing to show right now as the only type of chart implemented is sparkline (but this is not available in Text::Graph).

And there's a CLI for that(TM). chart (from App-chart) is a CLI for Text::Chart that accepts data from command-line arguments or YAML/JSON/Perl file and can output graphs for you. Examples:

% chart -t sparkline 1 2 3 7 10 12 2 0 1
▂▂▃▅▇█▂ ▂

% chart -t sparkline -H 5 1 2 3 7 10 12 2 0 1
    ▂█
    ██
   ▇██
  ▃███
▄▇████▇ ▄

I do plan to add colors, support other chart types, and play with formatting and weird Unicode characters. But since my primary itch of producing sparklines of various height (the original reason I wrote both modules) had been scratched, things will have to progress more slowly.

(Note that the latter module is not visible/indexed by PAUSE because the "chart" package is already occupied by another distribution. It does not seem to be really used though so I have sent the author SANTEX an email requesting whether or not he'll let me have the package name. If not then I will have to rename the CLI to something else.)

Leave a comment

About perlancar

user-pic #perl #indonesia