Skip to content

ameowlia/graph-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#graph-ruby

graph-ruby is a Ruby gem that allows you to graph items without leaving the terminal. You don't need JavaScript and you don't need the browser.

See the gem homepage here. ##Setup

In the terminal run

gem install graph-ruby

Add the following to the top of your Ruby file

require 'graph-ruby'

##Usage

###Simple Histogram

# You must store your data as a hash
points = {me: 8, you: 6}
# You must pass in the data as a hash
GraphRuby.histogram{data: points}

# If you want it to clear the screen before it prints the graph use a bang (!)
GraphRuby.histogram!{data: points}

Simple Histogram

###Percentage Histogram

points = {me: 20, you: 20, DHH: 20, Matz: 20, Ada: 20, Rosalind: 20}

# The histogram will graph the percentage of the values
GraphRuby.histogram{data: points, percent: true}

Percentage Histogram ###Change the axis

points = {me: 80, you: 60}

# The Xs in this histogram will each have a value of 10.
# So "me" will have 8 Xs, and "you" will have 6 Xs. Ha, I win.
GraphRuby.histogram{data: points, axis: 10}

changedAxis Histogram

About

A graphing gem for the terminal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages