cert_open_data_visualizer 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,74 @@
1
+
2
+ :javascript
3
+ google.load('visualization', '1.0', {'packages':['corechart']});
4
+ google.setOnLoadCallback(drawFirstChart);
5
+ google.setOnLoadCallback(drawSecondChart);
6
+ function drawFirstChart() {
7
+
8
+ // Create the data table.
9
+ var data = new google.visualization.DataTable();
10
+ data.addColumn('string', 'Incidents');
11
+ data.addColumn('number', '# of incidents');
12
+ var first = JSON.parse($("#first-data").html());
13
+ var first_data = new Array();
14
+
15
+ for (var key in first) {
16
+ first_data.push([key, parseInt(first[key])]);
17
+ }
18
+ data.addRows(first_data);
19
+
20
+ // Set chart options
21
+ var options = {'title':'Number of incidents',
22
+ 'width':800,
23
+ 'height':300};
24
+
25
+ // Instantiate and draw our chart, passing in some options.
26
+ var chart = new google.visualization.BarChart(document.getElementById('first_chart'));
27
+ chart.draw(data, options);
28
+ }
29
+
30
+ function drawSecondChart() {
31
+ // Create the data table.
32
+ var data = new google.visualization.DataTable();
33
+ data.addColumn('string', 'Incidents');
34
+ data.addColumn('number', '# of incidents');
35
+ var first = JSON.parse($("#second-data").html());
36
+ var second_data = new Array();
37
+
38
+ for (var key in first) {
39
+ second_data.push([key, parseInt(first[key])]);
40
+ }
41
+ data.addRows(second_data);
42
+
43
+ // Set chart options
44
+ var options = {'title':'Incidents for each location',
45
+ 'width':1000,
46
+ 'height':9000,
47
+ 'fontSize': 7,
48
+ 'hAxis': {'logScale': true},
49
+ 'chartArea': {'left': 100, 'right': 10, 'top': 50}
50
+ };
51
+
52
+ // Instantiate and draw our chart, passing in some options.
53
+ var chart = new google.visualization.BarChart(document.getElementById('second_chart'));
54
+ chart.draw(data, options);
55
+ }
56
+
57
+
58
+
59
+ .row
60
+ %h3 First data
61
+ #first_chart
62
+ .row
63
+ %h3 Second data
64
+ #second_chart
65
+
66
+
67
+ %script{id: "first-data", type: "text/plain"}
68
+ = @first_format_json
69
+
70
+ %script{id: "second-data", type: "text/plain"}
71
+ = @second_format_json
72
+
73
+
74
+
@@ -0,0 +1,9 @@
1
+ %h1
2
+ %a{href: "https://www.cert.fi/en/reports/statistics/opendata.html"} Visualizer for cert open data
3
+
4
+ .row.well
5
+ .col-xs-6.well
6
+ = @first_format.gsub("\n", "<br>")
7
+ .col-xs-6.well
8
+ = @second_format.gsub("\n", "<br>")
9
+
@@ -0,0 +1,22 @@
1
+ !!! 5
2
+ %html(lang="en")
3
+ %head
4
+ %meta(charset="utf-8")
5
+ %meta(http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1")
6
+ %meta(name="viewport" content="width=device-width, initial-scale=1.0")
7
+ %title Visualizer
8
+ %script{src: "javascripts/jquery-2.0.3.min.js", type: "text/javascript"}
9
+ %link{:rel => :stylesheet, :type => :"text/css", :href => "stylesheets/bootstrap.min.css"}
10
+ %script{src: "javascripts/bootstrap.min.js", type: "text/javascript"}
11
+ %script{type: "text/javascript", src: "https://www.google.com/jsapi"}
12
+
13
+ %body
14
+ %ul.nav.nav-pills
15
+ %li.active
16
+ %a{href: "/"}Home
17
+ %li.active
18
+ %a{href: "/charts"}Charts
19
+ %li.active
20
+ %a{href: "/reload"}Reload
21
+ .container
22
+ =yield
@@ -0,0 +1,7 @@
1
+ .jubmotron
2
+ %h2 I am sure, I want to redownload and reparse all data
3
+
4
+ %a{href: '/reset'}
5
+ %button.btn.btn-danger
6
+ Redownload
7
+
@@ -1,3 +1,3 @@
1
1
  module CertOpenDataVisualizer
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cert_open_data_visualizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-01 00:00:00.000000000 Z
12
+ date: 2013-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sinatra
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.4.4
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.4.4
14
30
  - !ruby/object:Gem::Dependency
15
31
  name: httparty
16
32
  requirement: !ruby/object:Gem::Requirement
@@ -68,6 +84,7 @@ extensions: []
68
84
  extra_rdoc_files: []
69
85
  files:
70
86
  - Gemfile
87
+ - Gemfile.lock
71
88
  - LICENSE.txt
72
89
  - README.md
73
90
  - Rakefile
@@ -77,6 +94,20 @@ files:
77
94
  - lib/cert_open_data_visualizer/cli.rb
78
95
  - lib/cert_open_data_visualizer/dummy_cacher.rb
79
96
  - lib/cert_open_data_visualizer/formatter.rb
97
+ - lib/cert_open_data_visualizer/frontend/Gemfile
98
+ - lib/cert_open_data_visualizer/frontend/Gemfile.lock
99
+ - lib/cert_open_data_visualizer/frontend/Readme.md
100
+ - lib/cert_open_data_visualizer/frontend/app.rb
101
+ - lib/cert_open_data_visualizer/frontend/config.ru
102
+ - lib/cert_open_data_visualizer/frontend/public/bootstrap.min.css
103
+ - lib/cert_open_data_visualizer/frontend/public/bootstrap.min.js
104
+ - lib/cert_open_data_visualizer/frontend/public/javascripts/bootstrap.min.js
105
+ - lib/cert_open_data_visualizer/frontend/public/javascripts/jquery-2.0.3.min.js
106
+ - lib/cert_open_data_visualizer/frontend/public/stylesheets/bootstrap.min.css
107
+ - lib/cert_open_data_visualizer/frontend/views/charts.haml
108
+ - lib/cert_open_data_visualizer/frontend/views/index.haml
109
+ - lib/cert_open_data_visualizer/frontend/views/layout.haml
110
+ - lib/cert_open_data_visualizer/frontend/views/reset.haml
80
111
  - lib/cert_open_data_visualizer/version.rb
81
112
  - lib/cert_open_data_visualizer/visualize.rb
82
113
  homepage: https://github.com/jamox/cert