public
Description: Generates _why's "bumpspark"-style sparklines (as transparent PNGs). Pure Ruby & Rails support.
Homepage:
Clone URL: git://github.com/bruce/bumpspark.git
name age message
file .document Sun Aug 30 16:31:27 -0700 2009 Initial commit to bumpspark. [bruce]
file .gitignore Sun Aug 30 16:31:27 -0700 2009 Initial commit to bumpspark. [bruce]
file LICENSE Sun Aug 30 19:50:30 -0700 2009 Extraction and refactoring from FiveRuns TuneUp... [bruce]
file README.markdown Thu Oct 22 16:46:38 -0700 2009 Don't flatten volatility by default. In previo... [bruce]
file Rakefile Thu Oct 22 16:57:45 -0700 2009 Update project [bruce]
file TODO.markdown Sun Aug 30 20:50:26 -0700 2009 More doc tweaks. [bruce]
file VERSION Thu Oct 22 17:58:25 -0700 2009 Version bump to 1.1.1 [bruce]
file bumpspark.gemspec Thu Oct 22 17:58:41 -0700 2009 Regenerated gemspec for version 1.1.1 [bruce]
directory lib/ Thu Oct 22 17:58:28 -0700 2009 Pass custom scale [bruce]
directory rails/ Sun Aug 30 20:26:32 -0700 2009 Mix-in to ActionView::Base instead of Applicati... [bruce]
directory test/ Sun Aug 30 19:50:30 -0700 2009 Extraction and refactoring from FiveRuns TuneUp... [bruce]
README.markdown

Bumpspark

Generate "bumpspark"-style sparklines from Ruby & Rails.

Note: This library is based on _why's `bumpspark' code, originally discussed and collaborated on at RedHanded. It has been refactored and built out as a gem suitable for inclusion in Rails projects (and standalone Ruby code).

Bumpsparks are sparklines which show discrete data points and highlight extremes. If you like Tufte and _why, you'll probably like these.

Credits

Thanks to the various collaborators on _why's original post:

  • _why (concept, BMP implementation)
  • jzp (png)
  • MenTaLguY (transparency)

Installation

Since 1.1.0, bumpspark is only released on gemcutter. To install, you can setup gemcutter as your default gem source.

$ gem install gemcutter
$ gem tumble

Then you can install it:

$ gem install bumpspark

You can also just get it in one line:

$ gem install bumpspark -s http://gemcutter.org

Usage

From Rails

  1. Include the gem as a gem dependency in config/environment.rb
  2. Use bumpspark_tag from your views or helpers, passing it the data points you'd like graphed.

    <%= bumpspark_tag [12, 34, 12, 42, 12, 23] %>
    

From Ruby

Simply create a Bumpspark::Graph instance and call to_png on it.

require 'bumpspark'

graph = Bumpspark::Graph.new [12, 34, 12, 42, 12, 23]

File.open('bumpspark.png', 'wb') do |file|
  file.write graph.to_png
end

Note on Patches/Pull Requests

Please check the TODO file for information on things that need doing.

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2009 Bruce Williams, et al. See LICENSE for details.