PageRenderTime 173ms CodeModel.GetById 170ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/views/stats.erb

https://bitbucket.org/lexgorbunov/hparcel
Ruby HTML | 97 lines | 96 code | 1 blank | 0 comment | 0 complexity | d2a56c8e632ef8bd9f52035e8e33a809 MD5 | raw file
 1<!DOCTYPE html>
 2<html>
 3<head>
 4  <title>HParcel :: Статистика</title>
 5  <script src="public/js/jquery-1.8.1.min.js" type="text/javascript"></script>
 6  <script src="public/js/highcharts/highcharts.js" type="text/javascript"></script>
 7  <script src="public/js/highcharts/modules/exporting.js"></script>
 8  <script type="text/javascript">
 9  $(function () {
10      var chart;
11      $(document).ready(function() {
12          chart = new Highcharts.Chart({
13              chart: {
14                  renderTo: 'container',
15                  type: 'line',
16                  marginRight: 130,
17                  marginBottom: 25
18              },
19              title: {
20                  text: 'Статистика доставки запросов',
21                  x: -20 //center
22              },
23              subtitle: {
24                  text: 'Author: Alexander Gorbunov',
25                  x: -20
26              },
27              xAxis: {
28                  // categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
29                  //     'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
30                  plotLines: [{
31                      value: 0,
32                      width: 1,
33                      color: '#808080'
34                  }]
35              },
36              yAxis: {
37                  title: {
38                      text: 'Запросы (шт)'
39                  },
40                  plotLines: [{
41                      value: 0,
42                      width: 1,
43                      color: '#808080'
44                  }]
45              },
46              tooltip: {
47                  formatter: function() {
48                          return '<b>'+ this.series.name +'</b><br/>'+
49                          this.x +' сек - '+ this.y +'шт';
50                  }
51              },
52              legend: {
53                  layout: 'vertical',
54                  align: 'right',
55                  verticalAlign: 'top',
56                  x: -10,
57                  y: 100,
58                  borderWidth: 0
59              },
60              series: [
61                {
62                    name: 'Добавлено в очередь',
63                    data: <%= history[:received].to_s %>//[7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
64                }, {
65                    name: 'Доставлено успешно',
66                    data: <%= history[:success].to_s %>//[-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
67                }, {
68                    name: 'Не удалось доставить',
69                    data: <%= history[:bad].to_s %>//[-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]
70                }
71              ]
72          });
73      });
74      
75  });
76  </script>
77</head>
78<body>
79  <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
80  <div>
81    <b>Статистика</b>
82    <table>
83      <tr>
84        <th>Добавлено в очередь</th><td><%= summary[:received] %></td>
85      </tr><tr>
86        <th>Доставлено успешно</th><td><%= summary[:success] %></td>
87      </tr><tr>
88        <th>Не удалось доставить</th><td><%= summary[:bad] %></td>
89      </tr>
90    </table>
91    <% unless summary[:failed_requests].count.zero? %>
92      <b>Запросы с ошибками:</b>
93      <%= summary[:failed_requests] %>
94    <% end %>
95  </div>
96</body>
97</html>