Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Dynamic Reports 0.0.0

  • Loading branch information...
commit b68914b9950caf8251725355878046ede21e5fe1 0 parents
@wayneeseguin authored
Showing with 7,436 additions and 0 deletions.
  1. 0  .gitignore
  2. +2 −0  HISTORY
  3. +11 −0 NOTES
  4. +146 −0 README.rdoc
  5. +45 −0 Rakefile
  6. +8 −0 TODO
  7. +258 −0 doc/DynamicReports.html
  8. +618 −0 doc/DynamicReports/Chart.html
  9. +386 −0 doc/DynamicReports/Charts.html
  10. +1,175 −0 doc/DynamicReports/Report.html
  11. +783 −0 doc/DynamicReports/Templates.html
  12. +372 −0 doc/DynamicReports/View.html
  13. +92 −0 doc/HISTORY.html
  14. +232 −0 doc/README_rdoc.html
  15. +1 −0  doc/created.rid
  16. +178 −0 doc/index.html
  17. +54 −0 doc/lib/dynamic_reports/charts_rb.html
  18. +58 −0 doc/lib/dynamic_reports/reports_rb.html
  19. +54 −0 doc/lib/dynamic_reports/templates_rb.html
  20. +52 −0 doc/lib/dynamic_reports/views_rb.html
  21. +62 −0 doc/lib/dynamic_reports_rb.html
  22. +696 −0 doc/rdoc.css
  23. +132 −0 examples/rails.rb
  24. 0  examples/ruby.rb
  25. +24 −0 gemspec.rb
  26. +47 −0 lib/dynamic_reports.rb
  27. +217 −0 lib/dynamic_reports/charts.rb
  28. +252 −0 lib/dynamic_reports/reports.rb
  29. +178 −0 lib/dynamic_reports/templates.rb
  30. +11 −0 lib/dynamic_reports/vendor/google_chart.rb
  31. +90 −0 lib/dynamic_reports/vendor/google_chart/bar_chart.rb
  32. +539 −0 lib/dynamic_reports/vendor/google_chart/base.rb
  33. +31 −0 lib/dynamic_reports/vendor/google_chart/financial_line_chart.rb
  34. +79 −0 lib/dynamic_reports/vendor/google_chart/line_chart.rb
  35. +33 −0 lib/dynamic_reports/vendor/google_chart/pie_chart.rb
  36. +38 −0 lib/dynamic_reports/vendor/google_chart/scatter_chart.rb
  37. +36 −0 lib/dynamic_reports/vendor/google_chart/venn_diagram.rb
  38. +30 −0 lib/dynamic_reports/views.rb
  39. 0  lib/dynamic_reports/views/default_chart.html.erb
  40. +1 −0  lib/dynamic_reports/views/default_layout.html.erb
  41. +73 −0 lib/dynamic_reports/views/default_report.html.erb
  42. +62 −0 lib/dynamic_reports/views/default_report.html.haml
  43. +18 −0 test/dynamic_reports.rb
  44. +80 −0 test/dynamic_reports/charts_test.rb
  45. +87 −0 test/dynamic_reports/reports_test.rb
  46. +3 −0  test/dynamic_reports/templates_test.rb
  47. +1 −0  test/dynamic_reports/views/specific_template.html.erb
  48. +27 −0 test/dynamic_reports/views_test.rb
  49. 0  test/factories/records.rb
  50. +64 −0 test/test_helper.rb
