Skip to main content

Yet another sparkline program/library

Project description

Yet Another Sparkline (yasl)

https://img.shields.io/pypi/l/yasl.svg https://img.shields.io/pypi/pyversions/yasl.svg https://img.shields.io/pypi/wheel/yasl.svg https://img.shields.io/pypi/v/yasl.svg

Why? Well, it is actually really easy to do this and I wanted some different controls that the other programs didn’t have. Also, I like the MIT license.

Usage

You can run it from the command line:

kevin@dalek psl $ sparkbar.py  1 2 3E+0 4
 ▂▅█
kevin@dalek psl $ sparkbar.py -z 1 2 3E+0 4
 ▎▋█
kevin@dalek psl $ sparkbar.py 1 2 3 4 3 2 1 0 3 5
▁▃▄▆▄▃▁ ▄█

Or call it from a python program, this will work with python 2.7 and python 3:

#!/usr/bin/env python

from __future__ import print_function, division
from math import sin, pi
from yasl import Spark

if __name__ == "__main__":
    sp = Spark()
    data = [0,3,6,8.5,7,5,2,8,-8,1]

    print(u'max: {:.2f} min: {:.2f} [{}]'.format(max(data),min(data),sp.vbar(data)))

    data = []
    for i in range(36):
        data.append((sin(4*pi*i/36)))

    print(u'max: {:.2f} min: {:.2f} [{}]'.format(max(data),min(data),sp.hbar(data)))

    sp.dump()
kevin@dalek psl $ python3 example.py
max: 8.50 min: -8.00 [▃▅▆█▇▆▄▇ ▄]
max: 0.98 min: -0.98 [▌▋▊▉██▉▊▋▌▎▏    ▏▎▍▋▊▉▉█▉▊▋▌▎▏    ▏▎]

MIT License

Copyright (c) 2017 Kevin J. Walchko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yasl-1.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

yasl-1.0.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

yasl-1.0.1-py2-none-any.whl (6.5 kB view details)

Uploaded Python 2

File details

Details for the file yasl-1.0.1.tar.gz.

File metadata

  • Download URL: yasl-1.0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for yasl-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1cc22bb0ab893e3e02a349ab89a4da16da5b8d205344ac02dcd19c1214981efa
MD5 698bef6c1e4b243f93bfc335383181ce
BLAKE2b-256 2c43bb309588d606e590afd14e98379bd71be766c0315b4697091abd52b3dc41

See more details on using hashes here.

File details

Details for the file yasl-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for yasl-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4c7f548b4e26018d6b1b4776741bde346b985cdee0ec45c6fe33907e9f45e201
MD5 d442ad545747fe8570bc7a5d10356a5b
BLAKE2b-256 49c1d233ad1c3b2c99b15f003d471877ddab9ebbd0b79949b08069b698e7f61d

See more details on using hashes here.

File details

Details for the file yasl-1.0.1-py2-none-any.whl.

File metadata

File hashes

Hashes for yasl-1.0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 586140e08df63dd09b47f7572e8732ea9574fc03775445c52b090f97d7fa81ab
MD5 b6d1fb38c378eb2217e8b00f3bca3ae6
BLAKE2b-256 9adf9484447cabd2e0a60ae6c3982bcb097e0415c65ed08abc5b2110719f7e0c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page