2 # Provides a tag for embedding sparklines graphs into your Rails app.
4 # To use, load it in your controller with
10 # Geoffrey Grosenbach[mailto:boss@topfunky.com]
16 # This code is licensed under the MIT license.
18 module SparklinesHelper
20 # Call with an array of data and a hash of params for the Sparklines module.
21 # You can also pass :class => 'some_css_class' ('sparkline' by default).
22 def sparkline_tag(results=[], options={})
23 url = { :controller => 'sparklines',
24 :results => results.join(',') }
25 options = url.merge(options)
27 "<img src=\"#{ url_for options }\" class=\"#{options[:class] || 'sparkline'}\" alt=\"Sparkline Graph\" />"