Prev | Current Page 141 | Next

David Berube

"Practical Reporting with Ruby and Rails"

text.erb)
<%
labels = @events.map { |e| e[:event] }
values = @events.map { |e| e[:average_time] }
min = 0
max = values.max
graph_variables = { "title"=>",{margin:10px;}",
"bar_3d"=>"60,#8E9BF0,#000000",
"values"=>"#{values.join(',')}",
"x_labels"=>"#{labels.join(',')}",
CHAPTER 5 n CONNECTING YOUR REPORTS TO THE WORLD 97
"y_max"=>max,
"y_min"=>min,
"x_axis_3d"=>"16",
"tool_tip"=>"#x_label#: #val#s Average Time",
"y_axis_colour"=>"#F0F0F0",
"y_grid_colour"=>"#E9E9E9",
"y_label_style"=>"12,#000000",
"x_axis_colour"=>"#6F6F7F",
"x_grid_colour"=>"#E9E9E9",
"x_label_style"=>"15,#000000",
"bg_colour"=>"#F8F8FF" }
%>
&<%=graph_variables.to_a.map { |key,val| "#{key}=#{val}" }.join("& &") %>&
Finally, the code shown in Listing 5-20 goes in app/views/layouts/application.
html.erb.
Listing 5-20. Layout for the Team Performance View (app/views/layouts/
application.html.erb)


Team Performance Web Analyzer

<%=javascript_include_tag :defaults %>


<%=yield%>


And that completes the graphical reporting application.


Pages:
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153