[82158] branches/gsoc11-statistics/stats-server/app/views/ports/show.html. erb

derek at macports.org derek at macports.org
Mon Aug 8 20:27:24 PDT 2011


Revision: 82158
          http://trac.macports.org/changeset/82158
Author:   derek at macports.org
Date:     2011-08-08 20:27:24 -0700 (Mon, 08 Aug 2011)
Log Message:
-----------
Display charts along with port information

Charts are:
 - Installations over the past 12 months
 - Version installations over the past 12 months
 - Current distribution of versions installed
 - Current distribution of variants installed

Fine details:
 - Set chart title and type for each chart
 - Order the charts
 - Draw charts using gvis
 - Display a table of all data collected for this port for verification (debugging)

Modified Paths:
--------------
    branches/gsoc11-statistics/stats-server/app/views/ports/show.html.erb

Modified: branches/gsoc11-statistics/stats-server/app/views/ports/show.html.erb
===================================================================
--- branches/gsoc11-statistics/stats-server/app/views/ports/show.html.erb	2011-08-09 03:19:39 UTC (rev 82157)
+++ branches/gsoc11-statistics/stats-server/app/views/ports/show.html.erb	2011-08-09 03:27:24 UTC (rev 82158)
@@ -1,3 +1,21 @@
+<% controller.set_chart_title :version_count, 'All Versions' %>
+<% controller.set_chart_type :version_count, 'PieChart' %>
+
+<% controller.set_chart_title :variant_count, 'All Variants' %>
+<% controller.set_chart_type :variant_count, 'PieChart' %>
+
+<% controller.set_chart_title :versions_over_time, 'Top Versions in use Over Last 12 Months' %>
+<% controller.set_chart_type :versions_over_time, 'LineChart' %>
+
+<% controller.set_chart_title :installs_over_time, 'Installations Over Last 12 Months' %>
+<% controller.set_chart_type :installs_over_time, 'LineChart' %>
+
+<%# Order the charts %>
+<% ordered_charts = [:installs_over_time, 
+                     :versions_over_time, 
+                     :version_count, 
+                     :variant_count] %>
+
 <div id="content">
   <p>
     <strong>Name:</strong> <%= @port.name %>
@@ -30,4 +48,25 @@
     </p>
   <% end %>
 
-</div>
\ No newline at end of file
+  <%# Draw charts %>
+  <% ordered_charts.each do |chart| %>
+    <% options = {:width => 600, :height => 400, :html => {:class => "graph_chart"}} %>
+    <% options[:title] = controller.chart_title chart %>
+    <% type = controller.chart_type chart %>
+
+    <% visualization chart, type, options do |visualization| %>
+      <% controller.populate_chart chart, visualization %>
+    <% end %>
+  <% end %>
+
+  <% @installed.each do |row| %>
+    <tr>
+      <td> <%= row.id %> </td>
+      <td> <%= row.port_id %> </td>
+      <td> <%= row.version %></td>
+      <td> <%= row.variants %> </td>
+      <td> <%= row.updated_at %> </td>
+    </tr>
+  <% end %>
+
+</div>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110808/518dd284/attachment-0001.html>


More information about the macports-changes mailing list