Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Ruby Rack module for generating sparkline graphs on the fly

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 demos
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
Octocat-spinner-32 sparkplug.gemspec


Dynamically generates sparkline graphs from a set of numbers. This is done primarily through Handlers and Cachers. Handlers know how to fetch the data, and Cachers know how to cache the generated PNG sparkline for future requests.

pub_dir   = File.expand_path(File.join(File.dirname(__FILE__), 'public'))
data_dir  = File.join(pub_dir, 'temps')
cache_dir = File.join(pub_dir, 'sparks')

use Sparkplug, :prefix => 'sparks',
  :handler =>,
  :cacher  =>
  • An incoming request hits your Rack application at “/sparks/foo/stats.csv”.

  • The CSV Handler gets 'foo/stats.csv', and checks for this file in its data directory. It parses the first row of numbers as the set of points to plot.

  • The Filesystem Cacher checks for a more recent cache. Failing that, it generates the PNG graph and writes it to the cache directory.

Mix and match your own handlers and cachers with your friends!


See demo/sparkplug_demo.rb or


gem install sparkplug


Copyright © 2009 rick. See LICENSE for details.

Something went wrong with that request. Please try again.