#charts #pie #cli

bin+lib piechart

a library for drawing fancy pie charts in the terminal

4 releases (1 stable)

1.0.0 Apr 20, 2021
0.1.2 Dec 24, 2019
0.1.1 Dec 23, 2019
0.1.0 Dec 23, 2019

#144 in Visualization

Download history 9/week @ 2024-07-22 20/week @ 2024-07-29 19/week @ 2024-08-05 25/week @ 2024-08-12 23/week @ 2024-08-19 36/week @ 2024-08-26 24/week @ 2024-09-02 40/week @ 2024-09-09 24/week @ 2024-09-16 66/week @ 2024-09-23 21/week @ 2024-09-30 17/week @ 2024-10-07 23/week @ 2024-10-14 27/week @ 2024-10-21 28/week @ 2024-10-28 21/week @ 2024-11-04

100 downloads per month
Used in 4 crates

MIT license

26KB
529 lines

piechart

piechart is a rust crate for drawing fancy pie charts in the terminal.

Example usage:

use piechart::{Chart, Color, Data};

fn main() {
    let data = vec![
        Data { label: "Chocolate".into(), value: 4.0, color: Some(Color::Blue.into()), fill: '' },
        Data { label: "Strawberry".into(), value: 2.0, color: Some(Color::Red.into()), fill: '' },
        Data { label: "Vanilla".into(), value: 2.6, color: Some(Color::Yellow.into()), fill: '' },
    ];

    Chart::new()
        .radius(9)
        .aspect_ratio(3)
        .legend(true)
        .draw(&data);
}

will result in

example image

CLI Usage

You can install a small command line tool using this library by running

cargo install piechart --features cli
piechart --radius 5 A:2.0 B:3.0 'Red:4.0:italic magenta strike:ω' 'Blue:1.0:bold italic blue ul:u'

Credits

Developer: Jakob Hellermann

The design and code is heaviliy inspired by piotrmurach's ruby gem.

License

The MIT License (MIT)

Copyright (c) 2019 Jakob Hellermann

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.

Dependencies

~0–7MB
~43K SLoC