<%# Set Defaults %> <% drawtables_default = true %> <% headers_default = true %> <% chart_width_default = 700 %> <% chart_height_default = 400 %> <%# Check if locals have been passed to this partial %> <%# Use them if available, otherwise use defaults %> <%# Avoid nil objects %> <% if (defined? charts).nil? %> <% charts = Hash.new %> <% end %> <%# Draw tables as well as visualizations? %> <% if (defined? drawtables).nil? %> <% drawtables = drawtables_default %> <% end %> <%# Write headers? %> <% if (defined? headers).nil? %> <% headers = headers_default %> <% end %> <%# Get chart width %> <% if (defined? chart_width).nil? %> <% chart_width = chart_width_default %> <% end %> <%# Get chart height %> <% if (defined? chart_height).nil? %> <% chart_height = chart_height_default %> <% end %> <%# Set visualization options %> <% vis_options = {:width => chart_width, :height => chart_height, :pieHole => 0.4, :backgroundColor => '#ededed', :fontName => 'Helvetica', :html => {:class => "graph_chart"}} %> <%# Set table options %> <% tbl_options = {:width => 700, :html => {:class => "graph_chart"}} %> <%# Draw charts %> <% charts.each do |chart| %> <% title = controller.chart_title chart %> <% type = controller.chart_type chart %> <%# Set titles %> <% local_vis_options = vis_options.merge({ :title => title }) %> <% local_tbl_options = tbl_options.merge({ :title => title }) %> <%# Anchor %> > <%# Title %> <% if headers %>

<%= title %>

<% end %> <% if not controller.dataset_empty? chart %> <%# Draw visualization %> <% visualization chart.to_s, type, local_vis_options do |viz| %> <% controller.populate_chart chart, viz %> <% end %> <% if drawtables %> <%# Draw table %> <% table = chart.to_s + "_table" %> <% visualization table, "Table", local_tbl_options do |viz| %> <% controller.populate_chart chart, viz %> <% end %> <% end %> <% else %>

No data to display.

<% end %> <% end %>