hyper-d3 1.0.0.lap23

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.
Files changed (204) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +313 -0
  5. data/README.md +118 -0
  6. data/Rakefile +31 -0
  7. data/hyper-d3.gemspec +27 -0
  8. data/lib/d3.rb +68 -0
  9. data/lib/d3/arc.rb +29 -0
  10. data/lib/d3/area.rb +53 -0
  11. data/lib/d3/axis.rb +79 -0
  12. data/lib/d3/band_scale.rb +30 -0
  13. data/lib/d3/collections.rb +9 -0
  14. data/lib/d3/color.rb +76 -0
  15. data/lib/d3/color_schemes.rb +34 -0
  16. data/lib/d3/continuous_scale.rb +60 -0
  17. data/lib/d3/creator.rb +11 -0
  18. data/lib/d3/curve.rb +74 -0
  19. data/lib/d3/dsv.rb +103 -0
  20. data/lib/d3/ease.rb +319 -0
  21. data/lib/d3/format.rb +95 -0
  22. data/lib/d3/histograms.rb +46 -0
  23. data/lib/d3/interpolate.rb +125 -0
  24. data/lib/d3/line.rb +27 -0
  25. data/lib/d3/map.rb +48 -0
  26. data/lib/d3/misc.rb +15 -0
  27. data/lib/d3/native.rb +112 -0
  28. data/lib/d3/nest.rb +100 -0
  29. data/lib/d3/ordinal_scale.rb +39 -0
  30. data/lib/d3/path.rb +24 -0
  31. data/lib/d3/pie.rb +25 -0
  32. data/lib/d3/point_scale.rb +27 -0
  33. data/lib/d3/polygon.rb +18 -0
  34. data/lib/d3/quadtree.rb +89 -0
  35. data/lib/d3/quantile_scale.rb +19 -0
  36. data/lib/d3/quantize_scale.rb +20 -0
  37. data/lib/d3/radial_area.rb +55 -0
  38. data/lib/d3/radial_line.rb +27 -0
  39. data/lib/d3/random.rb +14 -0
  40. data/lib/d3/search.rb +30 -0
  41. data/lib/d3/selection.rb +151 -0
  42. data/lib/d3/sequential_scale.rb +31 -0
  43. data/lib/d3/set.rb +30 -0
  44. data/lib/d3/source/d3-drag.js +234 -0
  45. data/lib/d3/source/d3-scale-chromatic.js +484 -0
  46. data/lib/d3/source/d3.js +17178 -0
  47. data/lib/d3/stack.rb +13 -0
  48. data/lib/d3/statistics.rb +81 -0
  49. data/lib/d3/symbol.rb +70 -0
  50. data/lib/d3/threshold_scale.rb +22 -0
  51. data/lib/d3/time_format.rb +47 -0
  52. data/lib/d3/time_interval.rb +85 -0
  53. data/lib/d3/transformations.rb +16 -0
  54. data/lib/hyper-d3.rb +17 -0
  55. data/lib/hyperloop/d3/component.rb +12 -0
  56. data/lib/hyperloop/d3/mixin.rb +59 -0
  57. data/lib/hyperloop/d3/version.rb +5 -0
  58. data/spec/arc_spec.rb +80 -0
  59. data/spec/area_spec.rb +98 -0
  60. data/spec/axis_spec.rb +174 -0
  61. data/spec/band_scale_spec.rb +73 -0
  62. data/spec/color_spec.rb +74 -0
  63. data/spec/continuous_scale_spec.rb +217 -0
  64. data/spec/coverage_spec.rb +16 -0
  65. data/spec/creator_spec.rb +15 -0
  66. data/spec/curve_spec.rb +206 -0
  67. data/spec/dsv_spec.rb +194 -0
  68. data/spec/ease_spec.rb +370 -0
  69. data/spec/format_spec.rb +87 -0
  70. data/spec/histograms_spec.rb +61 -0
  71. data/spec/html/index.html.erb +11 -0
  72. data/spec/interpolate_spec.rb +152 -0
  73. data/spec/line_spec.rb +54 -0
  74. data/spec/map_spec.rb +80 -0
  75. data/spec/misc_spec.rb +21 -0
  76. data/spec/nest_spec.rb +89 -0
  77. data/spec/objects_spec.rb +22 -0
  78. data/spec/ordinal_scale_spec.rb +59 -0
  79. data/spec/path_spec.rb +65 -0
  80. data/spec/pie_spec.rb +114 -0
  81. data/spec/point_scale_spec.rb +58 -0
  82. data/spec/polygon_spec.rb +51 -0
  83. data/spec/quadtree_spec.rb +128 -0
  84. data/spec/quantile_scale_spec.rb +24 -0
  85. data/spec/quantize_scale_spec.rb +40 -0
  86. data/spec/radial_area_spec.rb +123 -0
  87. data/spec/radial_line_spec.rb +50 -0
  88. data/spec/random_spec.rb +34 -0
  89. data/spec/search_spec.rb +69 -0
  90. data/spec/selection_data_spec.rb +64 -0
  91. data/spec/selection_manipulation_spec.rb +166 -0
  92. data/spec/selection_spec.rb +187 -0
  93. data/spec/sequential_scale_spec.rb +90 -0
  94. data/spec/set_spec.rb +57 -0
  95. data/spec/spec_helper.rb +1 -0
  96. data/spec/stack_spec.rb +5 -0
  97. data/spec/statistics_spec.rb +65 -0
  98. data/spec/symbol_spec.rb +116 -0
  99. data/spec/test_app/.gitignore +23 -0
  100. data/spec/test_app/Gemfile +7 -0
  101. data/spec/test_app/Gemfile.lock +206 -0
  102. data/spec/test_app/README.md +9 -0
  103. data/spec/test_app/Rakefile +6 -0
  104. data/spec/test_app/app/assets/config/manifest.js +3 -0
  105. data/spec/test_app/app/assets/images/.keep +0 -0
  106. data/spec/test_app/app/assets/javascripts/application.js +13 -0
  107. data/spec/test_app/app/assets/javascripts/cable.js +13 -0
  108. data/spec/test_app/app/assets/javascripts/channels/.keep +0 -0
  109. data/spec/test_app/app/assets/javascripts/data/elections_2016.rb +10 -0
  110. data/spec/test_app/app/assets/javascripts/data/harry_potter.rb +19 -0
  111. data/spec/test_app/app/assets/javascripts/data/iphones.rb +29 -0
  112. data/spec/test_app/app/assets/javascripts/data/london_population.rb +26 -0
  113. data/spec/test_app/app/assets/javascripts/data/man_vs_horse.rb +55 -0
  114. data/spec/test_app/app/assets/javascripts/data/mtg_modern_colors.rb +96 -0
  115. data/spec/test_app/app/assets/javascripts/data/mtg_modern_creatures.rb +116 -0
  116. data/spec/test_app/app/assets/javascripts/data/olympics_2016_medals.rb +100 -0
  117. data/spec/test_app/app/assets/javascripts/data/paradox.rb +60 -0
  118. data/spec/test_app/app/assets/javascripts/data/polish_pms.rb +28 -0
  119. data/spec/test_app/app/assets/javascripts/data/star_trek_voyager.rb +183 -0
  120. data/spec/test_app/app/assets/javascripts/data/weather_in_london.rb +381 -0
  121. data/spec/test_app/app/assets/javascripts/elections_2016.rb +27 -0
  122. data/spec/test_app/app/assets/javascripts/harry_potter.rb +42 -0
  123. data/spec/test_app/app/assets/javascripts/iphones.rb +54 -0
  124. data/spec/test_app/app/assets/javascripts/london_population.rb +53 -0
  125. data/spec/test_app/app/assets/javascripts/london_population_area.rb +49 -0
  126. data/spec/test_app/app/assets/javascripts/man_vs_horse.rb +60 -0
  127. data/spec/test_app/app/assets/javascripts/mtg_modern_colors.rb +56 -0
  128. data/spec/test_app/app/assets/javascripts/mtg_modern_creatures.rb +70 -0
  129. data/spec/test_app/app/assets/javascripts/olympics_2016_medals.rb +62 -0
  130. data/spec/test_app/app/assets/javascripts/paradox.rb +64 -0
  131. data/spec/test_app/app/assets/javascripts/polish_pms.rb +60 -0
  132. data/spec/test_app/app/assets/javascripts/star_trek_voyager.rb +44 -0
  133. data/spec/test_app/app/assets/javascripts/weather_in_london.rb +69 -0
  134. data/spec/test_app/app/assets/stylesheets/application.css +15 -0
  135. data/spec/test_app/app/channels/application_cable/channel.rb +4 -0
  136. data/spec/test_app/app/channels/application_cable/connection.rb +4 -0
  137. data/spec/test_app/app/controllers/application_controller.rb +27 -0
  138. data/spec/test_app/app/controllers/concerns/.keep +0 -0
  139. data/spec/test_app/app/helpers/application_helper.rb +2 -0
  140. data/spec/test_app/app/jobs/application_job.rb +2 -0
  141. data/spec/test_app/app/mailers/application_mailer.rb +4 -0
  142. data/spec/test_app/app/models/application_record.rb +3 -0
  143. data/spec/test_app/app/models/concerns/.keep +0 -0
  144. data/spec/test_app/app/views/application/index.erb +18 -0
  145. data/spec/test_app/app/views/application/visualization.erb +28 -0
  146. data/spec/test_app/app/views/layouts/application.html.erb +13 -0
  147. data/spec/test_app/bin/bundle +3 -0
  148. data/spec/test_app/bin/rails +4 -0
  149. data/spec/test_app/bin/rake +4 -0
  150. data/spec/test_app/bin/setup +38 -0
  151. data/spec/test_app/bin/update +29 -0
  152. data/spec/test_app/bin/yarn +11 -0
  153. data/spec/test_app/config.ru +5 -0
  154. data/spec/test_app/config/application.rb +18 -0
  155. data/spec/test_app/config/boot.rb +3 -0
  156. data/spec/test_app/config/cable.yml +10 -0
  157. data/spec/test_app/config/database.yml +25 -0
  158. data/spec/test_app/config/environment.rb +5 -0
  159. data/spec/test_app/config/environments/development.rb +54 -0
  160. data/spec/test_app/config/environments/production.rb +91 -0
  161. data/spec/test_app/config/environments/test.rb +42 -0
  162. data/spec/test_app/config/initializers/application_controller_renderer.rb +8 -0
  163. data/spec/test_app/config/initializers/assets.rb +14 -0
  164. data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
  165. data/spec/test_app/config/initializers/cookies_serializer.rb +5 -0
  166. data/spec/test_app/config/initializers/filter_parameter_logging.rb +4 -0
  167. data/spec/test_app/config/initializers/inflections.rb +16 -0
  168. data/spec/test_app/config/initializers/mime_types.rb +4 -0
  169. data/spec/test_app/config/initializers/wrap_parameters.rb +14 -0
  170. data/spec/test_app/config/locales/en.yml +33 -0
  171. data/spec/test_app/config/puma.rb +56 -0
  172. data/spec/test_app/config/routes.rb +5 -0
  173. data/spec/test_app/config/secrets.yml +32 -0
  174. data/spec/test_app/config/spring.rb +6 -0
  175. data/spec/test_app/db/seeds.rb +7 -0
  176. data/spec/test_app/lib/assets/.keep +0 -0
  177. data/spec/test_app/lib/tasks/.keep +0 -0
  178. data/spec/test_app/log/.keep +0 -0
  179. data/spec/test_app/package.json +5 -0
  180. data/spec/test_app/public/404.html +67 -0
  181. data/spec/test_app/public/422.html +67 -0
  182. data/spec/test_app/public/500.html +66 -0
  183. data/spec/test_app/public/apple-touch-icon-precomposed.png +0 -0
  184. data/spec/test_app/public/apple-touch-icon.png +0 -0
  185. data/spec/test_app/public/favicon.ico +0 -0
  186. data/spec/test_app/public/robots.txt +1 -0
  187. data/spec/test_app/test/application_system_test_case.rb +5 -0
  188. data/spec/test_app/test/controllers/.keep +0 -0
  189. data/spec/test_app/test/fixtures/.keep +0 -0
  190. data/spec/test_app/test/fixtures/files/.keep +0 -0
  191. data/spec/test_app/test/helpers/.keep +0 -0
  192. data/spec/test_app/test/integration/.keep +0 -0
  193. data/spec/test_app/test/mailers/.keep +0 -0
  194. data/spec/test_app/test/models/.keep +0 -0
  195. data/spec/test_app/test/system/.keep +0 -0
  196. data/spec/test_app/test/test_helper.rb +10 -0
  197. data/spec/test_app/tmp/.keep +0 -0
  198. data/spec/test_app/vendor/.keep +0 -0
  199. data/spec/threshold_scale_spec.rb +28 -0
  200. data/spec/time_format_spec.rb +100 -0
  201. data/spec/time_interval_spec.rb +314 -0
  202. data/spec/transformations_spec.rb +51 -0
  203. data/startrekvoyager.png +0 -0
  204. metadata +529 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 45032d4f5b1d0d3cfd2219d4e6b7607ecc3e6ab3a3c7275f39779bfb5ec3331d
