Commit 52f237d6bb771b24a6b45f3a3f2c856f1fae8139
Committed by
Rafael Manzo
1 parent
8de19b71
Exists in
colab
and in
4 other branches
Generating graphics under the selected link.
The page is getting so much slow. pending: use ajax to get the history metric values and include it in the function that generate the graphics.
Showing
2 changed files
with
7 additions
and
4 deletions
Show diff stats
app/assets/javascripts/graphics.js
1 | -function generate_graphic(metric_name, module_name, date_list, metric_values_list) | 1 | +function generate_graphic(container_id, metric_name, module_name, date_list, metric_values_list) |
2 | { | 2 | { |
3 | date_list = date_list.split(','); | 3 | date_list = date_list.split(','); |
4 | metric_values_list = metric_values_list.split(','); | 4 | metric_values_list = metric_values_list.split(','); |
5 | for(var i = 0; i < metric_values_list.length; i++) { | 5 | for(var i = 0; i < metric_values_list.length; i++) { |
6 | metric_values_list[i] = parseInt(metric_values_list[i]); | 6 | metric_values_list[i] = parseInt(metric_values_list[i]); |
7 | } | 7 | } |
8 | + $('#container_'+container_id).hide(); | ||
8 | 9 | ||
9 | $(function () { | 10 | $(function () { |
10 | - $('#container').highcharts({ | 11 | + $('#container_'+container_id).highcharts({ |
11 | title: { | 12 | title: { |
12 | text: metric_name, | 13 | text: metric_name, |
13 | x: -20 //center | 14 | x: -20 //center |
@@ -41,4 +42,5 @@ function generate_graphic(metric_name, module_name, date_list, metric_values_lis | @@ -41,4 +42,5 @@ function generate_graphic(metric_name, module_name, date_list, metric_values_lis | ||
41 | }] | 42 | }] |
42 | }); | 43 | }); |
43 | }); | 44 | }); |
45 | + $('#container_'+container_id).show('slow'); | ||
44 | } | 46 | } |
45 | \ No newline at end of file | 47 | \ No newline at end of file |
app/views/repositories/_metric_result.html.erb
@@ -2,9 +2,10 @@ | @@ -2,9 +2,10 @@ | ||
2 | <% unless metric_configuration_snapshot.range_snapshot.nil? %> | 2 | <% unless metric_configuration_snapshot.range_snapshot.nil? %> |
3 | <% range_snapshot = find_range_snapshot(metric_result) %> | 3 | <% range_snapshot = find_range_snapshot(metric_result) %> |
4 | <tr> | 4 | <tr> |
5 | - <td><%= link_to metric_configuration_snapshot.metric.name, "#", onclick: "generate_graphic('metrica', 'modulo', '12/09/2012,21/10/2013,30/05/2013','12.7,13,20')" %></td> | 5 | + <td><%= link_to metric_configuration_snapshot.metric.name, '#', onclick: "generate_graphic(#{metric_result.id},#{metric_configuration_snapshot.metric.name}, #{module_result.module.name}, '12/09/2012,21/10/2013,30/05/2013','12.7,13,20')" %></td> |
6 | <td><%= format_grade(metric_result.value) %></td> | 6 | <td><%= format_grade(metric_result.value) %></td> |
7 | <td><%= metric_configuration_snapshot.weight %></td> | 7 | <td><%= metric_configuration_snapshot.weight %></td> |
8 | <td><span style="color: #<%= range_snapshot.color %>"><%= range_snapshot.label %></span></td> | 8 | <td><span style="color: #<%= range_snapshot.color %>"><%= range_snapshot.label %></span></td> |
9 | </tr> | 9 | </tr> |
10 | -<% end %> | ||
11 | \ No newline at end of file | 10 | \ No newline at end of file |
11 | + <tr><td colspan="4"><div id="container_<%= metric_result.id %>"></div></td></tr> | ||
12 | +<% end %> | ||
12 | \ No newline at end of file | 13 | \ No newline at end of file |