Tiny Rust library to draw pretty line graphs using ascii characters.

Overview

rasciigraph

Tiny Rust library to draw pretty line graphs using ascii characters.

Usage

Add this to your Cargo.toml

[dependencies]
rasciigraph = "0.1.1"

Add this line of code to top of your source code

extern crate rasciigraph;

If you prefer to use Rust 2018 edition you may prefer to add this line to your source code

use rasciigraph::{plot, Config}

Examples

This code

extern crate rasciigraph;

use rasciigraph::{plot, Config};

fn main() {
    println!(
        "{}",
        plot(
            vec![
                0.0, 0.0, 0.0, 0.0, 1.5, 0.0, 0.0, -0.5, 9.0, -3.0, 0.0, 0.0, 1.0, 2.0, 1.0, 0.0,
                0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, 0.0, 0.0, -0.5, 8.0, -3.0, 0.0, 0.0, 1.0,
                2.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, 0.0, 0.0, -0.5, 10.0, -3.0,
                0.0, 0.0, 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, 0.0
            ],
            Config::default()
                .with_offset(10)
                .with_height(10)
                .with_caption("I'm a doctor, not an engineer.".to_string())
        )
    );
}

Produces an output like this

  10.00   ┤                                             ╭╮          
  8.70    ┤       ╭╮                                    ││          
  7.40    ┼       ││                 ╭╮                 ││          
  6.10    ┤       ││                 ││                 ││          
  4.80    ┤       ││                 ││                 ││          
  3.50    ┤       ││                 ││                 ││          
  2.20    ┤       ││   ╭╮            ││   ╭╮            ││   ╭╮     
  0.90    ┤   ╭╮  ││  ╭╯╰╮       ╭╮  ││  ╭╯╰╮       ╭╮  ││  ╭╯╰╮    
 -0.40    ┼───╯╰──╯│╭─╯  ╰───────╯╰──╯│╭─╯  ╰───────╯╰──╯│╭─╯  ╰─── 
 -1.70    ┤        ││                 ││                 ││         
 -3.00    ┤        ╰╯                 ╰╯                 ╰╯        
             I'm a doctor, not an engineer.

Acknowledgement

This crate is rustlang port of library asciigraph written by @guptarohit.

Above library is also port of library asciichart written by @kroitor.

You might also like...
Kusa is a simple CLI tool that works on any platform and displays GitHub contribution graphs.
Kusa is a simple CLI tool that works on any platform and displays GitHub contribution graphs.

Kusa is a simple CLI tool that works on any platform and displays GitHub contribution graphs. Installation Homebrew (only macOS) $ brew tap Ryu0118/Ku

A small CLI tool to query ArcGIS REST API services, implemented in Rust. The server response is returned as pretty JSON.

A small CLI tool to query ArcGIS REST API services, implemented in Rust. The server response is returned as pretty JSON.

😎 Pretty way of writing regular expressions in Rust

🔮 Write readable regular expressions The crate provides a clean and readable way of writing your regex in the Rust programming language: Without pret

📺(tv) Tidy Viewer is a cross-platform CLI csv pretty printer that uses column styling to maximize viewer enjoyment.
📺(tv) Tidy Viewer is a cross-platform CLI csv pretty printer that uses column styling to maximize viewer enjoyment.

📺(tv) Tidy Viewer is a cross-platform CLI csv pretty printer that uses column styling to maximize viewer enjoyment.

Small CLI for escaping and unescaping characters in strings

🐌 esc Small CLI for escaping characters in strings. Install cargo install esc Usage cat LICENSE-MIT | esc escape | pbcopy pbpaste | esc unescape | pb

`boxy` - declarative box-drawing characters

boxy - declarative box-drawing characters Box-drawing characters are used extensively in text user interfaces software for drawing lines, boxes, and o

Alexander Mongus is a state-of-the-art filter to sneak amogus characters in pictures
Alexander Mongus is a state-of-the-art filter to sneak amogus characters in pictures

A. Mongus Go to: http://www.lortex.org/amogu/ ??? This is a client-side, Webassembly-based filter to hide amongus characters in your images. Example:

A pretty (simple) alternative to strace

lurk lurk is a simple and pretty alternative to strace. It allows the user to trace system calls of a process or of a command. In contrast to strace,

A tool to convert old and outdated "characters" into the superior Rustcii-Encoding.

rustcii A tool to convert old and outdated "characters" into the superior Rustcii-Encoding. Speak your mind. Blazingly ( 🦀 ) fast ( 🚀 ). Github | cr

Releases(0.1.1)
Owner
Orhan Balci
Orhan Balci
Tool to draw low-resolution graphs in terminal

lowcharts Tool to draw low-resolution graphs in terminal. lowcharts is meant to be used in those scenarios where we have numerical data in text files

juanleon lahoz 114 Dec 31, 2022
A Rust library for drawing grid-based user interfaces using ASCII characters.

grux A library for drawing grid-based user interfaces using ASCII characters. // Provides a uniform interface for drawing to a 2D grid. use grux::Grid

Matan Lurey 4 Jan 10, 2023
Perspective projection of a spinning cube, using just ASCII characters.

Spinning Cube Perspective projection of a spinning cube, using just ASCII characters. spinning_cube.mp4 Instalation cargo install spinning_cube Basic

Guilherme Pagano 5 Aug 31, 2023
App to collect ram/cpu usage from OS and show it in pretty graphs

System info collector This is simple app to collect data about system cpu and memory usage over time. After collecting results into csv file, html fil

Rafał Mikrut 3 Jul 11, 2023
A terminal ASCII media player. View images, gifs, videos, webcam, YouTube, etc.. directly in the terminal as ASCII art.

Terminal Media Player View images, videos (files or YouTube links), webcam, etc directly in the terminal as ASCII. All images you see below are just m

Max Curzi 36 May 8, 2023
omekasy is a command line application that converts alphanumeric characters in your input to various styles defined in Unicode.

omekasy is a command line application that converts alphanumeric characters in your input to various styles defined in Unicode. omekasy means "dress up" in Japanese.

null 105 Nov 16, 2022
A fantastic crate for fmting numbers using the appropriate unciode characters.

fmtastic ✨ A fantastic crate for fmting numbers using the appropriate unicode characters via the Display trait. ✨ Supports vulgar fractions, super- an

~bash 8 May 26, 2023
An easy to use library for pretty print tables of Rust structs and enums.

tabled An easy to use library for pretty printing tables of Rust structs and enums. Table of Contents Usage Settings Style Themes ASCII Psql Github Ma

Maxim Zhiburt 1.3k Jan 9, 2023
Build terminal dashboards using ascii/ansi art and javascript

blessed-contrib Build dashboards (or any other application) using ascii/ansi art and javascript. Friendly to terminals, ssh and developers.

Yaron Naveh 15k Jan 2, 2023
Track and query Cargo dependency graphs.

cargo-guppy: track and query dependency graphs This repository contains the source code for: guppy: a library for performing queries on Cargo dependen

guppy 42 Dec 30, 2022