• Stars
    star
    1,342
  • Rank 33,664 (Top 0.7 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 16 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Gruff graphing library for Ruby

Gruff Graphs

CI Gem Version

A library for making beautiful graphs.

Built on top of rmagick; see its web page for a list of the system-level prerequisities (ImageMagick etc) and how to install them.

Installation

Add this line to your application's Gemfile:

gem 'gruff'

And then execute:

$ bundle

Or install it yourself as:

$ gem install gruff

Font

Gruff uses Roboto font as default font which is licensed under the Apache License, Version 2.0.

Usage

require 'gruff'
g = Gruff::Line.new
g.title = 'Wow!  Look at this!'
g.labels = { 0 => '5/6', 1 => '5/15', 2 => '5/24', 3 => '5/30', 4 => '6/4',
             5 => '6/12', 6 => '6/21', 7 => '6/28' }
g.data :Jimmy, [25, 36, 86, 39, 25, 31, 79, 88]
g.data :Charles, [80, 54, 67, 54, 68, 70, 90, 95]
g.data :Julie, [22, 29, 35, 38, 36, 40, 46, 57]
g.data :Jane, [95, 95, 95, 90, 85, 80, 88, 100]
g.data :Philip, [90, 34, 23, 12, 78, 89, 98, 88]
g.data :Arthur, [5, 10, 13, 11, 6, 16, 22, 32]
g.write('exciting.png')

Examples

You can find many examples in the test directory along with their resulting charts in the expected directory.

Accumulator bar chart

Accumulator bar chart

Area chart

Area chart

Bar chart

Bar chart

Bezier chart

In progress!

Bezier chart

Bullet chart

In progress!

Bullet chart

Dot chart

Dot chart

Line chart

Line chart

LineXY chart

LineXY chart

Net chart

Net chart

Pie chart

Pie chart

Scatter chart

Scatter chart

Side bar chart

Side bar chart

Side stacked bar chart

Side stacked bar chart

Spider chart

Spider chart

Stacked area chart

Stacked area chart

Stacked bar chart

Stacked bar chart

Histogram chart

Histogram chart

Box chart

Box chart

Candlestick

Candlestick

Bubble chart

Bubble chart

Documentation

http://www.rubydoc.info/github/topfunky/gruff/frames

Supported Ruby Versions

  • Ruby 2.6 or later
  • JRuby 9.3.x or later

Development

  1. Build docker image
$ ./docker-build.sh
  1. Launch docker image
$ ./docker-launch.sh
  1. Run tests
$ bundle exec rake

If you have made changes that involve updating the expected image, you need to update the image with the following command after running tests.

$ bundle exec rake test:image:update

Contributing

Source

The source for this project is now kept at GitHub:

http://github.com/topfunky/gruff

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

More Repositories

1

hpple

An XML/HTML parser for Objective-C, inspired by Hpricot.
Objective-C
2,780
star
2

calendar_helper

Calendar-generating plugin for Ruby
Ruby
369
star
3

sparklines

Sparkline library for Ruby
Ruby
156
star
4

PeepOpen

Desktop application for switching between files in text editors
Ruby
106
star
5

ar_fixtures

Dumps YAML fixtures from existing data using ActiveRecord
Ruby
69
star
6

zsh-simple

A simple zsh configuration and prompt. See the PeepCode blog below for a graphical example.
Shell
68
star
7

cappuccino-couchdb

A class for working with CouchDB documents from Cappuccino/Objective-J
Objective-J
65
star
8

osxscreenshot

Ruby wrapper for using webkit2png.py to take screenshots of websites programmatically.
Ruby
64
star
9

google-checkout

Experimental Google Checkout gem
Ruby
62
star
10

sinatra-geoip

Simple IP to lat/long API application using the MaxMind GeoLite database.
C
57
star
11

PeepOpen-EditorSupport

Editor-specific plugins for the PeepOpen file chooser application.
Objective-C
52
star
12

topfunky-sparkline-js

Sparkline graph library using Raphael.js
JavaScript
51
star
13

basic_model

A very thin wrapper around CouchRest, for use with CouchDB and Ruby on Rails.
Ruby
51
star
14

hodel_3000_compliant_logger

Alternate logger for Rails that emits syslog-style output. For use with pl_analyze gem.
Ruby
43
star
15

ruby-hmac

An implementation of the HMAC authentication code in Ruby, originally from Daiki Ueno
Ruby
40
star
16

PeepOpen-Issues

Bug reports and feature requests for the PeepOpen application
40
star
17

peepcode-couchdb-code

Demo code for the PeepCode screencast on CouchDB
Ruby
16
star
18

good_form_builder

Form builder for Rails based on Khoi Vinh's Good Form.
Ruby
16
star
19

peepserver

Capistrano tasks for maintaining a CentOS server such as those at RailsMachine hosting.
Ruby
15
star
20

JSLint.tmbundle

The easiest way to syntax check your JavaScript code from TextMate
JavaScript
15
star
21

peepcode-sphinx-address-book

Code project for the PeepCode Thinking Sphinx PDF book.
Ruby
12
star
22

stakeout

Simple Ruby script that watches files and runs a command.
Ruby
12
star
23

merb_static

A Merb plugin that creates a static version of a website, for deployment to any webserver.
Ruby
10
star
24

unobtrusive

Rails generator for installing Dan Webb's lowpro.js and supporting files.
JavaScript
9
star
25

post-receive-hook

Mimics the GitHub web hook for repos hosted elsewhere
Ruby
9
star
26

stats-js

Cumulative statistical calculations
JavaScript
8
star
27

mosquito

Testing for the Camping micro-web-framework
Ruby
7
star
28

r-nfl-expected-wins

A data model in R that predicts historical total season wins in the NFL
HTML
6
star
29

node.couchapp.backbone.demo

Demo application using Node.js, CouchDB and Backbone.js. For the Seattle Backbone.js meetup.
JavaScript
6
star
30

tidy_table

Generate an HTML table from a Ruby object.
Ruby
6
star
31

geddy-coffee-script-demo

Demo app using CoffeeScript with the Geddy web framework for Node.js
JavaScript
5
star
32

taskpaper-themes

My custom themes for the Taskpaper note taking application
5
star
33

demo-simplest-socket-io

Very simple socket.io demo.
JavaScript
5
star
34

CocoaHelpDemo

Demo application for generating bundled help documentation (requires Flying Meat's VoodoPad application)
Objective-C
4
star
35

sparklines-generator

A Rails generator that creates a controller for generating small graphs from a helper.
Ruby
4
star
36

timelog

A personal Markdown-based time tracker with progress bar and category report
Go
4
star
37

Purple-Monkey-Dishwasher

An example of how to use Cucumber and Rack::Test with Sinatra
Ruby
3
star
38

r-nfl-win-probability

An experiment to build an in-game win probability model in R.
R
3
star
39

help.github.com

GitHub help guides
JavaScript
3
star
40

blog-comments

Issues and comments related to the blog at https://www.topfunky.com
2
star
41

demo-vows-callbacks

A demo for Rob Conery. Nothing to see here.
CoffeeScript
2
star
42

bigapp

An application with many files. For testing only.
Ruby
2
star
43

topfunky.github.com

Topfunky's Page
2
star
44

demo-mocha-watch-bug

A demo to show a bug in mocha's --watch option
JavaScript
2
star
45

terraform-intro-demo

Before and after demo code for a Terraform training class
Shell
1
star
46

katacoda-dev

Experiments with interactive Katacoda tutorials
Makefile
1
star
47

css_graphs

Rails plugin for making HTML markup to display a bar graph.
Ruby
1
star
48

exercism-projects

My personal exercises on exercism.io for learning new languages
Go
1
star
49

hello-demo

Simple Node.js project for demonstrating integration with a CI server.
JavaScript
1
star
50

reviewing-a-pull-request

HTML
1
star
51

r-tennis-win-probability

An experiment in building an in-game win probability predictor for tennis matches
R
1
star