= google_otg Author:: Eric Silverberg (http://www.ericsilverberg.com) Copyright:: Copyright (c) 2009 Eric Silverberg License:: MIT (Go Beavers!) Git:: http://github.com/esilverberg/google_otg/tree/master This plugin adds helpers to include Google's pretty over time line graph in your rails application. You will recognize this line graph from Google Analytics. Many features are missing, including support for multiple lines and colors. Feel free to add. == Requirements You must be able to generate arrays of objects that respond to "count" and "created_at". The X-axis is presumed to be dates. You can control time step of the x-axis. == Example Usage In your controller: @hits_last_week = Hits.find_by_sql([" SELECT DAYOFYEAR(hits.created_at) as d, DATE(hits.created_at) as created_at, count(*) as count FROM hits WHERE hits.created_at > UTC_TIMESTAMP() - INTERVAL 7 DAY GROUP BY d ORDER BY created_at"]) In your view: <%= over_time_graph(@hits_last_week) %> or <%= over_time_graph(@hits_last_week, :label => "Hits", :range => 1440, :x_label_format => "%A, %B %d", :src => "/google/OverTimeGraph.swf") %> == +over_time_graph+ Some of the options available: :label:: The label of quantity being measured :range:: The time step, in minutes :x_label_format:: The time format for the x label :src:: An optional local source to serve this widget (otherwise will serve from Google) == Copyright Copyright (c) 2009 esilverberg. See LICENSE for details.