Commit aa7af57c76ee8b9d3fa51aa4a605581276a59245
1 parent
adfced57
Exists in
colab
and in
4 other branches
Metric chart code briefly reviewed
Identation fixed Chart width fixed in 600 px Chart centralized Signed-off by: Guilherme Rojas V. de Lima <guilhermehrojas@gmail.com> Signed-off by: Renan Fichberg <rfichberg@gmail.com>
Showing
2 changed files
with
43 additions
and
36 deletions
Show diff stats
app/assets/javascripts/graphics.js
... | ... | @@ -8,41 +8,44 @@ function chart_of_the_historic_of_metric (json_params, dinamic_values) |
8 | 8 | |
9 | 9 | $('#tr_container_' + container_id).hide(); |
10 | 10 | $(function () { |
11 | - $('#container_'+container_id).highcharts({ | |
12 | - chart: { | |
13 | - marginBottom: 80 | |
11 | + $('#container_'+container_id).highcharts({ | |
12 | + chart: { | |
13 | + marginBottom: 80, | |
14 | + width: 600, | |
15 | + style: {margin: '0 auto'} | |
16 | + }, | |
17 | + title: { | |
18 | + text: metric_name, | |
19 | + x: -20 //center | |
20 | + }, | |
21 | + subtitle: { | |
22 | + text: module_name, | |
23 | + x: -20 | |
24 | + }, | |
25 | + xAxis: { | |
26 | + categories: dates | |
27 | + }, | |
28 | + yAxis: { | |
29 | + title: { | |
30 | + text: 'Value' | |
14 | 31 | }, |
15 | - title: { | |
16 | - text: metric_name, | |
17 | - x: -20 //center | |
18 | - }, | |
19 | - subtitle: { | |
20 | - text: module_name, | |
21 | - x: -20 | |
22 | - }, | |
23 | - xAxis: { | |
24 | - categories: dates | |
25 | - }, | |
26 | - yAxis: { | |
27 | - title: { | |
28 | - text: 'Value' | |
29 | - }, | |
30 | - labels: { | |
31 | - align: 'left', | |
32 | - x: 0, | |
33 | - y: -2 | |
34 | - }, | |
35 | - plotLines: [{ | |
36 | - value: 0, | |
37 | - width: 1, | |
38 | - color: '#808080' | |
39 | - }] | |
40 | - }, | |
41 | - series: [{ | |
42 | - name: 'Metric value', | |
43 | - data: metric_values | |
44 | - }] | |
45 | - }); | |
32 | + labels: { | |
33 | + align: 'left', | |
34 | + x: 0, | |
35 | + y: -2 | |
36 | + }, | |
37 | + plotLines: [{ | |
38 | + value: 0, | |
39 | + width: 1, | |
40 | + color: '#808080' | |
41 | + }] | |
42 | + }, | |
43 | + series: [{ | |
44 | + name: 'Metric value', | |
45 | + data: metric_values | |
46 | + }] | |
46 | 47 | }); |
48 | + }); | |
49 | + | |
47 | 50 | $('#tr_container_' + container_id).show("slow"); |
48 | 51 | } |
49 | 52 | \ No newline at end of file | ... | ... |
app/views/repositories/_metric_result.html.erb
... | ... | @@ -18,5 +18,9 @@ |
18 | 18 | <td><%= metric_configuration_snapshot.weight %></td> |
19 | 19 | <td><span style="color: #<%= range_snapshot.color %>"><%= range_snapshot.label %></span></td> |
20 | 20 | </tr> |
21 | - <tr id="tr_container_<%= metric_result.id %>" style="display: none"><td colspan="4"><div id="container_<%= metric_result.id %>"></div></td></tr> | |
22 | -<% end %> | |
23 | 21 | \ No newline at end of file |
22 | + <tr id="tr_container_<%= metric_result.id %>" style="display: none"> | |
23 | + <td colspan="4"> | |
24 | + <div id="container_<%= metric_result.id %>"></div> | |
25 | + </td> | |
26 | + </tr> | |
27 | +<% end %> | |
24 | 28 | \ No newline at end of file | ... | ... |