[82851] branches/gsoc11-statistics/stats-server/app/views/partials/ _chart_draw.html.erb

derek at macports.org derek at macports.org
Sat Aug 20 20:06:57 PDT 2011


Revision: 82851
          http://trac.macports.org/changeset/82851
Author:   derek at macports.org
Date:     2011-08-20 20:06:56 -0700 (Sat, 20 Aug 2011)
Log Message:
-----------
Moved chart drawing code to a partial

Added Paths:
-----------
    branches/gsoc11-statistics/stats-server/app/views/partials/_chart_draw.html.erb

Added: branches/gsoc11-statistics/stats-server/app/views/partials/_chart_draw.html.erb
===================================================================
--- branches/gsoc11-statistics/stats-server/app/views/partials/_chart_draw.html.erb	                        (rev 0)
+++ branches/gsoc11-statistics/stats-server/app/views/partials/_chart_draw.html.erb	2011-08-21 03:06:56 UTC (rev 82851)
@@ -0,0 +1,35 @@
+<%# Draw charts %>
+<% charts.each do |chart| %>
+  <% title = controller.chart_title chart %>
+  <%# Set visualization options %>
+  <% vis_options = {:width => 600, :height => 400, :html => {:class => "graph_chart"}} %>
+  <% vis_options[:title] = title %>
+
+  <%# Set table options %>
+  <% table_options = {:width => 600, :html => {:class => "graph_chart"}} %>
+  <% table_options[:title] = title %>
+  
+  <% type = controller.chart_type chart %>
+
+  <%# Anchor %>
+  <a name=<%= chart %>> </a>
+  <%# Title %>
+  <h2> <%= title %> </h2>
+ 
+
+  <% if not controller.dataset_empty? chart %>
+    <%# Draw visualization %>
+    <% visualization chart, type, vis_options do |visualization| %>
+      <% controller.populate_chart chart, visualization %>
+    <% end %>
+    
+    <%# Draw table %>
+    <% table = chart.to_s + "_table" %>
+    <% visualization table, "Table", table_options do |visualization| %>
+      <% controller.populate_chart chart, visualization %>
+    <% end %>
+    
+  <% else %>
+    No data to display
+  <% end %>  
+<% end %>
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110820/dd4c57b7/attachment-0001.html>


More information about the macports-changes mailing list