title: rails activerecord statistics/trends/time-series graph data
body: <p>We are in the process of building dashboards for users where in they can see the trends/time series graphs of various activerecords; take a blogging site as an example. There are posts, each post has many comments and tags. There are 2 kinds of dashboards to be built.</p>
  
  <pre><code>a. trend graphs
  b. time series graphs
  </code></pre>
  
  <p><strong>trends graphs:</strong> </p>
  
  <p>example, trending tags ( top 10, with # of posts), the ui looks like this</p>
  
  <pre><code>today [week] [month]
  ruby-on-rails(20)
  activerecord(10)
  java(5)
  </code></pre>
  
  <p>When the user click on week, the trend shows the weekly data and so on.
  And similarly, another trend graph is top 10 posts with highest # of comments</p>
  
  <p><strong>time series graphs:</strong></p>
  
  <p>for example, time vs # of posts, over a period of 24 hours, 1 week, 1 month etc.,</p>
  
  <pre><code>        30
      20  |
  10  |   |   10
  |   |   |   |
  t1  t2  t3  t4
  </code></pre>
  
  <p><a href="http://rubygems.org/stats.html" rel="nofollow">a visual example</a></p>
  
  <p><strong>Secondary Requirement:</strong>
  The time series graphs cane be interactive and we may want show the actual data or additional series when a point is selected. <strong>Additional series:</strong> for example when the user selects point (t3,30) we want to show the tag name vs #count data.</p>
  
  <pre><code>ruby-on-rails(15) 
  activerecord(10)
  java(5)
  </code></pre>
  
  <p>I have looked at <a href="https://github.com/acatighera/statistics" rel="nofollow">statistics</a> gem and it is good for generating counts but not graph data.</p>
  
  <p><strong>Question</strong>
  Is there a gem(framework) to generate data for these graphs?. In our case, the graph data can be cached and refreshed every 15/30 minutes.</p>