Skip to content

Repository files navigation

piechart

Create SVG pie charts directly from the command line!
Coverity Scan Build Status

Setup

  • Clone the repository
  • Make sure you have a working C compiler
  • Run make within the clone
  • Run make install as root to have piechart installed to your system

Usage

piechart expects one line of data per slice of the chart. Slice properties are separated by a delimiter (Default: ,), with their order specified by the --order argument (Default: value,color,legend). Simply pipe your data into piechart or save it to a file and specify that as an argument. Input lines starting with a # are treated as comments.

Arguments

ArgumentEffectDefault
--delimiter delimiterSet input property delimiter,
--order property-listSet input property order (see below)value,color,legend
--color color-specSet slice default fill color (may be overridden by input data)white
--border color-specSet slice border colorblack
--explode offsetSet slice default explode offset (may be overridden by input data)0
--no-legendDisable legend text output-
--percentPrint percentage right of legend text-
inputfileRead data from inputfile instead of the standard inputstdin

Specifying property order

The property order can be specified by using the --order argument to piechart, supplying a comma-separated list of any of the property keywords below

KeywordEffect
ignoreIgnore the column
valueColumn specifies the absolute value of the slice
legendColumn contains slice legend
colorColumn contains slice fill color
explodeColumn contains slice explode offset

Specifying colors

Since piechart outputs SVG data directly, all HTML/CSS colors may be used. This includes color names like blue and red as well as hex-encoded colors such as #12ab34.

The following special colors are supported

Magic colorEffect
randomGenerate color at random
hsvGenerate colors along HSV cylinder
contrastTry to maximize color contrast of neighboring slices

Why

Because there seems to be no simple tool for creating basic pie charts from the command line, or at least my searches did not turn up anything useful. If you know of anything, please tell me :)

Example output

Output ofpiechart tests/diag3 --order value,explode,color,legend > tests/diag3.svg

Output ofpiechart tests/diag4 --order value,legend --color contrast > tests/diag4_contrast.svg

Output ofpiechart tests/diag4 --order value,legend --color hsv > tests/diag4_hsv.svg

License

See LICENSE.txt

Bugs

Please report any bugs or issues via the GitHub issue tracker.

About

Create SVG pie charts from the command line

Topics

Resources

Stars

12 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages