git ssb

1+

cel / pngspark



Branch:
cel committed Use SSB blobs for images in readmeLatest: 4e33163 on 9/27/2018, 5:33:54 AM
📄.gitignore
📄LICENSE
📄Makefile
📄README.md
📄lupng.c
📄lupng.h
📄main.c
📄package.json
📄pngspark.c
📄pngspark.h
README.md

pngspark

Sparklines as PNGs

histogram

Uses LuPng.

Install

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

Usage

echo 1 2 3 ... | pngspark [-h height] [-c color] [-s scaling] output.png

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

Show a sine wave

seq 1 720 | awk '{print sin($1/30)}' | ./pngspark -o sine.png -h 30 -c 33c011

sine

API

Generate pngsparks in your own C programs!

All int methods return 0 on success and nonzero on failure.

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. Arguments are as in the command-line options.

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.

void pngspark_end(struct pngspark *ps);

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

License

MIT

Built with git-ssb-web