4
+ data.tar.gz: 2e95aec56ecc220b909da3467cec07d78974b46969d83f223ffbf2aa5df98c63
5
+ SHA512:
6
+ metadata.gz: c61a10abba99de9e6ce1076056bc060bf9b76de4bea7ef91bf3fb3fb73c03a460e22d5f64f59494a6850f9feb3632155e3ea0acb9708951154b6dcd7084f0e3c
7
+ data.tar.gz: 0d907502dad346d25511a1ded0db08f8291696aea1f03f93d761283b6569677f56b0f393cabb841f2f5acd74193c56671a6c76d3c9fe57b5015962b9f00673be
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ spec/test_app/vendor/bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+ gem "opal-jquery", git: "https://github.com/opal/opal-jquery.git", branch: "master"
3
+ gemspec
4
+
data/Gemfile.lock ADDED
@@ -0,0 +1,313 @@
1
+ GIT
2
+ remote: https://github.com/opal/opal-jquery.git
3
+ revision: f47a9b42da366cea270f743b05acf529f3077d35
4
+ branch: master
5
+ specs:
6
+ opal-jquery (0.4.2)
7
+ opal (>= 0.10.0, < 0.12.0)
8
+
9
+ PATH
10
+ remote: .
11
+ specs:
12
+ opal-d3 (0.0.20170822)
13
+ hyper-component (~> 1.0.0.lap23)
14
+ hyperloop-config (~> 1.0.0.lap23)
15
+ opal (~> 0.11.0)
16
+ opal-activesupport (~> 0.3.1)
17
+
18
+ GEM
19
+ remote: https://rubygems.org/
20
+ specs:
21
+ abstract_type (0.0.7)
22
+ actioncable (5.1.5)
23
+ actionpack (= 5.1.5)
24
+ nio4r (~> 2.0)
25
+ websocket-driver (~> 0.6.1)
26
+ actionmailer (5.1.5)
27
+ actionpack (= 5.1.5)
28
+ actionview (= 5.1.5)
29
+ activejob (= 5.1.5)
30
+ mail (~> 2.5, >= 2.5.4)
31
+ rails-dom-testing (~> 2.0)
32
+ actionpack (5.1.5)
33
+ actionview (= 5.1.5)
34
+ activesupport (= 5.1.5)
35
+ rack (~> 2.0)
36
+ rack-test (>= 0.6.3)
37
+ rails-dom-testing (~> 2.0)
38
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
39
+ actionview (5.1.5)
40
+ activesupport (= 5.1.5)
41
+ builder (~> 3.1)
42
+ erubi (~> 1.4)
43
+ rails-dom-testing (~> 2.0)
44
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
45
+ activejob (5.1.5)
46
+ activesupport (= 5.1.5)
47
+ globalid (>= 0.3.6)
48
+ activemodel (5.1.5)
49
+ activesupport (= 5.1.5)
50
+ activerecord (5.1.5)
51
+ activemodel (= 5.1.5)
52
+ activesupport (= 5.1.5)
53
+ arel (~> 8.0)
54
+ activesupport (5.1.5)
55
+ concurrent-ruby (~> 1.0, >= 1.0.2)
56
+ i18n (~> 0.7)
57
+ minitest (~> 5.1)
58
+ tzinfo (~> 1.1)
59
+ adamantium (0.2.0)
60
+ ice_nine (~> 0.11.0)
61
+ memoizable (~> 0.4.0)
62
+ addressable (2.5.2)
63
+ public_suffix (>= 2.0.2, < 4.0)
64
+ archive-zip (0.11.0)
65
+ io-like (~> 0.3.0)
66
+ arel (8.0.0)
67
+ ast (2.4.0)
68
+ babel-source (5.8.35)
69
+ babel-transpiler (0.7.0)
70
+ babel-source (>= 4.0, < 6)
71
+ execjs (~> 2.0)
72
+ builder (3.2.3)
73
+ capybara (2.18.0)
74
+ addressable
75
+ mini_mime (>= 0.1.3)
76
+ nokogiri (>= 1.3.3)
77
+ rack (>= 1.0.0)
78
+ rack-test (>= 0.5.4)
79
+ xpath (>= 2.0, < 4.0)
80
+ childprocess (0.8.0)
81
+ ffi (~> 1.0, >= 1.0.11)
82
+ chromedriver-helper (1.2.0)
83
+ archive-zip (~> 0.10)
84
+ nokogiri (~> 1.8)
85
+ coderay (1.1.2)
86
+ concord (0.1.5)
87
+ adamantium (~> 0.2.0)
88
+ equalizer (~> 0.0.9)
89
+ concurrent-ruby (1.0.5)
90
+ connection_pool (2.2.1)
91
+ crass (1.0.3)
92
+ diff-lcs (1.3)
93
+ equalizer (0.0.11)
94
+ erubi (1.7.0)
95
+ execjs (2.7.0)
96
+ ffi (1.9.21)
97
+ globalid (0.4.1)
98
+ activesupport (>= 4.2.0)
99
+ hike (1.2.3)
100
+ hyper-component (1.0.0.lap23)
101
+ actionview (>= 4.0.0)
102
+ hyper-react (= 1.0.0.lap23)
103
+ hyperloop-config (= 1.0.0.lap23)
104
+ opal-rails (~> 0.9.4)
105
+ react-rails (>= 2.4.0, < 2.5.0)
106
+ hyper-mesh (1.0.0.lap23)
107
+ activerecord (>= 4.0.0)
108
+ hyper-component (= 1.0.0.lap23)
109
+ hyper-operation (= 1.0.0.lap23)
110
+ hyper-model (1.0.0.lap23)
111
+ hyper-mesh (= 1.0.0.lap23)
112
+ hyper-operation (1.0.0.lap23)
113
+ activerecord (>= 4.0.0)
114
+ hyper-component (= 1.0.0.lap23)
115
+ hyperloop-config (= 1.0.0.lap23)
116
+ mutations
117
+ opal-activesupport (~> 0.3.1)
118
+ hyper-react (1.0.0.lap23)
119
+ hyper-store (= 1.0.0.lap23)
120
+ opal (>= 0.11.0, < 0.12.0)
121
+ opal-activesupport (~> 0.3.1)
122
+ hyper-router (4.2.6.lap23)
123
+ hyper-component (= 1.0.0.lap23)
124
+ hyper-react (= 1.0.0.lap23)
125
+ opal-browser (~> 0.2.0)
126
+ opal-rails (~> 0.9.4)
127
+ react-rails (>= 2.4.0, < 2.5.0)
128
+ hyper-spec (1.0.0.lap23)
129
+ capybara
130
+ chromedriver-helper
131
+ method_source
132
+ opal (>= 0.11.0, < 0.12.0)
133
+ parser (>= 2.3.3.1)
134
+ pry
135
+ rspec-rails
136
+ selenium-webdriver
137
+ timecop (~> 0.8.1)
138
+ uglifier
139
+ unparser
140
+ webdrivers
141
+ hyper-store (1.0.0.lap23)
142
+ hyperloop-config (= 1.0.0.lap23)
143
+ opal (>= 0.11.0, < 0.12.0)
144
+ hyperloop (1.0.0.lap23)
145
+ hyper-model (= 1.0.0.lap23)
146
+ hyper-router (= 4.2.6.lap23)
147
+ hyperloop-config (= 1.0.0.lap23)
148
+ mini_racer (~> 0.1.15)
149
+ opal-browser (~> 0.2.0)
150
+ opal-rails (~> 0.9.4)
151
+ rails (>= 4.0.0)
152
+ react-rails (>= 2.4.0, < 2.5.0)
153
+ hyperloop-config (1.0.0.lap23)
154
+ opal (>= 0.11.0, < 0.12.0)
155
+ opal-browser (~> 0.2.0)
156
+ uglifier
157
+ i18n (0.9.5)
158
+ concurrent-ruby (~> 1.0)
159
+ ice_nine (0.11.2)
160
+ io-like (0.3.0)
161
+ jquery-rails (4.3.1)
162
+ rails-dom-testing (>= 1, < 3)
163
+ railties (>= 4.2.0)
164
+ thor (>= 0.14, < 2.0)
165
+ libv8 (6.3.292.48.1)
166
+ loofah (2.2.0)
167
+ crass (~> 1.0.2)
168
+ nokogiri (>= 1.5.9)
169
+ mail (2.7.0)
170
+ mini_mime (>= 0.1.1)
171
+ memoizable (0.4.2)
172
+ thread_safe (~> 0.3, >= 0.3.1)
173
+ method_source (0.9.0)
174
+ mini_mime (1.0.0)
175
+ mini_portile2 (2.3.0)
176
+ mini_racer (0.1.15)
177
+ libv8 (~> 6.3)
178
+ minitest (5.11.3)
179
+ mutations (0.8.1)
180
+ activesupport
181
+ nio4r (2.2.0)
182
+ nokogiri (1.8.2)
183
+ mini_portile2 (~> 2.3.0)
184
+ opal (0.11.0)
185
+ ast (>= 2.3.0)
186
+ hike (~> 1.2)
187
+ parser (= 2.3.3.1)
188
+ sourcemap (~> 0.1.0)
189
+ opal-activesupport (0.3.1)
190
+ opal (>= 0.5.0, < 1.0.0)
191
+ opal-browser (0.2.0)
192
+ opal
193
+ paggio
194
+ opal-rails (0.9.4)
195
+ jquery-rails
196
+ opal (>= 0.10.0, < 0.12)
197
+ opal-activesupport (>= 0.0.5)
198
+ opal-jquery (~> 0.4.0)
199
+ opal-sprockets (~> 0.4.1)
200
+ rails (>= 4.1, < 6.0)
201
+ sprockets-rails (>= 2.3.3, < 4.0)
202
+ opal-sprockets (0.4.1.0.11.0.3.1)
203
+ opal (~> 0.11.0)
204
+ sprockets (~> 3.1)
205
+ tilt (>= 1.4)
206
+ paggio (0.2.6)
207
+ parser (2.3.3.1)
208
+ ast (~> 2.2)
209
+ procto (0.0.3)
210
+ pry (0.11.3)
211
+ coderay (~> 1.1.0)
212
+ method_source (~> 0.9.0)
213
+ public_suffix (3.0.2)
214
+ rack (2.0.4)
215
+ rack-test (0.8.2)
216
+ rack (>= 1.0, < 3)
217
+ rails (5.1.5)
218
+ actioncable (= 5.1.5)
219
+ actionmailer (= 5.1.5)
220
+ actionpack (= 5.1.5)
221
+ actionview (= 5.1.5)
222
+ activejob (= 5.1.5)
223
+ activemodel (= 5.1.5)
224
+ activerecord (= 5.1.5)
225
+ activesupport (= 5.1.5)
226
+ bundler (>= 1.3.0)
227
+ railties (= 5.1.5)
228
+ sprockets-rails (>= 2.0.0)
229
+ rails-dom-testing (2.0.3)
230
+ activesupport (>= 4.2.0)
231
+ nokogiri (>= 1.6)
232
+ rails-html-sanitizer (1.0.3)
233
+ loofah (~> 2.0)
234
+ railties (5.1.5)
235
+ actionpack (= 5.1.5)
236
+ activesupport (= 5.1.5)
237
+ method_source
238
+ rake (>= 0.8.7)
239
+ thor (>= 0.18.1, < 2.0)
240
+ rake (12.3.0)
241
+ react-rails (2.4.4)
242
+ babel-transpiler (>= 0.7.0)
243
+ connection_pool
244
+ execjs
245
+ railties (>= 3.2)
246
+ tilt
247
+ rspec-core (3.7.1)
248
+ rspec-support (~> 3.7.0)
249
+ rspec-expectations (3.7.0)
250
+ diff-lcs (>= 1.2.0, < 2.0)
251
+ rspec-support (~> 3.7.0)
252
+ rspec-mocks (3.7.0)
253
+ diff-lcs (>= 1.2.0, < 2.0)
254
+ rspec-support (~> 3.7.0)
255
+ rspec-rails (3.7.2)
256
+ actionpack (>= 3.0)
257
+ activesupport (>= 3.0)
258
+ railties (>= 3.0)
259
+ rspec-core (~> 3.7.0)
260
+ rspec-expectations (~> 3.7.0)
261
+ rspec-mocks (~> 3.7.0)
262
+ rspec-support (~> 3.7.0)
263
+ rspec-support (3.7.1)
264
+ rubyzip (1.2.1)
265
+ selenium-webdriver (3.9.0)
266
+ childprocess (~> 0.5)
267
+ rubyzip (~> 1.2)
268
+ sourcemap (0.1.1)
269
+ sprockets (3.7.1)
270
+ concurrent-ruby (~> 1.0)
271
+ rack (> 1, < 3)
272
+ sprockets-rails (3.2.1)
273
+ actionpack (>= 4.0)
274
+ activesupport (>= 4.0)
275
+ sprockets (>= 3.0.0)
276
+ thor (0.20.0)
277
+ thread_safe (0.3.6)
278
+ tilt (2.0.8)
279
+ timecop (0.8.1)
280
+ tzinfo (1.2.5)
281
+ thread_safe (~> 0.1)
282
+ uglifier (4.1.6)
283
+ execjs (>= 0.3.0, < 3)
284
+ unparser (0.2.6)
285
+ abstract_type (~> 0.0.7)
286
+ adamantium (~> 0.2.0)
287
+ concord (~> 0.1.5)
288
+ diff-lcs (~> 1.3)
289
+ equalizer (~> 0.0.9)
290
+ parser (>= 2.3.1.2, < 2.5)
291
+ procto (~> 0.0.2)
292
+ webdrivers (3.2.4)
293
+ nokogiri (~> 1.6)
294
+ rubyzip (~> 1.0)
295
+ selenium-webdriver (~> 3.0)
296
+ websocket-driver (0.6.5)
297
+ websocket-extensions (>= 0.1.0)
298
+ websocket-extensions (0.1.3)
299
+ xpath (3.0.0)
300
+ nokogiri (~> 1.8)
301
+
302
+ PLATFORMS
303
+ ruby
304
+
305
+ DEPENDENCIES
306
+ hyper-spec (~> 1.0.0.lap23)
307
+ hyperloop (~> 1.0.0.lap23)
308
+ opal-d3!
309
+ opal-jquery!
310
+ rake (>= 11.3.0)
311
+
312
+ BUNDLED WITH
313
+ 1.16.1
data/README.md ADDED
@@ -0,0 +1,118 @@
1
+ # Hyper-D3
2
+
3
+ A [Ruby-Hyperloop](https://ruby-hyperloop.org/) Component including a
4
+ Opal Ruby interface for D3 [https://d3js.org/].
5
+
6
+ It implements interface fairly closely following javascript API, except with blocks, classes, no camelcase etc.
7
+
8
+ About 60% of D3 APIs are implemented. Pull requests for the rest are very welcome.
9
+
10
+ [Opal-D3](https://taw.github.io/opal-d3/) was orginally developed by Tomasz Wegrzanowski, @taw.
11
+
12
+ ## Installation
13
+
14
+ in your ruby-hyperloop application or your rails apps Gemfile add:
15
+ ```
16
+ gem 'hyper-d3'
17
+ ```
18
+ bundle update, done.
19
+
20
+ ## Usage
21
+
22
+ There are various examples in the `spec/test_app/app/assets/javascripts` directory.
23
+ Git clone this repo, cd to spec/test_app, bundle update, rails s and visit [http://localhost:3000] to see them in action.
24
+
25
+ ## Commented Example
26
+
27
+ To achieve this:
28
+ ![Star Trek Voyager Demo](https://github.com/janbiedermann/hyper-d3/blob/hyperloopification/startrekvoyager.png?raw=true)
29
+
30
+ Do this:
31
+ ```ruby
32
+ # create your component class, either by inheriting from Hyperloop::D3::Component:
33
+ class StarTrekVoyagerComponent < Hyperloop::D3::Component
34
+ # or you include the Hyperloop::D3::Mixin like this:
35
+ # include Hyperloop::D3::Mixin
36
+
37
+ # Thy Hyperloop::D3::Component provides a convenience render method 'render_with_selection'
38
+ # and with that, takes care of all the things that need to be done for react, to use D3.js
39
+ # This method provides two arguments to the block, a D3::Selection, and the data that has
40
+ # been passed in as param for the component.
41
+ # By default, render_with_selection will provide a empty <svg> as selection,
42
+ # here the 'DIV' is passed as argument to render_with_selection, the selection argument
43
+ # passed to the block therefore is a <div>
44
+ # Within the block, just use the selection as you usually would with D3.
45
+
46
+ # You would mount or render that Component with the data as paramter, like:
47
+ # StarTrekVoyagerComponent(data: VoyagerData)
48
+
49
+ render_with_selection('DIV') do |selection, voyager_data|
50
+ svg = selection.append("svg")
51
+ .attr("height", "600px")
52
+ .attr("width", "100%")
53
+ width = svg.style("width").to_i
54
+
55
+ x = D3.scale_linear.domain([0, voyager_data.size-1]).range([40, width-20])
56
+ y = D3.scale_linear.domain(voyager_data.map(&:rating).minmax).range([550, 50])
57
+ c = D3.scale_ordinal.range(D3.scheme_category_10)
58
+
59
+ (1..7).each do |season|
60
+ episodes = voyager_data.select{|episode| episode.season == season }
61
+ avg = D3.mean(episodes.map(&:rating))
62
+ svg.append("line")
63
+ .attr("x1", x.(episodes.map(&:number).min))
64
+ .attr("x2", x.(episodes.map(&:number).max))
65
+ .attr("y1", y.(avg))
66
+ .attr("y2", y.(avg))
67
+ .attr("stroke", c.(season))
68
+ .attr("stroke-width", 2)
69
+ .attr("opacity", 0.4)
70
+ end
71
+
72
+ voyager_data.each do |episode|
73
+ svg.append("circle")
74
+ .attr("cx", x.(episode.number))
75
+ .attr("cy", y.(episode.rating))
76
+ .attr("r", 4)
77
+ .attr("fill", c.(episode.season))
78
+ .attr("opacity", 0.6)
79
+ end
80
+
81
+ axis = D3.axis_left(y)
82
+ svg.append("g").attr("transform","translate(30, 0)")
83
+ .call(axis)
84
+ end
85
+ end
86
+ ```
87
+
88
+ ### Reactive D3
89
+ If you need the component to be "reactive", you mount the component within a outer component and make the data
90
+ depending on state, for example:
91
+ ```
92
+ class OuterComponent
93
+ render('DIV') do
94
+ StarTrekVoyagerComponent(data: state.data)
95
+ end
96
+ end
97
+ ```
98
+ When state.data changes, the StarTrekVoaygerComponent will receive that as new param and render with the new data.
99
+ **Its important to note** though, that react doesnt do the diff for native js dom manipulations, that means, if the
100
+ component receives new data, it must do the DOM housekeeping itself, remove dom nodes or add or replace them within
101
+ the block passed to render_with_selection.
102
+
103
+ ### Events
104
+ Events in the D3 classes are currentyly badly supported. You must most probably revert to native JS inlining.
105
+ To clean up the event handlers, you can use the before_unmount_with_selection callback. It will be called with the root
106
+ selection and the most recent data received:
107
+ ```ruby
108
+ class StarTrekVoyagerComponent < Hyperloop::D3::Component
109
+ before_unmount_with_selection do |selection, voyager_data|
110
+ # here called with the <div> as D3 selection, because of render_with_selection('DIV')
111
+ # clean up event handlers or anything else here
112
+ end
113
+
114
+ render_with_selection('DIV') do |selection, voyager_data|
115
+ # draw here
116
+ end
117
+ end
118
+ ```