swagr 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/swagr +7 -9
- data/examples/examples01/app.rb +1 -6
- data/examples/examples01/brownian_searcher.rb +8 -7
- data/examples/examples01/coffee/d3graph.coffee +10 -3
- data/examples/examples01/coffee/data_port.coffee +0 -0
- data/examples/examples01/coffee/updating_text_graph.coffee +1 -1
- data/examples/examples01/coffee/updating_top_list.coffee +7 -1
- data/examples/examples01/static/js/jquery-latest.js +3705 -3622
- data/examples/examples01/views/index.slim +17 -14
- data/lib/swagr/version.rb +1 -1
- data/swagr.gemspec +0 -1
- data/templates/app.rb +3 -8
- data/templates/brownian_searcher.rb +8 -7
- data/templates/coffee/d3graph.coffee +10 -3
- data/templates/coffee/data_port.coffee +2 -0
- data/templates/coffee/updating_text_graph.coffee +1 -1
- data/templates/coffee/updating_top_list.coffee +7 -1
- data/templates/static/js/jquery-latest.js +3705 -3622
- data/templates/views/index.slim +17 -14
- metadata +4 -18
data/templates/views/index.slim
CHANGED
@@ -15,10 +15,9 @@ div class="container"
|
|
15
15
|
|
16
16
|
/! Example B: Using d3 to add elements dynamically
|
17
17
|
script src="js/d3.v3.min.js"
|
18
|
-
div class="container" id="
|
19
|
-
div class="container" id="d3b"
|
18
|
+
div class="container" id="d3"
|
20
19
|
script type="text/javascript"
|
21
|
-
| var co = d3.select("#
|
20
|
+
| var co = d3.select("#d3");
|
22
21
|
co.append("p").text("Hello, d3.js world!");
|
23
22
|
|
24
23
|
/! Example C: Coffee-script inline and importing from other files
|
@@ -41,30 +40,34 @@ script type="text/coffeescript"
|
|
41
40
|
|
42
41
|
# 1. Updating row of random int values
|
43
42
|
g = new root.Swagr.UpdatingTextGraph "#updating_text", "/data/randints/arrayofsize6.json", {
|
44
|
-
width:
|
45
|
-
height:
|
43
|
+
width: 500
|
44
|
+
height: 120
|
45
|
+
x_per_element: 70
|
46
46
|
}
|
47
|
-
g.run_updates_for(5)
|
48
|
-
|
47
|
+
#g.run_updates_for(5)
|
48
|
+
g.start_updates()
|
49
49
|
|
50
50
|
|
51
51
|
# 2. Updating top list of positions found by BrownianSearcher
|
52
52
|
|
53
53
|
class MyUpdatingTopList extends root.Swagr.UpdatingToplist
|
54
54
|
_join_data: (data) ->
|
55
|
-
|
55
|
+
# We use the id (which is actually the step number) of each position to identify it. This
|
56
|
+
# is needed to achieve "object constancy" in the visual transitions of the top list graph.
|
57
|
+
@svg.selectAll("text").data(data.top_list, (d, i) -> d.id)
|
56
58
|
|
57
59
|
textmapper: (elems, data) -> (d,i) ->
|
60
|
+
# Focus on distance since that is what positions are ranked on, then add other info about a position.
|
58
61
|
(i+1).toString() + ". dist: " + d.distance.toFixed(2) +
|
59
62
|
" pos: (" + d.x + ", " + d.y + ")" +
|
60
|
-
" step: " + d.
|
63
|
+
" step: " + d.id
|
61
64
|
|
62
65
|
g2 = new MyUpdatingTopList "#top_list", "/data/brownian_search/search_info.json", {
|
63
66
|
width: 500
|
64
67
|
height: 160
|
65
|
-
|
66
|
-
|
67
|
-
transition_time:
|
68
|
+
update_interval: 2.5
|
69
|
+
transition_x: 100
|
70
|
+
transition_time: 800
|
68
71
|
}
|
69
72
|
#g2.run_updates_for(20)
|
70
73
|
g2.start_updates()
|
@@ -72,9 +75,9 @@ script type="text/coffeescript"
|
|
72
75
|
# 3. Header for the top list, showing current number of steps.
|
73
76
|
update_header = () ->
|
74
77
|
d3.json("/data/brownian_search/current_position.json", (error, data) ->
|
75
|
-
pos_str = "(" + data
|
78
|
+
pos_str = "(" + data.x + ", " + data.y + ")"
|
76
79
|
d3.select("#top_list_header").select("text")
|
77
|
-
.text("Top 5 positions at step: " + data
|
80
|
+
.text("Top 5 positions at step: " + data.id + ", pos: " + pos_str)
|
78
81
|
)
|
79
82
|
update_header()
|
80
83
|
setInterval(update_header, g2.opts.update_interval * 1000)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swagr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -43,22 +43,6 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: sass
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
46
|
- !ruby/object:Gem::Dependency
|
63
47
|
name: coffee-script
|
64
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,6 +93,7 @@ files:
|
|
109
93
|
- examples/examples01/brownian_searcher.rb
|
110
94
|
- examples/examples01/coffee/application.coffee
|
111
95
|
- examples/examples01/coffee/d3graph.coffee
|
96
|
+
- examples/examples01/coffee/data_port.coffee
|
112
97
|
- examples/examples01/coffee/updating_text_graph.coffee
|
113
98
|
- examples/examples01/coffee/updating_top_list.coffee
|
114
99
|
- examples/examples01/static/css/bootstrap.css
|
@@ -134,6 +119,7 @@ files:
|
|
134
119
|
- templates/brownian_searcher.rb
|
135
120
|
- templates/coffee/application.coffee
|
136
121
|
- templates/coffee/d3graph.coffee
|
122
|
+
- templates/coffee/data_port.coffee
|
137
123
|
- templates/coffee/updating_text_graph.coffee
|
138
124
|
- templates/coffee/updating_top_list.coffee
|
139
125
|
- templates/static/css/style.css
|