git ssb

1+

cel / pngspark



Tree: 8f7167526adbf2293f5bbdbbe0683d268185c5e0

Files: 8f7167526adbf2293f5bbdbbe0683d268185c5e0 / README.md

1488 bytesRaw

pngspark

Sparklines as PNGs

histogram

Install

make
[sudo] make install [PREFIX=/usr/local]

Usage

pngspark [-h height] [-c color] [-s scaling] output.png

Pipe numbers to pngspark to add them to the image.

Options

Examples

Display BTC ticker data

curl -s https://api.bitcoinaverage.com/history/USD/per_minute_24h_sliding_window.csv | sed 1d | cut -d, -f2 | ./pngspark -o btc.png -s 0.995 -h 80 -c 0066cc

btc

API

struct pngspark;

A png spark instance: collection of values and settings.

int pngspark_init(struct pngspark *ps, size_t height, const char *color, double scaling);

Initialize a pngspark struct.

int pngspark_append(struct pngspark *ps, double, value);

Append a value to the pngspark.

int pngspark_write(struct pngspark *ps, FILE *file);

Process the values and write as a PNG to a file.

int pngspark_end(struct pngspark *ps);

Release allocated memory for the pngspark. (Does not free ps, however).

License

MIT

Built with git-ssb-web