Changeset 82900
- Timestamp:
- 08/21/11 15:57:52 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gsoc11-statistics/stats-server/app/views/partials/_chart_draw.html.erb
r82851 r82900 1 <%# Set Defaults %> 2 <% drawtables_default = true %> 3 <% chart_width_default = 600 %> 4 <% chart_height_default = 400 %> 5 6 <%# Check if locals have been passed to this partial %> 7 <%# Use them if available, otherwise use defaults %> 8 9 <%# Avoid nil objects %> 10 <% if (defined? charts).nil? %> 11 <% charts = Hash.new %> 12 <% end %> 13 14 <%# Draw tables as well as visualizations? %> 15 <% if (defined? drawtables).nil? %> 16 <% drawtables = drawtables_default %> 17 <% end %> 18 19 <%# Get chart width %> 20 <% if (defined? chart_width).nil? %> 21 <% chart_width = chart_width_default %> 22 <% end %> 23 24 <%# Get chart height %> 25 <% if (defined? chart_height).nil? %> 26 <% chart_height = chart_height_default %> 27 <% end %> 28 29 <%# Set visualization options %> 30 <% vis_options = {:width => chart_width, 31 :height => chart_height, 32 :html => {:class => "graph_chart"}} 33 %> 34 35 <%# Set table options %> 36 <% table_options = {:width => 600, 37 :html => {:class => "graph_chart"}} 38 %> 39 40 1 41 <%# Draw charts %> 2 42 <% charts.each do |chart| %> 3 43 <% title = controller.chart_title chart %> 4 <%# Set visualization options %> 5 <% vis_options = {:width => 600, :height => 400, :html => {:class => "graph_chart"}} %> 44 <% type = controller.chart_type chart %> 45 46 <%# Set titles %> 6 47 <% vis_options[:title] = title %> 7 8 <%# Set table options %>9 <% table_options = {:width => 600, :html => {:class => "graph_chart"}} %>10 48 <% table_options[:title] = title %> 11 12 <% type = controller.chart_type chart %>13 49 14 50 <%# Anchor %> … … 24 60 <% end %> 25 61 26 <%# Draw table %> 27 <% table = chart.to_s + "_table" %> 28 <% visualization table, "Table", table_options do |visualization| %> 29 <% controller.populate_chart chart, visualization %> 62 <% if drawtables %> 63 <%# Draw table %> 64 <% table = chart.to_s + "_table" %> 65 <% visualization table, "Table", table_options do |visualization| %> 66 <% controller.populate_chart chart, visualization %> 67 <% end %> 30 68 <% end %> 31 69
Note: See TracChangeset
for help on using the changeset viewer.

