- send_data( Sparklines.plot( ary, params ),
- :disposition => 'inline',
- :type => 'image/png',
- :filename => "spark_#{params[:type]}.png" )
- end
-
- def spark_pie
- send_data(Sparklines.plot( ))
- end
- # Use this type of method for sparklines that can be cached. (Doesn't work with the helper.)
- #
- # To make caching easier, add a line like this to config/routes.rb:
- # map.sparklines "sparklines/:action/:id/image.png", :controller => "sparklines"
- #
- # Then reference it with the named route:
- # image_tag sparklines_url(:action => 'show', :id => 42)
- def show
- send_data(Sparklines.plot(
- [42, 37, 89, 74, 70, 50, 40, 30, 40, 50],
- :type => 'bar', :above_color => 'orange'
- ),
- :disposition => 'inline',
- :type => 'image/png',
- :filename => "sparkline.png")
- end
-
-
-