Prev | Current Page 154 | Next

David Berube

"Practical Reporting with Ruby and Rails"

It would also add code that is irrelevant to the three other output formats to
the controller.
Next, the code sets a few view-specific options:
graph_variables = { "title"=>",{margin:10px;}",
"bar_3d"=>"60,#8E9BF0,#000000",
"values"=>"#{values.join(',')}",
"x_labels"=>"#{labels.join(',')}",
"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("& &") %>&
Many of these options are fairly self-explanatory. For example, x_axis_colour controls
the color of the x axis lines. The y_ticks parameter is a comma-delimited list of three
parameters, which control the ticks (the small lines that point to numeric labels) on the
left side of the graph. The first y_ticks parameter is the distance from the ticks to the
labels, the second is the distance from the labels to the chart itself, and the third is the
total number of ticks.


Pages:
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
Drukarnia Eric Marienthal kreskowka Grażyna Łobaszewska Michał Lorenc