| change README to make clear this is not a fork of ReportsAsSparkline - reportab… | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit 767cf13ad94d36d58ef617042bf4f114d70a3ac5 | |
| parent 0411548e003b4d667dba9a57bc29a6d52f6b7f04 | |
| Author: Marco Otte-Witte <[email protected]> | |
| Date: Mon, 8 Feb 2010 18:17:00 +0100 | |
| change README to make clear this is not a fork of ReportsAsSparkline | |
| Diffstat: | |
| M README.rdoc | 145 +----------------------------… | |
| 1 file changed, 3 insertions(+), 142 deletions(-) | |
| --- | |
| diff --git a/README.rdoc b/README.rdoc | |
| @@ -1,143 +1,3 @@ | |
| -= ReportsAsSparkline | |
| += Reportable | |
| -ReportsAsSparkline enables you to generate sparkline reports from your model's… | |
| - | |
| -See the API docs at http://docs.github.com/marcoow/reports_as_sparkline. | |
| - | |
| -The CI server is at http://ci.saulabs.com/reportsassparkline. | |
| - | |
| -== Usage | |
| - | |
| -If you hace a +User+ model with +created_at+ and +activated_at+ columns, you c… | |
| -to it with the following options: | |
| - | |
| -* <tt>:date_column</tt> - The name of the date column over that the records ar… | |
| -* <tt>:value_column</tt> - The name of the column that holds the values to sum… | |
| -* <tt>:aggregation</tt> - The aggregation to use (one of <tt>:count</tt>, <tt>… | |
| -* <tt>:grouping</tt> - The period records are grouped on (<tt>:hour</tt>, <tt>… | |
| -* <tt>:limit</tt> - The number of reporting periods to get (see <tt>:grouping<… | |
| -* <tt>:conditions</tt> - Conditions like in <tt>ActiveRecord::Base#find</tt>; … | |
| -* <tt>:live_data</tt> - Specifies whether data for the current reporting perio… | |
| -* <tt>:end_date</tt> - When specified, the report will only include data for t… | |
| - | |
| -<b>Example:</b> | |
| - | |
| - class User < ActiveRecord::Base | |
| - reports_as_sparkline :registrations | |
| - reports_as_sparkline :activations, :date_column => :activated_at | |
| - reports_as_sparkline :total_users, :cumulate => true | |
| - end | |
| - | |
| -This will add the following class methods to your User model: | |
| - | |
| - User.registrations_report | |
| - User.activations_report | |
| - User.total_users_report | |
| - | |
| -When invoking the report, you can override some of the options you specified f… | |
| - | |
| -* <tt>:grouping</tt> - The period records are grouped on (<tt>:hour</tt>, <tt>… | |
| -* <tt>:limit</tt> - The number of reporting periods to get (see <tt>:grouping<… | |
| -* <tt>:conditions</tt> - Conditions like in <tt>ActiveRecord::Base#find</tt>; … | |
| -* <tt>:live_data</tt> - Specifies whether data for the current reporting perio… | |
| -* <tt>:end_date</tt> - When specified, the report will only include data for t… | |
| - | |
| -<b>Example:</b> | |
| - | |
| - User.registrations_report(:conditions => ['last_name LIKE 'A%']) | |
| - User.activations_report(:grouping => :week, :limit => 5) | |
| - | |
| -=== The Report cache | |
| - | |
| -Unless you specify parameters that make it impossible to cache report results,… | |
| -<b>Beware that when you modify data in the cache, report results may be incorr… | |
| -method. | |
| - | |
| -<b>Example</b> | |
| - | |
| -For a report defined as | |
| - | |
| - class User < ActiveRecord::Base | |
| - reports_as_sparkline :registrations | |
| - end | |
| - | |
| -you can clear the cache with | |
| - | |
| - Saulabs::ReportsAsSparkline::ReportCache.clear_for(User, :registrations) | |
| - | |
| -=== In your views | |
| - | |
| -You can than render sparklines for these reports with sparkline_tag in your vi… | |
| - | |
| - <%= sparkline_tag(User.registrations_report) %> | |
| - | |
| -The +sparkline_tag+ helper takes the following parameters: | |
| - | |
| -* <tt>width</tt> - The width of the generated image | |
| -* <tt>height</tt> - The height of the generated image | |
| -* <tt>line_color</tt> - The line color of the sparkline (hex code) | |
| -* <tt>fill_color</tt> - The color to fill the area below the sparkline with (h… | |
| -* <tt>labels</tt> - The axes to render lables for (Array of <tt>:x</tt>, <tt>:… | |
| - | |
| -== Installation | |
| - | |
| -Installation requires 3 simple steps: | |
| - | |
| -<b>get the plugin</b> | |
| - | |
| -From your RAILS_ROOT in Rails >= 2.1, do | |
| - | |
| - ./script/plugin install git://github.com/marcoow/reports_as_sparkline.git | |
| - | |
| -If you are on Rails < 2.1, do this from your RAILS_ROOT | |
| - | |
| - git clone git://github.com/marcoow/reports_as_sparkline.git vendor/plugins/r… | |
| - | |
| -<b>generate migration</b> | |
| - | |
| - ./script/generate reports_as_sparkline_migration add_reports_as_sparkline_ta… | |
| - | |
| -<b>migrate</b> | |
| - | |
| - rake db:migrate | |
| - | |
| -== Performance | |
| - | |
| -To achieve best performance, you should add indices to your tables on the date… | |
| -used for grouping the records (see Saulabs::ReportsAsSparkline::ClassMethods.r… | |
| - | |
| - add_index :[table], :[date_column] | |
| - | |
| -If you are on PostgreSQL, you should add functional indices: | |
| - | |
| - add_index :[table], :[date_column], :functional => "date_trunc('hour', [date… | |
| - add_index :[table], :[date_column], :functional => "date_trunc('day', [date… | |
| - add_index :[table], :[date_column], :functional => "date_trunc('week', [date… | |
| - add_index :[table], :[date_column], :functional => "date_trunc('year', [date… | |
| - | |
| -You might also want to use fragment caching in your views since processing the… | |
| -aso takes some time. | |
| - | |
| -<b>Example</b> | |
| - | |
| - <%- cache do -%> | |
| - <%= sparkline_tag(User.registrations_report) %> | |
| - <%- end -%> | |
| - | |
| -== TODOs/ future plans | |
| - | |
| -* support for Oracle and DB2 (and others?) missing | |
| -* Limit number of data points to maximum that the google chart api allows | |
| -* Make graph styling configurable | |
| - | |
| -If you want to suggest any new features or report bugs, do so at http://github… | |
| - | |
| -== Contributors | |
| - | |
| -* myronmarston (http://github.com/myronmarston) | |
| -* jan (http://github.com/jan) | |
| -* eric (http://github.com/eric) | |
| - | |
| -== Author | |
| - | |
| -© 2008-2010 Marco Otte-Witte (http://saulabs.com), Martin Kavalar, released u… | |
| +Former ReportsAsSparkline; expect new features, cleaner code etc. in the next … | |
| +\ No newline at end of file |