0  .gitignore
No changes.
2  HISTORY
@@ -0,0 +1,2 @@
+0.0.0
+ - Initial dynamic reports codebase.
11 NOTES
@@ -0,0 +1,11 @@
+# Feedback
+# it would be nice if it was just a template handler in Rails
+# ActionView::TemplateHandlers::ERB
+# since your stuff is all ERB you can just return the file contents I think
+# and then you also want to add a RenderOption, but I think RenderOptions are limited to completely taking over the process atm, instead of supplementing
+# so we have to do something about that
+
+
+
+# Should be able to hook reports into models directly somehow, cleanly
+#
146 README.rdoc
@@ -0,0 +1,146 @@
+= Dynamic Reports
+
+ A dynamic reporting engine for Ruby / Rails
+
+== Reports
+
+ The dynamic reports gem was created to fill a HUGE hole that we felt existed in the
+ Ruby community - the ability to QUICKLY create stylized admin reports and charts for
+ people to use to view key metrics and data.
+
+ Sample uses include the ability to quickly display sales data if your an eShop, our
+ site metrics if you are recording your own site visits, or user feedback if you are storing
+ feedback in a model somewhere.
+
+ Basically, with DR you can create a stylized table of ANY information found in a model
+ (kind of like looking at the grid output from a GUI query analyzer) as well as add Google
+ Charts API powered line, pie, bar or column charts of any numeric data. All this can
+ be done by simply creating a report definition and feeding it your data.
+
+ While this library is usable in any Ruby application it was made mainly with Rails in mind.
+ Suppose we have an online store and we wish to add reporting to the admin area quickly and easily.
+ First we define a report in app/reports/orders_report.rb, something like:
+
+ class OrdersReport < DynamicReports::Report
+ columns :total, :created_at
+ end
+
+ Then in our admin/reports controller (this can be any controller) we define an action to deliver the report:
+
+ def orders
+ @orders = Order.find(:all, :limit => 25)
+ render :text => OrdersReport.on(@orders).to_html, :layout => "application"
+ end
+
+ This will render an html table containing some basic styling and containing the columns 'total' and 'created_at' from the order objects.
+ Note that the report Title will be "Orders Report" and it's name will be :orders_report
+ Report#on expects that it receives an object that responds to #each and
+ That each object that it iterates over is either a
+ * An object
+ * A Hash
+ that responds to a method / has keys for each column defined within the report.
+
+
+ Templating engines may also be specified, currently :erb and :haml are supported (we will soon be adding :csv and :pdf) like so:
+
+ render :text => OrdersReport.on(@orders).to_html(:engine => :haml), :layout => "application"
+
+ Note that erb is the default templating engine since it is available by default in Ruby.
+
+ One may also surpress the default rendered styles you may specify that as an option as well:
+
+ render :text => OrdersReport.on(@orders).to_html(:style => false), :layout => "application"
+
+ Now let us extend our report definition to specify a template to use!
+
+ class OrdersReport < DynamicReports::Report
+ columns :total, :created_at
+ template :orders_report
+ end
+
+ This will look in app/views/reports/ for a template named "orders_report.html.erb" by default.
+ If you specify :engine => :haml then it will look for "orders_report.html.haml"
+
+ If you happen to have your report templates in a different location you can specify this as follows:
+
+ class OrdersReport < DynamicReports::Report
+ columns :total, :created_at
+ template :orders_report
+ views "app/views/admin/reports/"
+ end
+
+ And DynamicReports will look for the specified template in app/views/reports as well as app/views/admin/reports.
+
+== Charts
+
+ Charts can be defined on a report easily. Let's say we wish to chart the total versus the item quantity sold for our Orders Report exmaple:
+
+ class OrdersReport < DynamicReports::Report
+ columns :total, :created_at
+
+ chart :total_vs_quantity do
+ columns :total, :quantity
+ end
+ end
+
+ This will render a *line* chart by default displaying the columns total and quantity.
+ Chart types may be specified easily:
+
+ type :bar
+
+ Available chart types are:
+
+ * :line (default)
+ * :bar
+ * :pie
+
+ Other chart types are planned.
+
+== Rails Usage
+
+ Inside the initializer block in config/environment.rb
+
+ config.gem "dynamic_reports"
+
+ Then define your reports (as exampled above) in app/reports/*_report.rb
+ If you would like to customize the default report simply create your report templates
+ within app/views/reports/*_report.<content-type>.<engine>.
+
+ Two Rails features that we are currently working on are:
+
+ * generator
+ * render extensions
+
+== Optional Dependencies
+
+ We are currently examining solutions for csv, pdf and charting.
+
+ * Fastercsv # csv
+ * Prawn # pdf
+ * flying saucer # html => PDF - if jRuby available
+ * amcharts # Charting, note that default is built in google charts.
+
+ These will be defined/implemented using DynamicReports plugin API (not implemented yet)
+ Which allows for user defined plugins of arbitrary types beyond html,csv,pdf,xml
+
+== Contact / Feedback
+
+ If you have any suggestions on improvement please send us an email.
+
+== Authors (alphabetically)
+
+ Joshua Lippiner (jlippiner@gmail.com)
+
+ Wayne E. Seguin (wayneeseguin@gmail.com, irc: wayneeseguin)
+
+== Thanks To
+
+ * Daniel Neighman
+ * Kenneth Kalmer (And his friend :))
+ * Yehuda Katz
+
+ For their encouragement, feedback and advise.
+
+== Source
+ http://github.com/wayneeseguin/dynamic_reports
+
45 Rakefile
@@ -0,0 +1,45 @@
+require "rake/testtask"
+
+task :default => ["test:all"]
+task :test => ["test:all"]
+namespace :test do
+ desc "Run Test Suite"
+ Rake::TestTask.new("all") do |test|
+ test.pattern = "test/dynamic_reports.rb"
+ test.verbose = true
+ test.warning = true
+ end
+end
+
+desc "Build the dynamic_reports gem and then install it."
+task :gem do
+ puts `gem uninstall dynamic_reports ; rm -f dynamic_reports-0.0.0.gem; gem build gemspec.rb ; gem install ./dynamic_reports-0.0.0.gem --no-ri -l`
+end
+namespace :gem do
+ desc "Build the dynamic_reports gem."
+ task :build do
+ puts `gem build gemspec.rb`
+ end
+
+ desc "Install the dynamic_reports gem."
+ task :install do
+ %x{gem install dynamic_reports*.gem --no-rdoc --no-ri -l}
+ end
+end
+
+begin
+require "rake/rdoctask"
+require "rdoc/generator"
+Rake::RDocTask.new do |rdoc|
+ rdoc.rdoc_dir = "doc"
+ rdoc.title = "Dynamic Reports"
+ rdoc.options << "--line-numbers"
+ rdoc.options << "--charset" << "utf-8"
+ rdoc.rdoc_files.include("README.rdoc", "HISTORY")
+ rdoc.rdoc_files.include("lib/*.rb")
+ rdoc.rdoc_files.include("lib/dynamic_reports/*.rb")
+end
+
+rescue
+ puts "Skipping loading of rdoc tasks, missing rdoc gem."
+end
8 TODO
@@ -0,0 +1,8 @@
+= General
+ *
+= Reports
+ * Factory Generators (for records data)
+ * Pdf engine option
+ *
+= Charts
+ *
258 doc/DynamicReports.html
@@ -0,0 +1,258 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
+
+ <title>Module: DynamicReports</title>
+
+ <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
+
+ <script src="./js/jquery.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="./js/quicksearch.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="./js/darkfish.js" type="text/javascript"
+ charset="utf-8"></script>
+
+</head>
+<body class="module">
+
+ <div id="metadata">
+ <div id="file-metadata">
+ <div id="file-list-section" class="section">
+ <h3 class="section-header">In Files</h3>
+ <div class="section-body">
+ <ul>
+
+ <li><a href="./lib/dynamic_reports_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
+ class="thickbox" title="lib/dynamic_reports.rb">lib/dynamic_reports.rb</a></li>
+
+ <li><a href="./lib/dynamic_reports/charts_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
+ class="thickbox" title="lib/dynamic_reports/charts.rb">lib/dynamic_reports/charts.rb</a></li>
+
+ <li><a href="./lib/dynamic_reports/reports_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
+ class="thickbox" title="lib/dynamic_reports/reports.rb">lib/dynamic_reports/reports.rb</a></li>
+
+ <li><a href="./lib/dynamic_reports/templates_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
+ class="thickbox" title="lib/dynamic_reports/templates.rb">lib/dynamic_reports/templates.rb</a></li>
+
+ <li><a href="./lib/dynamic_reports/views_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
+ class="thickbox" title="lib/dynamic_reports/views.rb">lib/dynamic_reports/views.rb</a></li>
+
+ </ul>
+ </div>
+ </div>
+
+
+ </div>
+
+ <div id="class-metadata">
+
+ <!-- Parent Class -->
+
+
+ <!-- Namespace Contents -->
+
+ <div id="namespace-list-section" class="section">
+ <h3 class="section-header">Namespace</h3>
+ <ul class="link-list">
+
+ <li><span class="type">MODULE</span> <a href="DynamicReports/Templates.html">DynamicReports::Templates</a></li>
+
+ <li><span class="type">CLASS</span> <a href="DynamicReports/Chart.html">DynamicReports::Chart</a></li>
+
+ <li><span class="type">CLASS</span> <a href="DynamicReports/Charts.html">DynamicReports::Charts</a></li>
+
+ <li><span class="type">CLASS</span> <a href="DynamicReports/Report.html">DynamicReports::Report</a></li>
+
+ <li><span class="type">CLASS</span> <a href="DynamicReports/View.html">DynamicReports::View</a></li>
+
+ </ul>
+ </div>
+
+
+ <!-- Method Quickref -->
+
+ <div id="method-list-section" class="section">
+ <h3 class="section-header">Methods</h3>
+ <ul class="link-list">
+
+ <li><a href="#M000000">::default_view_paths</a></li>
+
+ <li><a href="#M000001">::default_view_paths=</a></li>
+
+ </ul>
+ </div>
+
+
+ <!-- Included Modules -->
+
+ </div>
+
+ <div id="project-metadata">
+
+
+ <div id="fileindex-section" class="section project-section">
+ <h3 class="section-header">Files</h3>
+ <ul>
+
+ <li class="file"><a href="./HISTORY.html">HISTORY</a></li>
+
+ <li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
+
+ </ul>
+ </div>
+
+
+ <div id="classindex-section" class="section project-section">
+ <h3 class="section-header">Class Index
+ <span class="search-toggle"><img src="./images/find.png"
+ height="16" width="16" alt="[+]"
+ title="show/hide quicksearch" /></span></h3>
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
+ <fieldset>
+ <legend>Quicksearch</legend>
+ <input type="text" name="quicksearch" value=""
+ class="quicksearch-field" />
+ </fieldset>
+ </form>
+
+ <ul class="link-list">
+
+ <li><a href="./DynamicReports.html">DynamicReports</a></li>
+
+ <li><a href="./DynamicReports/Chart.html">DynamicReports::Chart</a></li>
+
+ <li><a href="./DynamicReports/Charts.html">DynamicReports::Charts</a></li>
+
+ <li><a href="./DynamicReports/Report.html">DynamicReports::Report</a></li>
+
+ <li><a href="./DynamicReports/Templates.html">DynamicReports::Templates</a></li>
+
+ <li><a href="./DynamicReports/View.html">DynamicReports::View</a></li>
+
+ </ul>
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
+ </div>
+
+
+ </div>
+ </div>
+
+ <div id="documentation">
+ <h1 class="module">DynamicReports</h1>
+
+ <div id="description">
+ <p>
+Library Files
+</p>
+<hr size="1"></hr><p>
+<a href="DynamicReports.html">DynamicReports</a>
+</p>
+<p>
+Dynamic Reporting Engine for Ruby / Rails
+</p>
+
+ </div>
+
+ <!-- Constants -->
+
+
+ <!-- Attributes -->
+
+
+ <!-- Methods -->
+
+ <div id="public-class-method-details" class="method-section section">
+ <h3 class="section-header">Public Class Methods</h3>
+
+
+ <div id="default-view-paths-method" class="method-detail ">
+ <a name="M000000"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">default_view_paths</span><span
+ class="method-args">()</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+
+
+ <div class="method-source-code"
+ id="default-view-paths-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports.rb, line 6</span>
+6: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_view_paths</span>
+7: <span class="ruby-ivar">@@default_view_paths</span>
+8: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="default-view-paths--method" class="method-detail ">
+ <a name="M000001"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">default_view_paths=</span><span
+ class="method-args">(paths)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+
+
+ <div class="method-source-code"
+ id="default-view-paths--source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports.rb, line 9</span>
+ 9: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_view_paths=</span>(<span class="ruby-identifier">paths</span>)
+10: <span class="ruby-ivar">@@default_view_paths</span> = <span class="ruby-identifier">paths</span>
+11: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
+
+ <p>Disabled; run with --debug to generate this.</p>
+
+ </div>
+
+ <div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
+ Rdoc Generator</a> 1.1.6</small>.</p>
+ </div>
+
+</body>
+</html>
+
618 doc/DynamicReports/Chart.html
@@ -0,0 +1,618 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
+
+ <title>Class: DynamicReports::Chart</title>
+
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
+
+ <script src="../js/jquery.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="../js/thickbox-compressed.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="../js/quicksearch.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="../js/darkfish.js" type="text/javascript"
+ charset="utf-8"></script>
+
+</head>
+<body class="class">
+
+ <div id="metadata">
+ <div id="file-metadata">
+ <div id="file-list-section" class="section">
+ <h3 class="section-header">In Files</h3>
+ <div class="section-body">
+ <ul>
+
+ <li><a href="../lib/dynamic_reports/charts_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
+ class="thickbox" title="lib/dynamic_reports/charts.rb">lib/dynamic_reports/charts.rb</a></li>
+
+ </ul>
+ </div>
+ </div>
+
+
+ </div>
+
+ <div id="class-metadata">
+
+ <!-- Parent Class -->
+
+ <div id="parent-class-section" class="section">
+ <h3 class="section-header">Parent</h3>
+
+ <p class="link">Object</p>
+
+ </div>
+
+
+ <!-- Namespace Contents -->
+
+
+ <!-- Method Quickref -->
+
+ <div id="method-list-section" class="section">
+ <h3 class="section-header">Methods</h3>
+ <ul class="link-list">
+
+ <li><a href="#M000002">::configure</a></li>
+
+ <li><a href="#M000003">::new</a></li>
+
+ <li><a href="#M000012">#columns</a></li>
+
+ <li><a href="#M000010">#height</a></li>
+
+ <li><a href="#M000007">#label_column</a></li>
+
+ <li><a href="#M000006">#name</a></li>
+
+ <li><a href="#M000011">#no_labels</a></li>
+
+ <li><a href="#M000004">#options</a></li>
+
+ <li><a href="#M000005">#title</a></li>
+
+ <li><a href="#M000008">#type</a></li>
+
+ <li><a href="#M000009">#width</a></li>
+
+ </ul>
+ </div>
+
+
+ <!-- Included Modules -->
+
+ </div>
+
+ <div id="project-metadata">
+
+
+ <div id="fileindex-section" class="section project-section">
+ <h3 class="section-header">Files</h3>
+ <ul>
+
+ <li class="file"><a href="../HISTORY.html">HISTORY</a></li>
+
+ <li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
+
+ </ul>
+ </div>
+
+
+ <div id="classindex-section" class="section project-section">
+ <h3 class="section-header">Class Index
+ <span class="search-toggle"><img src="../images/find.png"
+ height="16" width="16" alt="[+]"
+ title="show/hide quicksearch" /></span></h3>
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
+ <fieldset>
+ <legend>Quicksearch</legend>
+ <input type="text" name="quicksearch" value=""
+ class="quicksearch-field" />
+ </fieldset>
+ </form>
+
+ <ul class="link-list">
+
+ <li><a href="../DynamicReports.html">DynamicReports</a></li>
+
+ <li><a href="../DynamicReports/Chart.html">DynamicReports::Chart</a></li>
+
+ <li><a href="../DynamicReports/Charts.html">DynamicReports::Charts</a></li>
+
+ <li><a href="../DynamicReports/Report.html">DynamicReports::Report</a></li>
+
+ <li><a href="../DynamicReports/Templates.html">DynamicReports::Templates</a></li>
+
+ <li><a href="../DynamicReports/View.html">DynamicReports::View</a></li>
+
+ </ul>
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
+ </div>
+
+
+ </div>
+ </div>
+
+ <div id="documentation">
+ <h1 class="class">DynamicReports::Chart</h1>
+
+ <div id="description">
+
+ </div>
+
+ <!-- Constants -->
+
+
+ <!-- Attributes -->
+
+
+ <!-- Methods -->
+
+ <div id="public-class-method-details" class="method-section section">
+ <h3 class="section-header">Public Class Methods</h3>
+
+
+ <div id="configure-method" class="method-detail ">
+ <a name="M000002"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">configure</span><span
+ class="method-args">(name, *chart_options, &block)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+
+
+ <div class="method-source-code"
+ id="configure-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 5</span>
+ 5: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">chart_options</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
+ 6: <span class="ruby-identifier">chart_options</span> = <span class="ruby-identifier">chart_options</span>.<span class="ruby-identifier">shift</span> <span class="ruby-operator">||</span> {}
+ 7: <span class="ruby-identifier">chart</span> = <span class="ruby-identifier">new</span>(<span class="ruby-identifier">chart_options</span>)
+ 8: <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
+ 9: <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">name</span> <span class="ruby-identifier">name</span>
+10: <span class="ruby-identifier">chart</span>
+11: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="new-method" class="method-detail ">
+ <a name="M000003"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">new</span><span
+ class="method-args">(*chart_options)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+
+
+ <div class="method-source-code"
+ id="new-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 13</span>
+13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">chart_options</span>)
+14: <span class="ruby-identifier">chart_options</span> = <span class="ruby-identifier">chart_options</span>.<span class="ruby-identifier">shift</span> <span class="ruby-operator">||</span> {}
+15: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">chart_options</span>)
+16: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+ <div id="public-instance-method-details" class="method-section section">
+ <h3 class="section-header">Public Instance Methods</h3>
+
+
+ <div id="columns-method" class="method-detail ">
+ <a name="M000012"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">columns</span><span
+ class="method-args">(*array)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+(Optional) Accessor for columns
+</p>
+<p>
+Pass an array of symbols to define columns to chart. Columns MUST be
+numeric in value to chart.
+</p>
+<p>
+Example:
+</p>
+<pre>
+ columns :pageviews, :visits
+</pre>
+<p>
+You may leave this accessor blank to default to the report columns
+specified that are numeric.
+</p>
+
+
+
+ <div class="method-source-code"
+ id="columns-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 102</span>
+102: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">columns</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">array</span>)
+103: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">array</span>.<span class="ruby-identifier">empty?</span>
+104: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">array</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>)
+105: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:columns</span>] = <span class="ruby-identifier">array</span>
+106: <span class="ruby-keyword kw">else</span>
+107: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Report columns must be specified.&quot;</span>
+108: <span class="ruby-keyword kw">end</span>
+109: <span class="ruby-keyword kw">else</span>
+110: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:columns</span>]
+111: <span class="ruby-keyword kw">end</span>
+112: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="height-method" class="method-detail ">
+ <a name="M000010"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">height</span><span
+ class="method-args">(value = nil)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+(Optional - Default = 175). Accessor used to set the height, in pixels, of
+the chart.
+</p>
+<pre>
+ height &quot;350&quot;
+</pre>
+
+
+
+ <div class="method-source-code"
+ id="height-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 77</span>
+77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">height</span>(<span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>)
+78: <span class="ruby-identifier">value</span> <span class="ruby-value">? </span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:height</span>] = <span class="ruby-identifier">value</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:height</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;175&quot;</span>)
+79: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="label-column-method" class="method-detail ">
+ <a name="M000007"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">label_column</span><span
+ class="method-args">(value = nil)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+(Optional) Accessor used by bar and pie charts to determine the independent
+varible chart labels. Due to size constraints this is NOT used by column or
+line charts, but you can add labels to the X-axis for those charts via
+chart_options and passing Google <a href="Chart.html">Chart</a> API
+calls.&#8220;
+</p>
+<p>
+<a href="Chart.html#M000007">label_column</a> should be a SINGLE column
+name from the dataset.
+</p>
+<pre>
+ label_column &quot;recorded_at&quot;
+</pre>
+
+
+
+ <div class="method-source-code"
+ id="label-column-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 49</span>
+49: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">label_column</span>(<span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>)
+50: <span class="ruby-identifier">value</span> <span class="ruby-value">? </span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:label_column</span>] = <span class="ruby-identifier">value</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:label_column</span>]
+51: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="name-method" class="method-detail ">
+ <a name="M000006"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">name</span><span
+ class="method-args">(value = nil)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+Accessor used to set or get a specific report. Must be unique:
+</p>
+<pre>
+ name &quot;PV_Visits&quot;
+</pre>
+
+
+
+ <div class="method-source-code"
+ id="name-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 35</span>
+35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name</span>(<span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>)
+36: <span class="ruby-identifier">value</span> <span class="ruby-value">? </span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:name</span>] = <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_sym</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:name</span>]
+37: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="no-labels-method" class="method-detail ">
+ <a name="M000011"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">no_labels</span><span
+ class="method-args">(value = nil)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+(Optional - Default = false). Accessor used to determine if axis labels
+should be shown. By default y-axis labels are shown.
+</p>
+<pre>
+ no_labels true
+</pre>
+
+
+
+ <div class="method-source-code"
+ id="no-labels-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 86</span>
+86: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">no_labels</span>(<span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>)
+87: <span class="ruby-identifier">value</span> <span class="ruby-value">? </span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:no_labels</span>] = <span class="ruby-identifier">value</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:no_labels</span>]
+88: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="options-method" class="method-detail ">
+ <a name="M000004"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">options</span><span
+ class="method-args">()</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+
+
+ <div class="method-source-code"
+ id="options-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 18</span>
+18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">options</span>
+19: <span class="ruby-ivar">@options</span> <span class="ruby-operator">||=</span> {} ; <span class="ruby-ivar">@options</span>
+20: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="title-method" class="method-detail ">
+ <a name="M000005"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">title</span><span
+ class="method-args">(value = nil)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+(Optional) Accessor used to set the chart title:
+</p>
+<pre>
+ title &quot;Pageviews versus Visits&quot;
+</pre>
+<p>
+This is displayed above the chart
+</p>
+
+
+
+ <div class="method-source-code"
+ id="title-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 27</span>
+27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">title</span>(<span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>)
+28: <span class="ruby-identifier">value</span> <span class="ruby-value">? </span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:title</span>] = <span class="ruby-identifier">value</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:title</span>]
+29: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="type-method" class="method-detail ">
+ <a name="M000008"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">type</span><span
+ class="method-args">(value = nil)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+(Optional - Default = line). Accessor used to determine the type of chart
+to display. Valid options are line, column, bar or pie:
+</p>
+<pre>
+ type &quot;bar&quot;
+</pre>
+
+
+
+ <div class="method-source-code"
+ id="type-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 59</span>
+59: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type</span>(<span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>)
+60: <span class="ruby-identifier">value</span> <span class="ruby-value">? </span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:type</span>] = <span class="ruby-identifier">value</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:type</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">:line</span>)
+61: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="width-method" class="method-detail ">
+ <a name="M000009"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">width</span><span
+ class="method-args">(value = nil)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+(Optional - Default = 250). Accessor used to set the width, in pixels, of
+the chart.
+</p>
+<pre>
+ width &quot;400&quot;
+</pre>
+
+
+
+ <div class="method-source-code"
+ id="width-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 68</span>
+68: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">width</span>(<span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>)
+69: <span class="ruby-identifier">value</span> <span class="ruby-value">? </span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:width</span>] = <span class="ruby-identifier">value</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:width</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;250&quot;</span>)
+70: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
+
+ <p>Disabled; run with --debug to generate this.</p>
+
+ </div>
+
+ <div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
+ Rdoc Generator</a> 1.1.6</small>.</p>
+ </div>
+
+</body>
+</html>
+
386 doc/DynamicReports/Charts.html
@@ -0,0 +1,386 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
+
+ <title>Class: DynamicReports::Charts</title>
+
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
+
+ <script src="../js/jquery.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="../js/thickbox-compressed.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="../js/quicksearch.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="../js/darkfish.js" type="text/javascript"
+ charset="utf-8"></script>
+
+</head>
+<body class="class">
+
+ <div id="metadata">
+ <div id="file-metadata">
+ <div id="file-list-section" class="section">
+ <h3 class="section-header">In Files</h3>
+ <div class="section-body">
+ <ul>
+
+ <li><a href="../lib/dynamic_reports/charts_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
+ class="thickbox" title="lib/dynamic_reports/charts.rb">lib/dynamic_reports/charts.rb</a></li>
+
+ </ul>
+ </div>
+ </div>
+
+
+ </div>
+
+ <div id="class-metadata">
+
+ <!-- Parent Class -->
+
+ <div id="parent-class-section" class="section">
+ <h3 class="section-header">Parent</h3>
+
+ <p class="link">Object</p>
+
+ </div>
+
+
+ <!-- Namespace Contents -->
+
+
+ <!-- Method Quickref -->
+
+ <div id="method-list-section" class="section">
+ <h3 class="section-header">Methods</h3>
+ <ul class="link-list">
+
+ <li><a href="#M000030">::bar_column_chart</a></li>
+
+ <li><a href="#M000018">::line_chart</a></li>
+
+ <li><a href="#M000025">::pie_chart</a></li>
+
+ <li><a href="#M000017">::random_color</a></li>
+
+ </ul>
+ </div>
+
+
+ <!-- Included Modules -->
+
+ </div>
+
+ <div id="project-metadata">
+
+
+ <div id="fileindex-section" class="section project-section">
+ <h3 class="section-header">Files</h3>
+ <ul>
+
+ <li class="file"><a href="../HISTORY.html">HISTORY</a></li>
+
+ <li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
+
+ </ul>
+ </div>
+
+
+ <div id="classindex-section" class="section project-section">
+ <h3 class="section-header">Class Index
+ <span class="search-toggle"><img src="../images/find.png"
+ height="16" width="16" alt="[+]"
+ title="show/hide quicksearch" /></span></h3>
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
+ <fieldset>
+ <legend>Quicksearch</legend>
+ <input type="text" name="quicksearch" value=""
+ class="quicksearch-field" />
+ </fieldset>
+ </form>
+
+ <ul class="link-list">
+
+ <li><a href="../DynamicReports.html">DynamicReports</a></li>
+
+ <li><a href="../DynamicReports/Chart.html">DynamicReports::Chart</a></li>
+
+ <li><a href="../DynamicReports/Charts.html">DynamicReports::Charts</a></li>
+
+ <li><a href="../DynamicReports/Report.html">DynamicReports::Report</a></li>
+
+ <li><a href="../DynamicReports/Templates.html">DynamicReports::Templates</a></li>
+
+ <li><a href="../DynamicReports/View.html">DynamicReports::View</a></li>
+
+ </ul>
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
+ </div>
+
+
+ </div>
+ </div>
+
+ <div id="documentation">
+ <h1 class="class">DynamicReports::Charts</h1>
+
+ <div id="description">
+ <p>
+<a href="Charts.html">DynamicReports::Charts</a>
+</p>
+<pre>
+ Class used to display different chart types internally. Charts are generated
+ using Google Charts API
+</pre>
+
+ </div>
+
+ <!-- Constants -->
+
+
+ <!-- Attributes -->
+
+
+ <!-- Methods -->
+
+ <div id="public-class-method-details" class="method-section section">
+ <h3 class="section-header">Public Class Methods</h3>
+
+
+ <div id="bar-column-chart-method" class="method-detail ">
+ <a name="M000030"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">bar_column_chart</span><span
+ class="method-args">(chart, columns, report, orientation)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+Method to display a bar or column chart for a given chart definition and
+report
+</p>
+
+
+
+ <div class="method-source-code"
+ id="bar-column-chart-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 180</span>
+180: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bar_column_chart</span>(<span class="ruby-identifier">chart</span>, <span class="ruby-identifier">columns</span>, <span class="ruby-identifier">report</span>, <span class="ruby-identifier">orientation</span>)
+181: <span class="ruby-operator">::</span><span class="ruby-constant">GoogleChart</span><span class="ruby-operator">::</span><span class="ruby-constant">BarChart</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{chart.width}x#{chart.height}&quot;</span>, <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">title</span>, <span class="ruby-identifier">orientation</span>, <span class="ruby-keyword kw">true</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
+182: <span class="ruby-identifier">all_data</span> = []
+183: <span class="ruby-identifier">all_labels</span> = []
+184: <span class="ruby-identifier">columns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">column</span><span class="ruby-operator">|</span>
+185: <span class="ruby-identifier">data</span> = []
+186: <span class="ruby-identifier">report</span>.<span class="ruby-identifier">records</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">record</span><span class="ruby-operator">|</span>
+187: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
+188: <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">record</span>[<span class="ruby-identifier">column</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">record</span>[<span class="ruby-identifier">column</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Numeric</span>)
+189: <span class="ruby-identifier">all_labels</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">record</span>[<span class="ruby-identifier">chart</span>.<span class="ruby-identifier">label_column</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">label_column</span>
+190: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_sym</span>)
+191: <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_sym</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_sym</span>).<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Numeric</span>)
+192: <span class="ruby-identifier">all_labels</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">chart</span>.<span class="ruby-identifier">label_column</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">label_column</span>
+193: <span class="ruby-keyword kw">else</span>
+194: <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">column</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Numeric</span>)
+195: <span class="ruby-identifier">all_labels</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">label_column</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">label_column</span>
+196: <span class="ruby-keyword kw">end</span>
+197: <span class="ruby-keyword kw">end</span>
+198: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">data</span> <span class="ruby-identifier">column</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">random_color</span>() <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">empty?</span>
+199: <span class="ruby-identifier">all_data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">data</span>
+200: <span class="ruby-keyword kw">end</span>
+201: <span class="ruby-identifier">all_data</span>.<span class="ruby-identifier">flatten!</span>
+202:
+203: <span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">orientation</span><span class="ruby-operator">==</span><span class="ruby-identifier">:vertical</span>)
+204: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">axis</span> <span class="ruby-identifier">:y</span>, <span class="ruby-identifier">:range</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-identifier">all_data</span>.<span class="ruby-identifier">min</span>,<span class="ruby-identifier">all_data</span>.<span class="ruby-identifier">max</span>], <span class="ruby-identifier">:color</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'ff00ff'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">no_labels</span>
+205: <span class="ruby-keyword kw">else</span>
+206: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">axis</span> <span class="ruby-identifier">:x</span>, <span class="ruby-identifier">:range</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-identifier">all_data</span>.<span class="ruby-identifier">min</span>,<span class="ruby-identifier">all_data</span>.<span class="ruby-identifier">max</span>], <span class="ruby-identifier">:color</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'ff00ff'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">no_labels</span>
+207: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">axis</span> <span class="ruby-identifier">:y</span>, <span class="ruby-identifier">:labels</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">all_labels</span>
+208: <span class="ruby-keyword kw">end</span>
+209:
+210: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">show_legend</span> = <span class="ruby-identifier">columns</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
+211:
+212: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_url</span>(<span class="ruby-identifier">chart</span>.<span class="ruby-identifier">options</span>)
+213: <span class="ruby-keyword kw">end</span>
+214: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="line-chart-method" class="method-detail ">
+ <a name="M000018"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">line_chart</span><span
+ class="method-args">(chart, columns, report)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+Method to display a line chart for a given chart definition and report
+</p>
+
+
+
+ <div class="method-source-code"
+ id="line-chart-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 132</span>
+132: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">line_chart</span>(<span class="ruby-identifier">chart</span>, <span class="ruby-identifier">columns</span>, <span class="ruby-identifier">report</span>)
+133: <span class="ruby-operator">::</span><span class="ruby-constant">GoogleChart</span><span class="ruby-operator">::</span><span class="ruby-constant">LineChart</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{chart.width}x#{chart.height}&quot;</span>, <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">title</span>, <span class="ruby-keyword kw">false</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
+134: <span class="ruby-identifier">all_data</span> = []
+135: <span class="ruby-identifier">columns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">column</span><span class="ruby-operator">|</span>
+136: <span class="ruby-identifier">data</span> = []
+137: <span class="ruby-identifier">report</span>.<span class="ruby-identifier">records</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">record</span><span class="ruby-operator">|</span>
+138: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
+139: <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">record</span>[<span class="ruby-identifier">column</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">record</span>[<span class="ruby-identifier">column</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Numeric</span>)
+140: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_sym</span>)
+141: <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_sym</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_sym</span>).<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Numeric</span>)
+142: <span class="ruby-keyword kw">else</span>
+143: <span class="ruby-identifier">data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">column</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Numeric</span>)
+144: <span class="ruby-keyword kw">end</span>
+145: <span class="ruby-keyword kw">end</span>
+146: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">data</span> <span class="ruby-identifier">column</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">random_color</span>() <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">empty?</span>
+147: <span class="ruby-identifier">all_data</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">data</span>
+148: <span class="ruby-keyword kw">end</span>
+149: <span class="ruby-identifier">all_data</span>.<span class="ruby-identifier">flatten!</span>
+150: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">axis</span> <span class="ruby-identifier">:y</span>, <span class="ruby-identifier">:range</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-identifier">all_data</span>.<span class="ruby-identifier">min</span>,<span class="ruby-identifier">all_data</span>.<span class="ruby-identifier">max</span>], <span class="ruby-identifier">:color</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'ff00ff'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">no_labels</span>
+151: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">show_legend</span> = <span class="ruby-identifier">columns</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
+152:
+153: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_url</span>(<span class="ruby-identifier">chart</span>.<span class="ruby-identifier">options</span>)
+154: <span class="ruby-keyword kw">end</span>
+155: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="pie-chart-method" class="method-detail ">
+ <a name="M000025"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">pie_chart</span><span
+ class="method-args">(chart, columns, report)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+Method to display a pie chart for a given chart definition and report
+</p>
+
+
+
+ <div class="method-source-code"
+ id="pie-chart-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 158</span>
+158: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pie_chart</span>(<span class="ruby-identifier">chart</span>, <span class="ruby-identifier">columns</span>, <span class="ruby-identifier">report</span>)
+159: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">columns</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">label_column</span>.<span class="ruby-identifier">nil?</span>
+160: <span class="ruby-identifier">column</span> = <span class="ruby-identifier">columns</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">to_s</span>
+161:
+162: <span class="ruby-operator">::</span><span class="ruby-constant">GoogleChart</span><span class="ruby-operator">::</span><span class="ruby-constant">PieChart</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{chart.width}x#{chart.height}&quot;</span>, <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">title</span>, <span class="ruby-keyword kw">false</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
+163: <span class="ruby-identifier">report</span>.<span class="ruby-identifier">records</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">record</span><span class="ruby-operator">|</span>
+164: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
+165: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">data</span> <span class="ruby-identifier">record</span>[<span class="ruby-identifier">chart</span>.<span class="ruby-identifier">label_column</span>.<span class="ruby-identifier">to_s</span>], <span class="ruby-identifier">record</span>[<span class="ruby-identifier">column</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">record</span>[<span class="ruby-identifier">column</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Numeric</span>)
+166: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_sym</span>)
+167: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">data</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">chart</span>.<span class="ruby-identifier">label_column</span>.<span class="ruby-identifier">to_s</span>), <span class="ruby-identifier">record</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_sym</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_sym</span>).<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Numeric</span>)
+168: <span class="ruby-keyword kw">else</span>
+169: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">data</span> <span class="ruby-identifier">chart</span>.<span class="ruby-identifier">label_column</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">column</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Numeric</span>)
+170: <span class="ruby-keyword kw">end</span>
+171: <span class="ruby-keyword kw">end</span>
+172: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">show_legend</span> = <span class="ruby-keyword kw">false</span>
+173: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">show_labels</span> = <span class="ruby-keyword kw">true</span>
+174:
+175: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_url</span>(<span class="ruby-identifier">chart</span>.<span class="ruby-identifier">options</span>)
+176: <span class="ruby-keyword kw">end</span>
+177: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="random-color-method" class="method-detail ">
+ <a name="M000017"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">random_color</span><span
+ class="method-args">()</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+Method to select a random color from a list of hex codes
+</p>
+<p>
+Example: <a href="Charts.html#M000017">random_color</a>()
+</p>
+<h1>> &#8220;ff0000&#8220;</h1>
+
+
+
+ <div class="method-source-code"
+ id="random-color-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/charts.rb, line 126</span>
+126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">random_color</span>()
+127: <span class="ruby-identifier">color_list</span> = <span class="ruby-node">%w{000000 0000ff ff0000 ffff00 00ffff ff00ff 00ff00}</span>
+128: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">color_list</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">color_list</span>.<span class="ruby-identifier">size</span>)]
+129: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
+
+ <p>Disabled; run with --debug to generate this.</p>
+
+ </div>
+
+ <div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
+ Rdoc Generator</a> 1.1.6</small>.</p>
+ </div>
+
+</body>
+</html>
+
1,175 doc/DynamicReports/Report.html
@@ -0,0 +1,1175 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
+
+ <title>Class: DynamicReports::Report</title>
+
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
+
+ <script src="../js/jquery.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="../js/thickbox-compressed.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="../js/quicksearch.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="../js/darkfish.js" type="text/javascript"
+ charset="utf-8"></script>
+
+</head>
+<body class="class">
+
+ <div id="metadata">
+ <div id="file-metadata">
+ <div id="file-list-section" class="section">
+ <h3 class="section-header">In Files</h3>
+ <div class="section-body">
+ <ul>
+
+ <li><a href="../lib/dynamic_reports/reports_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
+ class="thickbox" title="lib/dynamic_reports/reports.rb">lib/dynamic_reports/reports.rb</a></li>
+
+ </ul>
+ </div>
+ </div>
+
+
+ </div>
+
+ <div id="class-metadata">
+
+ <!-- Parent Class -->
+
+ <div id="parent-class-section" class="section">
+ <h3 class="section-header">Parent</h3>
+
+ <p class="link">Object</p>
+
+ </div>
+
+
+ <!-- Namespace Contents -->
+
+
+ <!-- Method Quickref -->
+
+ <div id="method-list-section" class="section">
+ <h3 class="section-header">Methods</h3>
+ <ul class="link-list">
+
+ <li><a href="#M000029">::chart</a></li>
+
+ <li><a href="#M000027">::chart_with_name</a></li>
+
+ <li><a href="#M000028">::charts</a></li>
+
+ <li><a href="#M000026">::columns</a></li>
+
+ <li><a href="#M000019">::name</a></li>
+
+ <li><a href="#M000032">::new</a></li>
+
+ <li><a href="#M000031">::on</a></li>
+
+ <li><a href="#M000016">::options</a></li>
+
+ <li><a href="#M000023">::style_name</a></li>
+
+ <li><a href="#M000022">::styles</a></li>
+
+ <li><a href="#M000021">::sub_title</a></li>
+
+ <li><a href="#M000024">::template</a></li>
+
+ <li><a href="#M000020">::title</a></li>
+
+ <li><a href="#M000015">::views</a></li>
+
+ <li><a href="#M000014">#options</a></li>
+
+ <li><a href="#M000034">#to_csv</a></li>
+
+ <li><a href="#M000033">#to_html</a></li>
+
+ <li><a href="#M000035">#to_pdf</a></li>
+
+ <li><a href="#M000013">#views</a></li>
+
+ </ul>
+ </div>
+
+
+ <!-- Included Modules -->
+
+ </div>
+
+ <div id="project-metadata">
+
+
+ <div id="fileindex-section" class="section project-section">
+ <h3 class="section-header">Files</h3>
+ <ul>
+
+ <li class="file"><a href="../HISTORY.html">HISTORY</a></li>
+
+ <li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
+
+ </ul>
+ </div>
+
+
+ <div id="classindex-section" class="section project-section">
+ <h3 class="section-header">Class Index
+ <span class="search-toggle"><img src="../images/find.png"
+ height="16" width="16" alt="[+]"
+ title="show/hide quicksearch" /></span></h3>
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
+ <fieldset>
+ <legend>Quicksearch</legend>
+ <input type="text" name="quicksearch" value=""
+ class="quicksearch-field" />
+ </fieldset>
+ </form>
+
+ <ul class="link-list">
+
+ <li><a href="../DynamicReports.html">DynamicReports</a></li>
+
+ <li><a href="../DynamicReports/Chart.html">DynamicReports::Chart</a></li>
+
+ <li><a href="../DynamicReports/Charts.html">DynamicReports::Charts</a></li>
+
+ <li><a href="../DynamicReports/Report.html">DynamicReports::Report</a></li>
+
+ <li><a href="../DynamicReports/Templates.html">DynamicReports::Templates</a></li>
+
+ <li><a href="../DynamicReports/View.html">DynamicReports::View</a></li>
+
+ </ul>
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
+ </div>
+
+
+ </div>
+ </div>
+
+ <div id="documentation">
+ <h1 class="class">DynamicReports::Report</h1>
+
+ <div id="description">
+ <p>
+<a href="Report.html">DynamicReports::Report</a>
+</p>
+
+ </div>
+
+ <!-- Constants -->
+
+
+ <!-- Attributes -->
+
+ <div id="attribute-method-details" class="method-section section">
+ <h3 class="section-header">Attributes</h3>
+
+
+ <div id="name-attribute-method" class="method-detail">
+ <a name="name"></a>
+
+ <a name="name="></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">name</span><span
+ class="attribute-access-type">[RW]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="title-attribute-method" class="method-detail">
+ <a name="title"></a>
+
+ <a name="title="></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">title</span><span
+ class="attribute-access-type">[RW]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="sub-title-attribute-method" class="method-detail">
+ <a name="sub_title"></a>
+
+ <a name="sub_title="></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">sub_title</span><span
+ class="attribute-access-type">[RW]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="columns-attribute-method" class="method-detail">
+ <a name="columns"></a>
+
+ <a name="columns="></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">columns</span><span
+ class="attribute-access-type">[RW]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="charts-attribute-method" class="method-detail">
+ <a name="charts"></a>
+
+ <a name="charts="></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">charts</span><span
+ class="attribute-access-type">[RW]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="records-attribute-method" class="method-detail">
+ <a name="records"></a>
+
+ <a name="records="></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">records</span><span
+ class="attribute-access-type">[RW]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="template-attribute-method" class="method-detail">
+ <a name="template"></a>
+
+ <a name="template="></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">template</span><span
+ class="attribute-access-type">[RW]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="style-name-attribute-method" class="method-detail">
+ <a name="style_name"></a>
+
+ <a name="style_name="></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">style_name</span><span
+ class="attribute-access-type">[RW]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="styles-attribute-method" class="method-detail">
+ <a name="styles"></a>
+
+ <a name="styles="></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">styles</span><span
+ class="attribute-access-type">[RW]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- Methods -->
+
+ <div id="public-class-method-details" class="method-section section">
+ <h3 class="section-header">Public Class Methods</h3>
+
+
+ <div id="chart-method" class="method-detail ">
+ <a name="M000029"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">chart</span><span
+ class="method-args">(name, *chart_options, &block)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+Define a chart for the report
+</p>
+<p>
+Example:
+</p>
+<pre>
+ chart :PV_Visits, {:grxl =&gt; 'xxxxx'} do
+ title &quot;Pageviews and Visits&quot;
+ columns [:pageviews, :visits]
+ no_labels false
+ label_column &quot;recorded_at&quot;
+ width &quot;400&quot;
+ height &quot;350&quot;
+ type &quot;line&quot;
+ end
+</pre>
+
+
+
+ <div class="method-source-code"
+ id="chart-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/reports.rb, line 159</span>
+159: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">chart</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">chart_options</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
+160: <span class="ruby-identifier">chart_options</span> = <span class="ruby-identifier">chart_options</span>.<span class="ruby-identifier">shift</span> <span class="ruby-operator">||</span> {}
+161: <span class="ruby-identifier">charts</span>(<span class="ruby-constant">Chart</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">chart_options</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>))
+162: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="chart-with-name-method" class="method-detail ">
+ <a name="M000027"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">chart_with_name</span><span
+ class="method-args">(name)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+Return the chart with the specified name, if it exists. nil otherwise.
+</p>
+
+
+
+ <div class="method-source-code"
+ id="chart-with-name-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/reports.rb, line 135</span>
+135: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">chart_with_name</span>(<span class="ruby-identifier">name</span>)
+136: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:charts</span>].<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">detect</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span> }
+137: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="charts-method" class="method-detail ">
+ <a name="M000028"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">charts</span><span
+ class="method-args">(object=nil)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+Return an array of charts defined for the report.
+</p>
+
+
+
+ <div class="method-source-code"
+ id="charts-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/reports.rb, line 140</span>
+140: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">charts</span>(<span class="ruby-identifier">object</span>=<span class="ruby-keyword kw">nil</span>)
+141: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:charts</span>] <span class="ruby-operator">||=</span> []
+142: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:charts</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">object</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">object</span>
+143: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:charts</span>]
+144: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="columns-method" class="method-detail ">
+ <a name="M000026"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">columns</span><span
+ class="method-args">(*array)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+Accessor for columns
+</p>
+<p>
+Pass an array of symbols to define columns on the report
+</p>
+<p>
+Example:
+</p>
+<pre>
+ columns :total, :created_at
+</pre>
+<p>
+Calling the class method with no arguments will return an array with the
+defined columns.
+</p>
+<p>
+Example:
+</p>
+<pre>
+ OrdersReport.columns
+
+ # =&gt; [:total, :created_at]
+</pre>
+
+
+
+ <div class="method-source-code"
+ id="columns-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/reports.rb, line 122</span>
+122: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">columns</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">array</span>)
+123: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">array</span>.<span class="ruby-identifier">empty?</span>
+124: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">array</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>)
+125: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:columns</span>] = <span class="ruby-identifier">array</span>
+126: <span class="ruby-keyword kw">else</span>
+127: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Report columns must be specified.&quot;</span>
+128: <span class="ruby-keyword kw">end</span>
+129: <span class="ruby-keyword kw">else</span>
+130: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:columns</span>]
+131: <span class="ruby-keyword kw">end</span>
+132: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="name-method" class="method-detail ">
+ <a name="M000019"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">name</span><span
+ class="method-args">(value = nil)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+class level name accessor &amp; setter
+</p>
+<p>
+Set the name of the report, for example:
+</p>
+<pre>
+ name &quot;Orders Report&quot;
+</pre>
+
+
+
+ <div class="method-source-code"
+ id="name-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/reports.rb, line 41</span>
+41: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name</span>(<span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>)
+42: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>
+43: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:name</span>] = <span class="ruby-identifier">value</span>
+44: <span class="ruby-keyword kw">else</span>
+45: <span class="ruby-comment cmt"># TODO: snake_case_the_name</span>
+46: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:name</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>
+47: <span class="ruby-keyword kw">end</span>
+48: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="new-method" class="method-detail ">
+ <a name="M000032"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">new</span><span
+ class="method-args">(records, *new_options)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+Instantiate the report on a set of records.
+</p>
+<p>
+Example:
+</p>
+<p>
+OrdersReport.new(@records)
+</p>
+<p>
+options is a set of optional overrides for
+</p>
+<ul>
+<li>views - Used to override the class defined views.
+
+</li>
+<li>template - Used to override the class defined template.
+
+</li>
+</ul>
+
+
+
+ <div class="method-source-code"
+ id="new-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/dynamic_reports/reports.rb, line 201</span>
+201: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">records</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">new_options</span>)
+202: <span class="ruby-identifier">new_options</span> = <span class="ruby-identifier">new_options</span>.<span class="ruby-identifier">shift</span> <span class="ruby-operator">||</span> {}
+203: <span class="ruby-ivar">@records</span> = <span class="ruby-identifier">records</span>
+204: <span class="ruby-ivar">@views</span> = []
+205: <span class="ruby-ivar">@views</span> <span class="ruby-operator">&lt;&lt;</span> <span</