bum 0.0.4 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (576) hide show
  1. data/README +0 -12
  2. data/bin/bum +16 -49
  3. data/bin/bum_master +20 -0
  4. data/lib/actor.rb +0 -0
  5. data/lib/app_role.rb +83 -0
  6. data/lib/client.rb +104 -0
  7. data/lib/db_crap.rb +85 -0
  8. data/lib/db_role.rb +107 -0
  9. data/lib/demo_socket.rb +51 -0
  10. data/lib/master.rb +109 -0
  11. data/lib/master_web.rb +81 -0
  12. data/lib/nice_socket.rb +77 -0
  13. data/lib/node.rb +96 -0
  14. data/lib/proxy_role.rb +132 -0
  15. data/lib/role.rb +99 -0
  16. data/lib/scenario.rb +186 -0
  17. data/lib/server.rb +30 -0
  18. data/lib/stats_role.rb +89 -0
  19. data/public/app.css +91 -0
  20. data/public/css/light.css +105 -0
  21. data/public/d3/LICENSE +26 -0
  22. data/public/d3/Makefile +247 -0
  23. data/public/d3/README.md +51 -0
  24. data/public/d3/d3.chart.js +984 -0
  25. data/public/d3/d3.chart.min.js +1 -0
  26. data/public/d3/d3.csv.js +92 -0
  27. data/public/d3/d3.csv.min.js +1 -0
  28. data/public/d3/d3.geo.js +692 -0
  29. data/public/d3/d3.geo.min.js +1 -0
  30. data/public/d3/d3.geom.js +825 -0
  31. data/public/d3/d3.geom.min.js +1 -0
  32. data/public/d3/d3.js +4013 -0
  33. data/public/d3/d3.layout.js +1865 -0
  34. data/public/d3/d3.layout.min.js +1 -0
  35. data/public/d3/d3.min.js +2 -0
  36. data/public/d3/d3.time.js +663 -0
  37. data/public/d3/d3.time.min.js +1 -0
  38. data/public/d3/examples/albers/albers.html +168 -0
  39. data/public/d3/examples/area/area-radial.html +48 -0
  40. data/public/d3/examples/area/area.html +113 -0
  41. data/public/d3/examples/axis/axis-alternating.html +50 -0
  42. data/public/d3/examples/axis/axis-ggplot2.html +68 -0
  43. data/public/d3/examples/axis/axis-multiples.html +117 -0
  44. data/public/d3/examples/axis/axis-orientations.html +63 -0
  45. data/public/d3/examples/axis/axis-transition.html +153 -0
  46. data/public/d3/examples/azimuthal/azimuthal.css +21 -0
  47. data/public/d3/examples/azimuthal/azimuthal.html +84 -0
  48. data/public/d3/examples/azimuthal/azimuthal.js +27 -0
  49. data/public/d3/examples/bar/bar.html +93 -0
  50. data/public/d3/examples/box/box.css +4 -0
  51. data/public/d3/examples/box/box.html +19 -0
  52. data/public/d3/examples/box/box.js +68 -0
  53. data/public/d3/examples/bubble/bubble.css +8 -0
  54. data/public/d3/examples/bubble/bubble.html +14 -0
  55. data/public/d3/examples/bubble/bubble.js +46 -0
  56. data/public/d3/examples/bullet/bullet.css +10 -0
  57. data/public/d3/examples/bullet/bullet.html +18 -0
  58. data/public/d3/examples/bullet/bullet.js +53 -0
  59. data/public/d3/examples/bullet/bullets.json +7 -0
  60. data/public/d3/examples/bundle/bundle-radial.css +9 -0
  61. data/public/d3/examples/bundle/bundle-radial.html +15 -0
  62. data/public/d3/examples/bundle/bundle-radial.js +50 -0
  63. data/public/d3/examples/bundle/bundle-treemap.css +14 -0
  64. data/public/d3/examples/bundle/bundle-treemap.html +16 -0
  65. data/public/d3/examples/bundle/bundle-treemap.js +53 -0
  66. data/public/d3/examples/bundle/packages.js +49 -0
  67. data/public/d3/examples/button.css +35 -0
  68. data/public/d3/examples/calendar/calendar.css +16 -0
  69. data/public/d3/examples/calendar/calendar.js +50 -0
  70. data/public/d3/examples/calendar/dji.csv +5233 -0
  71. data/public/d3/examples/calendar/dji.html +16 -0
  72. data/public/d3/examples/calendar/dji.js +61 -0
  73. data/public/d3/examples/calendar/vix.csv +5231 -0
  74. data/public/d3/examples/calendar/vix.html +16 -0
  75. data/public/d3/examples/calendar/vix.js +60 -0
  76. data/public/d3/examples/cartogram/cartogram.css +20 -0
  77. data/public/d3/examples/cartogram/cartogram.html +15 -0
  78. data/public/d3/examples/cartogram/cartogram.js +51 -0
  79. data/public/d3/examples/cartogram/demers.css +9 -0
  80. data/public/d3/examples/cartogram/demers.html +16 -0
  81. data/public/d3/examples/cartogram/demers.js +79 -0
  82. data/public/d3/examples/cartogram/dorling.css +9 -0
  83. data/public/d3/examples/cartogram/dorling.html +16 -0
  84. data/public/d3/examples/cartogram/dorling.js +80 -0
  85. data/public/d3/examples/chord/chord-flare.html +109 -0
  86. data/public/d3/examples/chord/chord.css +9 -0
  87. data/public/d3/examples/chord/chord.html +14 -0
  88. data/public/d3/examples/chord/chord.js +98 -0
  89. data/public/d3/examples/choropleth/choropleth-area.html +51 -0
  90. data/public/d3/examples/choropleth/choropleth-bounds.html +46 -0
  91. data/public/d3/examples/choropleth/choropleth.css +16 -0
  92. data/public/d3/examples/choropleth/choropleth.html +15 -0
  93. data/public/d3/examples/choropleth/choropleth.js +38 -0
  94. data/public/d3/examples/choropleth/unemployment.json +1 -0
  95. data/public/d3/examples/clock/clock.css +23 -0
  96. data/public/d3/examples/clock/clock.html +17 -0
  97. data/public/d3/examples/clock/clock.js +87 -0
  98. data/public/d3/examples/cluster/cluster-radial.html +14 -0
  99. data/public/d3/examples/cluster/cluster-radial.js +39 -0
  100. data/public/d3/examples/cluster/cluster.css +15 -0
  101. data/public/d3/examples/cluster/cluster.html +14 -0
  102. data/public/d3/examples/cluster/cluster.js +39 -0
  103. data/public/d3/examples/contour/contour.html +108 -0
  104. data/public/d3/examples/crimea/crimea-stacked-area.html +109 -0
  105. data/public/d3/examples/crimea/crimea-stacked-bar.html +98 -0
  106. data/public/d3/examples/crimea/crimea.csv +24 -0
  107. data/public/d3/examples/data/README +5 -0
  108. data/public/d3/examples/data/faithful.json +8 -0
  109. data/public/d3/examples/data/flare-imports.json +222 -0
  110. data/public/d3/examples/data/flare.json +380 -0
  111. data/public/d3/examples/data/morley.csv +101 -0
  112. data/public/d3/examples/data/sample.csv +2 -0
  113. data/public/d3/examples/data/sample.html +5 -0
  114. data/public/d3/examples/data/sample.json +1 -0
  115. data/public/d3/examples/data/sample.txt +1 -0
  116. data/public/d3/examples/data/sample.xml +4 -0
  117. data/public/d3/examples/data/stocks.csv +807 -0
  118. data/public/d3/examples/data/unemployment.csv +1709 -0
  119. data/public/d3/examples/data/us-borders.json +1 -0
  120. data/public/d3/examples/data/us-counties.json +3216 -0
  121. data/public/d3/examples/data/us-state-centroids.json +1 -0
  122. data/public/d3/examples/data/us-states.json +54 -0
  123. data/public/d3/examples/data/world-countries.json +246 -0
  124. data/public/d3/examples/delaunay/delaunay.html +44 -0
  125. data/public/d3/examples/donut/donut.html +124 -0
  126. data/public/d3/examples/dot/dot.html +103 -0
  127. data/public/d3/examples/force/README +10 -0
  128. data/public/d3/examples/force/force-bounds.html +70 -0
  129. data/public/d3/examples/force/force-cluster.html +251 -0
  130. data/public/d3/examples/force/force-dynamic.html +118 -0
  131. data/public/d3/examples/force/force-interactive.html +136 -0
  132. data/public/d3/examples/force/force-map.html +104 -0
  133. data/public/d3/examples/force/force-multi-foci.html +68 -0
  134. data/public/d3/examples/force/force.css +9 -0
  135. data/public/d3/examples/force/force.html +14 -0
  136. data/public/d3/examples/force/force.js +56 -0
  137. data/public/d3/examples/force/miserables.json +1 -0
  138. data/public/d3/examples/hello-world/hello-data-key.html +60 -0
  139. data/public/d3/examples/hello-world/hello-data-nested-key.html +75 -0
  140. data/public/d3/examples/hello-world/hello-data-nested.html +77 -0
  141. data/public/d3/examples/hello-world/hello-data.html +46 -0
  142. data/public/d3/examples/hello-world/hello-event.html +53 -0
  143. data/public/d3/examples/hello-world/hello-node-key.html +25 -0
  144. data/public/d3/examples/hello-world/hello-sort.html +75 -0
  145. data/public/d3/examples/hello-world/hello-transform.html +41 -0
  146. data/public/d3/examples/hello-world/hello-transition-undefined.html +43 -0
  147. data/public/d3/examples/hello-world/hello-transition.html +47 -0
  148. data/public/d3/examples/hello-world/hello-webkit-transition.html +64 -0
  149. data/public/d3/examples/hello-world/select-enter-add.html +29 -0
  150. data/public/d3/examples/hello-world/selectAll-enter-add.html +20 -0
  151. data/public/d3/examples/histogram/histogram.html +80 -0
  152. data/public/d3/examples/horizon/horizon.css +9 -0
  153. data/public/d3/examples/horizon/horizon.html +25 -0
  154. data/public/d3/examples/horizon/horizon.js +43 -0
  155. data/public/d3/examples/horizon/unemployment.json +1 -0
  156. data/public/d3/examples/hull/hull.html +75 -0
  157. data/public/d3/examples/kde/kde.css +9 -0
  158. data/public/d3/examples/kde/kde.html +14 -0
  159. data/public/d3/examples/kde/kde.js +40 -0
  160. data/public/d3/examples/line/line.css +22 -0
  161. data/public/d3/examples/line/line.html +11 -0
  162. data/public/d3/examples/line/line.js +63 -0
  163. data/public/d3/examples/marimekko/marimekko.html +116 -0
  164. data/public/d3/examples/marimekko/marimekko.json +18 -0
  165. data/public/d3/examples/marker/marker.html +169 -0
  166. data/public/d3/examples/mercator/mercator.html +133 -0
  167. data/public/d3/examples/moire/moire.html +53 -0
  168. data/public/d3/examples/pack/pack.css +15 -0
  169. data/public/d3/examples/pack/pack.html +14 -0
  170. data/public/d3/examples/pack/pack.js +33 -0
  171. data/public/d3/examples/partition/partition-icicle-zoom.html +59 -0
  172. data/public/d3/examples/partition/partition-icicle.html +45 -0
  173. data/public/d3/examples/partition/partition-sunburst-zoom.html +72 -0
  174. data/public/d3/examples/partition/partition-sunburst.html +21 -0
  175. data/public/d3/examples/partition/partition-sunburst.js +72 -0
  176. data/public/d3/examples/pie/pie-transition.html +70 -0
  177. data/public/d3/examples/pie/pie.html +51 -0
  178. data/public/d3/examples/population/population.css +28 -0
  179. data/public/d3/examples/population/population.csv +571 -0
  180. data/public/d3/examples/population/population.html +13 -0
  181. data/public/d3/examples/population/population.js +126 -0
  182. data/public/d3/examples/qq/qq.css +18 -0
  183. data/public/d3/examples/qq/qq.html +21 -0
  184. data/public/d3/examples/qq/qq.js +66 -0
  185. data/public/d3/examples/qq/stats.js +28 -0
  186. data/public/d3/examples/qq/turkers.json +1 -0
  187. data/public/d3/examples/quadtree/quadtree.html +114 -0
  188. data/public/d3/examples/sizzle/sizzle.html +27 -0
  189. data/public/d3/examples/sort/sort.css +4 -0
  190. data/public/d3/examples/sort/sort.html +12 -0
  191. data/public/d3/examples/sort/sort.js +112 -0
  192. data/public/d3/examples/spline/spline.css +30 -0
  193. data/public/d3/examples/spline/spline.html +14 -0
  194. data/public/d3/examples/spline/spline.js +113 -0
  195. data/public/d3/examples/splom/cross.js +7 -0
  196. data/public/d3/examples/splom/flowers.json +1 -0
  197. data/public/d3/examples/splom/splom.css +8 -0
  198. data/public/d3/examples/splom/splom.html +14 -0
  199. data/public/d3/examples/splom/splom.js +149 -0
  200. data/public/d3/examples/stream/stack.css +7 -0
  201. data/public/d3/examples/stream/stack.html +22 -0
  202. data/public/d3/examples/stream/stack.js +119 -0
  203. data/public/d3/examples/stream/stream.css +3 -0
  204. data/public/d3/examples/stream/stream.html +19 -0
  205. data/public/d3/examples/stream/stream.js +42 -0
  206. data/public/d3/examples/stream/stream_layers.js +33 -0
  207. data/public/d3/examples/superformula/dot.html +104 -0
  208. data/public/d3/examples/superformula/explorer.html +120 -0
  209. data/public/d3/examples/superformula/superformula.html +70 -0
  210. data/public/d3/examples/superformula/superformula.js +98 -0
  211. data/public/d3/examples/symbol-map/symbol-map.html +67 -0
  212. data/public/d3/examples/touch/touch.html +65 -0
  213. data/public/d3/examples/tree/tree-dynamic.html +111 -0
  214. data/public/d3/examples/tree/tree-interactive.html +139 -0
  215. data/public/d3/examples/tree/tree-radial.html +14 -0
  216. data/public/d3/examples/tree/tree-radial.js +40 -0
  217. data/public/d3/examples/tree/tree.css +15 -0
  218. data/public/d3/examples/tree/tree.html +14 -0
  219. data/public/d3/examples/tree/tree.js +39 -0
  220. data/public/d3/examples/treemap/treemap-svg.html +22 -0
  221. data/public/d3/examples/treemap/treemap-svg.js +34 -0
  222. data/public/d3/examples/treemap/treemap.css +8 -0
  223. data/public/d3/examples/treemap/treemap.html +22 -0
  224. data/public/d3/examples/treemap/treemap.js +53 -0
  225. data/public/d3/examples/voroboids/boid.js +235 -0
  226. data/public/d3/examples/voroboids/voroboids.css +15 -0
  227. data/public/d3/examples/voroboids/voroboids.html +14 -0
  228. data/public/d3/examples/voroboids/voroboids.js +65 -0
  229. data/public/d3/examples/voronoi/voronoi.css +16 -0
  230. data/public/d3/examples/voronoi/voronoi.html +15 -0
  231. data/public/d3/examples/voronoi/voronoi.js +34 -0
  232. data/public/d3/examples/zoom-pan/zoom-pan-transform.html +95 -0
  233. data/public/d3/examples/zoom-pan/zoom-pan.html +119 -0
  234. data/public/d3/examples/zoom/dji.csv +5233 -0
  235. data/public/d3/examples/zoom/zoom.html +162 -0
  236. data/public/d3/lib/colorbrewer/LICENSE +38 -0
  237. data/public/d3/lib/colorbrewer/colorbrewer.css +1327 -0
  238. data/public/d3/lib/colorbrewer/colorbrewer.js +32 -0
  239. data/public/d3/lib/jit/LICENSE +27 -0
  240. data/public/d3/lib/jquery-ui/LICENSE +25 -0
  241. data/public/d3/lib/jquery-ui/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  242. data/public/d3/lib/jquery-ui/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  243. data/public/d3/lib/jquery-ui/images/ui-bg_flat_10_000000_40x100.png +0 -0
  244. data/public/d3/lib/jquery-ui/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  245. data/public/d3/lib/jquery-ui/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  246. data/public/d3/lib/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  247. data/public/d3/lib/jquery-ui/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  248. data/public/d3/lib/jquery-ui/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  249. data/public/d3/lib/jquery-ui/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  250. data/public/d3/lib/jquery-ui/images/ui-icons_222222_256x240.png +0 -0
  251. data/public/d3/lib/jquery-ui/images/ui-icons_228ef1_256x240.png +0 -0
  252. data/public/d3/lib/jquery-ui/images/ui-icons_ef8c08_256x240.png +0 -0
  253. data/public/d3/lib/jquery-ui/images/ui-icons_ffd27a_256x240.png +0 -0
  254. data/public/d3/lib/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
  255. data/public/d3/lib/jquery-ui/jquery-ui.css +318 -0
  256. data/public/d3/lib/jquery-ui/jquery-ui.min.js +83 -0
  257. data/public/d3/lib/jquery/LICENSE +20 -0
  258. data/public/d3/lib/jquery/jquery.js +6883 -0
  259. data/public/d3/lib/jquery/jquery.min.js +166 -0
  260. data/public/d3/lib/polymaps/LICENSE +28 -0
  261. data/public/d3/lib/protovis/LICENSE +27 -0
  262. data/public/d3/lib/science/LICENSE +26 -0
  263. data/public/d3/lib/science/science.js +5 -0
  264. data/public/d3/lib/science/science.min.js +1 -0
  265. data/public/d3/lib/science/science.stats.js +166 -0
  266. data/public/d3/lib/science/science.stats.min.js +1 -0
  267. data/public/d3/lib/sizzle/LICENSE +24 -0
  268. data/public/d3/lib/sizzle/sizzle.js +1376 -0
  269. data/public/d3/lib/sizzle/sizzle.min.js +28 -0
  270. data/public/d3/package.json +14 -0
  271. data/public/d3/src/behavior/behavior.js +1 -0
  272. data/public/d3/src/behavior/drag.js +106 -0
  273. data/public/d3/src/behavior/zoom.js +212 -0
  274. data/public/d3/src/chart/box.js +297 -0
  275. data/public/d3/src/chart/bullet.js +237 -0
  276. data/public/d3/src/chart/chart.js +1 -0
  277. data/public/d3/src/chart/horizon.js +203 -0
  278. data/public/d3/src/chart/qq.js +245 -0
  279. data/public/d3/src/compat/date.js +3 -0
  280. data/public/d3/src/compat/style.js +9 -0
  281. data/public/d3/src/core/array.js +11 -0
  282. data/public/d3/src/core/ascending.js +3 -0
  283. data/public/d3/src/core/bisect.js +38 -0
  284. data/public/d3/src/core/collapse.js +3 -0
  285. data/public/d3/src/core/core.js +1 -0
  286. data/public/d3/src/core/descending.js +3 -0
  287. data/public/d3/src/core/dispatch.js +45 -0
  288. data/public/d3/src/core/ease.js +128 -0
  289. data/public/d3/src/core/entries.js +5 -0
  290. data/public/d3/src/core/event.js +1 -0
  291. data/public/d3/src/core/first.js +13 -0
  292. data/public/d3/src/core/format.js +85 -0
  293. data/public/d3/src/core/functor.js +3 -0
  294. data/public/d3/src/core/hsl.js +62 -0
  295. data/public/d3/src/core/html.js +10 -0
  296. data/public/d3/src/core/interpolate.js +180 -0
  297. data/public/d3/src/core/json.js +5 -0
  298. data/public/d3/src/core/keys.js +5 -0
  299. data/public/d3/src/core/last.js +13 -0
  300. data/public/d3/src/core/max.js +14 -0
  301. data/public/d3/src/core/merge.js +3 -0
  302. data/public/d3/src/core/min.js +14 -0
  303. data/public/d3/src/core/nest.js +87 -0
  304. data/public/d3/src/core/noop.js +1 -0
  305. data/public/d3/src/core/ns.js +19 -0
  306. data/public/d3/src/core/permute.js +7 -0
  307. data/public/d3/src/core/quantile.js +8 -0
  308. data/public/d3/src/core/range.js +21 -0
  309. data/public/d3/src/core/rebind.js +7 -0
  310. data/public/d3/src/core/requote.js +5 -0
  311. data/public/d3/src/core/rgb.js +284 -0
  312. data/public/d3/src/core/round.js +5 -0
  313. data/public/d3/src/core/selection-append.js +15 -0
  314. data/public/d3/src/core/selection-attr.js +44 -0
  315. data/public/d3/src/core/selection-call.js +13 -0
  316. data/public/d3/src/core/selection-classed.js +46 -0
  317. data/public/d3/src/core/selection-data.js +110 -0
  318. data/public/d3/src/core/selection-each.js +9 -0
  319. data/public/d3/src/core/selection-empty.js +3 -0
  320. data/public/d3/src/core/selection-enter-select.js +24 -0
  321. data/public/d3/src/core/selection-enter.js +10 -0
  322. data/public/d3/src/core/selection-filter.js +19 -0
  323. data/public/d3/src/core/selection-html.js +6 -0
  324. data/public/d3/src/core/selection-insert.js +20 -0
  325. data/public/d3/src/core/selection-map.js +5 -0
  326. data/public/d3/src/core/selection-node.js +9 -0
  327. data/public/d3/src/core/selection-on.js +34 -0
  328. data/public/d3/src/core/selection-property.js +23 -0
  329. data/public/d3/src/core/selection-remove.js +9 -0
  330. data/public/d3/src/core/selection-root.js +16 -0
  331. data/public/d3/src/core/selection-select.js +30 -0
  332. data/public/d3/src/core/selection-selectAll.js +24 -0
  333. data/public/d3/src/core/selection-sort.js +20 -0
  334. data/public/d3/src/core/selection-style.js +26 -0
  335. data/public/d3/src/core/selection-text.js +6 -0
  336. data/public/d3/src/core/selection-transition.js +14 -0
  337. data/public/d3/src/core/selection.js +21 -0
  338. data/public/d3/src/core/split.js +21 -0
  339. data/public/d3/src/core/sum.js +14 -0
  340. data/public/d3/src/core/text.js +10 -0
  341. data/public/d3/src/core/this.js +3 -0
  342. data/public/d3/src/core/timer.js +104 -0
  343. data/public/d3/src/core/transition-attr.js +23 -0
  344. data/public/d3/src/core/transition-delay.js +6 -0
  345. data/public/d3/src/core/transition-duration.js +6 -0
  346. data/public/d3/src/core/transition-each.js +9 -0
  347. data/public/d3/src/core/transition-remove.js +6 -0
  348. data/public/d3/src/core/transition-select.js +22 -0
  349. data/public/d3/src/core/transition-selectAll.js +20 -0
  350. data/public/d3/src/core/transition-style.js +14 -0
  351. data/public/d3/src/core/transition-text.js +7 -0
  352. data/public/d3/src/core/transition-transition.js +3 -0
  353. data/public/d3/src/core/transition.js +105 -0
  354. data/public/d3/src/core/uninterpolate.js +9 -0
  355. data/public/d3/src/core/values.js +5 -0
  356. data/public/d3/src/core/xhr.js +10 -0
  357. data/public/d3/src/core/xml.js +10 -0
  358. data/public/d3/src/core/zip.js +13 -0
  359. data/public/d3/src/csv/csv.js +5 -0
  360. data/public/d3/src/csv/format.js +13 -0
  361. data/public/d3/src/csv/parse.js +73 -0
  362. data/public/d3/src/end.js +1 -0
  363. data/public/d3/src/externs.js +6 -0
  364. data/public/d3/src/geo/albers.js +128 -0
  365. data/public/d3/src/geo/azimuthal.js +70 -0
  366. data/public/d3/src/geo/bounds.js +76 -0
  367. data/public/d3/src/geo/geo.js +1 -0
  368. data/public/d3/src/geo/greatCircle.js +91 -0
  369. data/public/d3/src/geo/mercator.js +36 -0
  370. data/public/d3/src/geo/path.js +289 -0
  371. data/public/d3/src/geom/contour.js +78 -0
  372. data/public/d3/src/geom/delaunay.js +31 -0
  373. data/public/d3/src/geom/geom.js +1 -0
  374. data/public/d3/src/geom/hull.js +98 -0
  375. data/public/d3/src/geom/polygon.js +88 -0
  376. data/public/d3/src/geom/quadtree.js +129 -0
  377. data/public/d3/src/geom/voronoi.js +399 -0
  378. data/public/d3/src/layout/bundle.js +57 -0
  379. data/public/d3/src/layout/chord.js +148 -0
  380. data/public/d3/src/layout/cluster.js +77 -0
  381. data/public/d3/src/layout/force.js +332 -0
  382. data/public/d3/src/layout/hierarchy.js +120 -0
  383. data/public/d3/src/layout/histogram.js +102 -0
  384. data/public/d3/src/layout/layout.js +1 -0
  385. data/public/d3/src/layout/pack.js +200 -0
  386. data/public/d3/src/layout/partition.js +48 -0
  387. data/public/d3/src/layout/pie.js +95 -0
  388. data/public/d3/src/layout/stack.js +237 -0
  389. data/public/d3/src/layout/tree.js +234 -0
  390. data/public/d3/src/layout/treemap.js +213 -0
  391. data/public/d3/src/scale/bilinear.js +7 -0
  392. data/public/d3/src/scale/category.js +54 -0
  393. data/public/d3/src/scale/linear.js +115 -0
  394. data/public/d3/src/scale/log.js +80 -0
  395. data/public/d3/src/scale/nice.js +21 -0
  396. data/public/d3/src/scale/ordinal.js +74 -0
  397. data/public/d3/src/scale/polylinear.js +16 -0
  398. data/public/d3/src/scale/pow.js +54 -0
  399. data/public/d3/src/scale/quantile.js +43 -0
  400. data/public/d3/src/scale/quantize.js +36 -0
  401. data/public/d3/src/scale/scale.js +6 -0
  402. data/public/d3/src/scale/sqrt.js +3 -0
  403. data/public/d3/src/start.js +1 -0
  404. data/public/d3/src/svg/arc.js +95 -0
  405. data/public/d3/src/svg/area-radial.js +10 -0
  406. data/public/d3/src/svg/area.js +84 -0
  407. data/public/d3/src/svg/axis.js +182 -0
  408. data/public/d3/src/svg/chord.js +99 -0
  409. data/public/d3/src/svg/diagonal-radial.js +22 -0
  410. data/public/d3/src/svg/diagonal.js +38 -0
  411. data/public/d3/src/svg/line-radial.js +22 -0
  412. data/public/d3/src/svg/line.js +419 -0
  413. data/public/d3/src/svg/mouse.js +29 -0
  414. data/public/d3/src/svg/svg.js +1 -0
  415. data/public/d3/src/svg/symbol.js +98 -0
  416. data/public/d3/src/svg/touches.js +8 -0
  417. data/public/d3/src/time/day.js +7 -0
  418. data/public/d3/src/time/days.js +11 -0
  419. data/public/d3/src/time/format-iso.js +1 -0
  420. data/public/d3/src/time/format-utc.js +48 -0
  421. data/public/d3/src/time/format.js +315 -0
  422. data/public/d3/src/time/hour.js +8 -0
  423. data/public/d3/src/time/hours.js +11 -0
  424. data/public/d3/src/time/minute.js +5 -0
  425. data/public/d3/src/time/minutes.js +11 -0
  426. data/public/d3/src/time/month.js +7 -0
  427. data/public/d3/src/time/months.js +11 -0
  428. data/public/d3/src/time/range.js +16 -0
  429. data/public/d3/src/time/scale-utc.js +36 -0
  430. data/public/d3/src/time/scale.js +123 -0
  431. data/public/d3/src/time/second.js +5 -0
  432. data/public/d3/src/time/seconds.js +7 -0
  433. data/public/d3/src/time/time.js +3 -0
  434. data/public/d3/src/time/week.js +9 -0
  435. data/public/d3/src/time/weeks.js +11 -0
  436. data/public/d3/src/time/year.js +7 -0
  437. data/public/d3/src/time/years.js +11 -0
  438. data/public/d3/test/core/ascending-test.js +47 -0
  439. data/public/d3/test/core/bisect-test.js +103 -0
  440. data/public/d3/test/core/descending-test.js +47 -0
  441. data/public/d3/test/core/dispatch-test.js +116 -0
  442. data/public/d3/test/core/ease-test.js +129 -0
  443. data/public/d3/test/core/entries-test.js +43 -0
  444. data/public/d3/test/core/first-test.js +42 -0
  445. data/public/d3/test/core/format-test.js +204 -0
  446. data/public/d3/test/core/functor-test.js +29 -0
  447. data/public/d3/test/core/hsl-test.js +87 -0
  448. data/public/d3/test/core/html-test.js +37 -0
  449. data/public/d3/test/core/interpolate-test.js +203 -0
  450. data/public/d3/test/core/json-test.js +37 -0
  451. data/public/d3/test/core/keys-test.js +31 -0
  452. data/public/d3/test/core/last-test.js +42 -0
  453. data/public/d3/test/core/max-test.js +50 -0
  454. data/public/d3/test/core/merge-test.js +27 -0
  455. data/public/d3/test/core/min-test.js +50 -0
  456. data/public/d3/test/core/nest-test.js +236 -0
  457. data/public/d3/test/core/ns-test.js +53 -0
  458. data/public/d3/test/core/permute-test.js +53 -0
  459. data/public/d3/test/core/quantile-test.js +50 -0
  460. data/public/d3/test/core/range-test.js +93 -0
  461. data/public/d3/test/core/rebind-test.js +38 -0
  462. data/public/d3/test/core/requote-test.js +53 -0
  463. data/public/d3/test/core/rgb-test.js +89 -0
  464. data/public/d3/test/core/round-test.js +70 -0
  465. data/public/d3/test/core/select-test.js +42 -0
  466. data/public/d3/test/core/selectAll-test.js +42 -0
  467. data/public/d3/test/core/selection-append-test.js +119 -0
  468. data/public/d3/test/core/selection-attr-test.js +153 -0
  469. data/public/d3/test/core/selection-call-test.js +71 -0
  470. data/public/d3/test/core/selection-classed-test.js +200 -0
  471. data/public/d3/test/core/selection-data-test.js +165 -0
  472. data/public/d3/test/core/selection-each-test.js +83 -0
  473. data/public/d3/test/core/selection-empty-test.js +51 -0
  474. data/public/d3/test/core/selection-filter-test.js +63 -0
  475. data/public/d3/test/core/selection-html-test.js +121 -0
  476. data/public/d3/test/core/selection-insert-test.js +132 -0
  477. data/public/d3/test/core/selection-map-test.js +47 -0
  478. data/public/d3/test/core/selection-node-test.js +50 -0
  479. data/public/d3/test/core/selection-on-test.js +95 -0
  480. data/public/d3/test/core/selection-property-test.js +91 -0
  481. data/public/d3/test/core/selection-remove-test.js +39 -0
  482. data/public/d3/test/core/selection-select-test.js +125 -0
  483. data/public/d3/test/core/selection-selectAll-test.js +127 -0
  484. data/public/d3/test/core/selection-sort-test.js +59 -0
  485. data/public/d3/test/core/selection-style-test.js +100 -0
  486. data/public/d3/test/core/selection-test.js +35 -0
  487. data/public/d3/test/core/selection-text-test.js +109 -0
  488. data/public/d3/test/core/split-test.js +34 -0
  489. data/public/d3/test/core/sum-test.js +47 -0
  490. data/public/d3/test/core/text-test.js +48 -0
  491. data/public/d3/test/core/timer-test.js +62 -0
  492. data/public/d3/test/core/transition-test-attr.js +33 -0
  493. data/public/d3/test/core/transition-test-attrTween.js +67 -0
  494. data/public/d3/test/core/transition-test-call.js +33 -0
  495. data/public/d3/test/core/transition-test-delay.js +41 -0
  496. data/public/d3/test/core/transition-test-duration.js +41 -0
  497. data/public/d3/test/core/transition-test-each.js +166 -0
  498. data/public/d3/test/core/transition-test-id.js +20 -0
  499. data/public/d3/test/core/transition-test-remove.js +46 -0
  500. data/public/d3/test/core/transition-test-select.js +63 -0
  501. data/public/d3/test/core/transition-test-selectAll.js +55 -0
  502. data/public/d3/test/core/transition-test-style.js +38 -0
  503. data/public/d3/test/core/transition-test-styleTween.js +73 -0
  504. data/public/d3/test/core/transition-test-text.js +30 -0
  505. data/public/d3/test/core/transition-test-transition.js +60 -0
  506. data/public/d3/test/core/transition-test-tween.js +71 -0
  507. data/public/d3/test/core/transition-test.js +65 -0
  508. data/public/d3/test/core/values-test.js +35 -0
  509. data/public/d3/test/core/version-test.js +18 -0
  510. data/public/d3/test/core/xhr-test.js +56 -0
  511. data/public/d3/test/core/xml-test.js +48 -0
  512. data/public/d3/test/core/zip-test.js +32 -0
  513. data/public/d3/test/csv/csv-test.js +38 -0
  514. data/public/d3/test/csv/format-test.js +39 -0
  515. data/public/d3/test/csv/parse-test.js +101 -0
  516. data/public/d3/test/env-assert.js +96 -0
  517. data/public/d3/test/env-fragment.js +8 -0
  518. data/public/d3/test/env-xhr.js +56 -0
  519. data/public/d3/test/env.js +13 -0
  520. data/public/d3/test/geo/albers-test.js +57 -0
  521. data/public/d3/test/geo/azimuthal-test.js +89 -0
  522. data/public/d3/test/geo/greatCircle-test.js +42 -0
  523. data/public/d3/test/geo/mercator-test.js +57 -0
  524. data/public/d3/test/layout/histogram-test.js +91 -0
  525. data/public/d3/test/layout/partition-test.js +39 -0
  526. data/public/d3/test/layout/tree-test.js +21 -0
  527. data/public/d3/test/layout/treemap-test.js +180 -0
  528. data/public/d3/test/scale/category-test.js +74 -0
  529. data/public/d3/test/scale/linear-test.js +239 -0
  530. data/public/d3/test/scale/log-test.js +220 -0
  531. data/public/d3/test/scale/ordinal-test.js +193 -0
  532. data/public/d3/test/scale/pow-test.js +259 -0
  533. data/public/d3/test/scale/quantile-test.js +64 -0
  534. data/public/d3/test/scale/quantize-test.js +69 -0
  535. data/public/d3/test/scale/sqrt-test.js +256 -0
  536. data/public/d3/test/svg/arc-test.js +147 -0
  537. data/public/d3/test/svg/area-radial-test.js +200 -0
  538. data/public/d3/test/svg/area-test.js +191 -0
  539. data/public/d3/test/svg/axis-test.js +347 -0
  540. data/public/d3/test/svg/line-radial-test.js +125 -0
  541. data/public/d3/test/svg/line-test.js +189 -0
  542. data/public/d3/test/svg/symbol-test.js +96 -0
  543. data/public/d3/test/time/day-test.js +65 -0
  544. data/public/d3/test/time/days-test.js +105 -0
  545. data/public/d3/test/time/format-test.js +430 -0
  546. data/public/d3/test/time/hour-test.js +103 -0
  547. data/public/d3/test/time/hours-test.js +135 -0
  548. data/public/d3/test/time/minute-test.js +43 -0
  549. data/public/d3/test/time/minutes-test.js +101 -0
  550. data/public/d3/test/time/month-test.js +53 -0
  551. data/public/d3/test/time/months-test.js +105 -0
  552. data/public/d3/test/time/scale-test.js +525 -0
  553. data/public/d3/test/time/second-test.js +41 -0
  554. data/public/d3/test/time/seconds-test.js +101 -0
  555. data/public/d3/test/time/week-test.js +59 -0
  556. data/public/d3/test/time/weeks-test.js +105 -0
  557. data/public/d3/test/time/year-test.js +41 -0
  558. data/public/d3/test/time/years-test.js +73 -0
  559. data/public/graph.js +42 -0
  560. data/public/jquery.min.js +4 -0
  561. data/public/test.html +36 -0
  562. data/public/testdata/bigfucker.js +212 -0
  563. data/public/testdata/names_and_enabled.js +232 -0
  564. data/public/testdata/one.js +79 -0
  565. data/public/testdata/withnames.js +198 -0
  566. data/public/viz.js +289 -0
  567. data/views/graph.erb +15 -0
  568. data/views/one.erb +34 -0
  569. data/views/two.erb +44 -0
  570. data/views/vis.erb +47 -0
  571. metadata +594 -18
  572. data/lib/bum.rb +0 -385
  573. data/lib/client.rb.erb +0 -7
  574. data/lib/dhcpd.rb +0 -84
  575. data/lib/hosts.rb +0 -61
  576. data/lib/vmx.rb +0 -24
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Distributed Network Visualization
3
+ * "Light" Styles
4
+ * By Ryan Sandor Richards (ryan@fastly.com)
5
+ */
6
+
7
+ body {
8
+ background: #ddd;
9
+ text-align: center;
10
+ font-family: helvetica;
11
+ }
12
+
13
+ a {
14
+ color: #be1919;
15
+ text-decoration: none;
16
+ }
17
+
18
+ a:hover {
19
+ text-decoration: underline;
20
+ }
21
+
22
+
23
+ #network {
24
+ border-radius: 10px;
25
+ padding: 10px;
26
+ background: #f5f5f5;
27
+ margin: 10px auto;
28
+ border: 1px solid rgba(0, 0, 0, 0.15);
29
+ box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.25);
30
+ }
31
+
32
+ /*
33
+ * Node Styles
34
+ */
35
+ circle.node {
36
+ stroke-width: 2;
37
+ stroke: #f5f5f5;
38
+ fill: #aaa;
39
+ cursor: pointer;
40
+ }
41
+
42
+ circle.db {
43
+ fill: #1f77b4;
44
+ }
45
+
46
+ circle.stats {
47
+ fill: #ff7f0e;
48
+ }
49
+
50
+ circle.rails {
51
+ fill: #d62728;
52
+ }
53
+
54
+ circle.proxy {
55
+ fill: #8c564b;
56
+ }
57
+
58
+ circle.disabled {
59
+ opacity: 0.5;
60
+ }
61
+
62
+ /*
63
+ * Link Styles
64
+ */
65
+ line.link {
66
+ stroke-width: 2;
67
+ }
68
+
69
+ line.link:hover {
70
+ stroke: lime;
71
+ stroke-width: 5;
72
+ }
73
+
74
+ line.active {
75
+ stroke: #ddd;
76
+ stroke-width: 3;
77
+ }
78
+
79
+ line.broken {
80
+ stroke: red;
81
+ stroke-dasharray: 2, 2;
82
+ }
83
+
84
+ line.disabled {
85
+ stroke: #b0b0b0;
86
+ stroke-dasharray: 4,2;
87
+ }
88
+
89
+ /*
90
+ * Text Styles
91
+ */
92
+ text {
93
+ cursor: pointer;
94
+ }
95
+
96
+ text.name {
97
+ font-size: 15pt;
98
+ text-shadow: 0px 0px 12px rgba(255, 255, 255, 0.8);
99
+ }
100
+
101
+ text.role {
102
+ fill: #eee;
103
+ font-size: 16pt;
104
+ /*text-shadow: 0px 0px 12px rgba(255, 255, 255, 0.8);*/
105
+ }
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2010, Michael Bostock
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ * The name Michael Bostock may not be used to endorse or promote products
15
+ derived from this software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
21
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,247 @@
1
+ # See the README for installation instructions.
2
+
3
+ JS_COMPILER = ./node_modules/uglify-js/bin/uglifyjs
4
+ JS_TESTER = ./node_modules/vows/bin/vows
5
+
6
+ all: \
7
+ d3.js \
8
+ d3.min.js \
9
+ d3.chart.js \
10
+ d3.chart.min.js \
11
+ d3.layout.js \
12
+ d3.layout.min.js \
13
+ d3.csv.js \
14
+ d3.csv.min.js \
15
+ d3.geo.js \
16
+ d3.geo.min.js \
17
+ d3.geom.js \
18
+ d3.geom.min.js \
19
+ d3.time.js \
20
+ d3.time.min.js
21
+
22
+ # Modify this rule to build your own custom release.
23
+ # Run `make d3.custom.min.js` to produce the minified version.
24
+
25
+ d3.custom.js: \
26
+ d3.js \
27
+ d3.geom.js \
28
+ d3.layout.js
29
+
30
+ .INTERMEDIATE d3.js: \
31
+ src/start.js \
32
+ d3.core.js \
33
+ d3.scale.js \
34
+ d3.svg.js \
35
+ d3.behavior.js \
36
+ src/end.js
37
+
38
+ d3.core.js: \
39
+ src/compat/date.js \
40
+ src/compat/style.js \
41
+ src/core/core.js \
42
+ src/core/array.js \
43
+ src/core/this.js \
44
+ src/core/functor.js \
45
+ src/core/rebind.js \
46
+ src/core/ascending.js \
47
+ src/core/descending.js \
48
+ src/core/min.js \
49
+ src/core/max.js \
50
+ src/core/sum.js \
51
+ src/core/quantile.js \
52
+ src/core/zip.js \
53
+ src/core/bisect.js \
54
+ src/core/first.js \
55
+ src/core/last.js \
56
+ src/core/nest.js \
57
+ src/core/keys.js \
58
+ src/core/values.js \
59
+ src/core/entries.js \
60
+ src/core/permute.js \
61
+ src/core/merge.js \
62
+ src/core/split.js \
63
+ src/core/collapse.js \
64
+ src/core/range.js \
65
+ src/core/requote.js \
66
+ src/core/round.js \
67
+ src/core/xhr.js \
68
+ src/core/text.js \
69
+ src/core/json.js \
70
+ src/core/html.js \
71
+ src/core/xml.js \
72
+ src/core/ns.js \
73
+ src/core/dispatch.js \
74
+ src/core/format.js \
75
+ src/core/ease.js \
76
+ src/core/event.js \
77
+ src/core/interpolate.js \
78
+ src/core/uninterpolate.js \
79
+ src/core/rgb.js \
80
+ src/core/hsl.js \
81
+ src/core/selection.js \
82
+ src/core/selection-select.js \
83
+ src/core/selection-selectAll.js \
84
+ src/core/selection-attr.js \
85
+ src/core/selection-classed.js \
86
+ src/core/selection-style.js \
87
+ src/core/selection-property.js \
88
+ src/core/selection-text.js \
89
+ src/core/selection-html.js \
90
+ src/core/selection-append.js \
91
+ src/core/selection-insert.js \
92
+ src/core/selection-remove.js \
93
+ src/core/selection-data.js \
94
+ src/core/selection-enter.js \
95
+ src/core/selection-enter-select.js \
96
+ src/core/selection-filter.js \
97
+ src/core/selection-map.js \
98
+ src/core/selection-sort.js \
99
+ src/core/selection-on.js \
100
+ src/core/selection-each.js \
101
+ src/core/selection-call.js \
102
+ src/core/selection-empty.js \
103
+ src/core/selection-node.js \
104
+ src/core/selection-transition.js \
105
+ src/core/selection-root.js \
106
+ src/core/transition.js \
107
+ src/core/transition-select.js \
108
+ src/core/transition-selectAll.js \
109
+ src/core/transition-attr.js \
110
+ src/core/transition-style.js \
111
+ src/core/transition-text.js \
112
+ src/core/transition-remove.js \
113
+ src/core/transition-delay.js \
114
+ src/core/transition-duration.js \
115
+ src/core/transition-each.js \
116
+ src/core/transition-transition.js \
117
+ src/core/timer.js \
118
+ src/core/noop.js
119
+
120
+ d3.scale.js: \
121
+ src/scale/scale.js \
122
+ src/scale/nice.js \
123
+ src/scale/linear.js \
124
+ src/scale/bilinear.js \
125
+ src/scale/polylinear.js \
126
+ src/scale/log.js \
127
+ src/scale/pow.js \
128
+ src/scale/sqrt.js \
129
+ src/scale/ordinal.js \
130
+ src/scale/category.js \
131
+ src/scale/quantile.js \
132
+ src/scale/quantize.js
133
+
134
+ d3.svg.js: \
135
+ src/svg/svg.js \
136
+ src/svg/arc.js \
137
+ src/svg/line.js \
138
+ src/svg/line-radial.js \
139
+ src/svg/area.js \
140
+ src/svg/area-radial.js \
141
+ src/svg/chord.js \
142
+ src/svg/diagonal.js \
143
+ src/svg/diagonal-radial.js \
144
+ src/svg/mouse.js \
145
+ src/svg/touches.js \
146
+ src/svg/symbol.js \
147
+ src/svg/axis.js
148
+
149
+ d3.behavior.js: \
150
+ src/behavior/behavior.js \
151
+ src/behavior/drag.js \
152
+ src/behavior/zoom.js
153
+
154
+ d3.chart.js: \
155
+ src/start.js \
156
+ src/chart/chart.js \
157
+ src/chart/box.js \
158
+ src/chart/bullet.js \
159
+ src/chart/horizon.js \
160
+ src/chart/qq.js \
161
+ src/end.js
162
+
163
+ d3.layout.js: \
164
+ src/start.js \
165
+ src/layout/layout.js \
166
+ src/layout/bundle.js \
167
+ src/layout/chord.js \
168
+ src/layout/force.js \
169
+ src/layout/partition.js \
170
+ src/layout/pie.js \
171
+ src/layout/stack.js \
172
+ src/layout/histogram.js \
173
+ src/layout/hierarchy.js \
174
+ src/layout/pack.js \
175
+ src/layout/cluster.js \
176
+ src/layout/tree.js \
177
+ src/layout/treemap.js \
178
+ src/end.js
179
+
180
+ d3.geo.js: \
181
+ src/start.js \
182
+ src/geo/geo.js \
183
+ src/geo/azimuthal.js \
184
+ src/geo/albers.js \
185
+ src/geo/mercator.js \
186
+ src/geo/path.js \
187
+ src/geo/bounds.js \
188
+ src/geo/greatCircle.js \
189
+ src/end.js
190
+
191
+ d3.csv.js: \
192
+ src/start.js \
193
+ src/csv/csv.js \
194
+ src/csv/parse.js \
195
+ src/csv/format.js \
196
+ src/end.js
197
+
198
+ d3.time.js: \
199
+ src/start.js \
200
+ src/time/time.js \
201
+ src/time/format.js \
202
+ src/time/format-utc.js \
203
+ src/time/format-iso.js \
204
+ src/time/range.js \
205
+ src/time/second.js \
206
+ src/time/seconds.js \
207
+ src/time/minute.js \
208
+ src/time/minutes.js \
209
+ src/time/hour.js \
210
+ src/time/hours.js \
211
+ src/time/day.js \
212
+ src/time/days.js \
213
+ src/time/week.js \
214
+ src/time/weeks.js \
215
+ src/time/month.js \
216
+ src/time/months.js \
217
+ src/time/year.js \
218
+ src/time/years.js \
219
+ src/time/scale.js \
220
+ src/time/scale-utc.js \
221
+ src/end.js
222
+
223
+ d3.geom.js: \
224
+ src/start.js \
225
+ src/geom/geom.js \
226
+ src/geom/contour.js \
227
+ src/geom/hull.js \
228
+ src/geom/polygon.js \
229
+ src/geom/voronoi.js \
230
+ src/geom/delaunay.js \
231
+ src/geom/quadtree.js \
232
+ src/end.js
233
+
234
+ test: all
235
+ @$(JS_TESTER)
236
+
237
+ %.min.js: %.js Makefile
238
+ @rm -f $@
239
+ $(JS_COMPILER) < $< > $@
240
+
241
+ d3.js d3%.js: Makefile
242
+ @rm -f $@
243
+ cat $(filter %.js,$^) > $@
244
+ @chmod a-w $@
245
+
246
+ clean:
247
+ rm -f d3*.js
@@ -0,0 +1,51 @@
1
+ # D3
2
+
3
+ **D3** is a small, free JavaScript library for manipulating HTML documents
4
+ based on data. D3 can help you quickly visualize your data as HTML or SVG,
5
+ handle interactivity, and incorporate smooth transitions and staged animations
6
+ into your pages. You can use D3 as a visualization framework (like Protovis),
7
+ or you can use it to build dynamic pages (like jQuery).
8
+
9
+ ### Browser Support
10
+
11
+ D3 should work on any browser, with minimal requirements such as JavaScript
12
+ and the [W3C DOM](http://www.w3.org/DOM/) API. By default D3 requires the
13
+ [Selectors API](http://www.w3.org/TR/selectors-api/) Level 1, but you can
14
+ preload [Sizzle](http://sizzlejs.com/) for compatibility with older browsers.
15
+ Some of the included D3 examples use additional browser features, such as
16
+ [SVG](http://www.w3.org/TR/SVG/) and [CSS3
17
+ Transitions](http://www.w3.org/TR/css3-transitions/). These features are not
18
+ required to use D3, but are useful for visualization! D3 is not a
19
+ compatibility layer. The examples should work on Firefox, Chrome (Chromium),
20
+ Safari (WebKit), Opera and IE9.
21
+
22
+ Note: Chrome has strict permissions for reading files out of the local file
23
+ system. Some examples use AJAX which works differently via HTTP instead of local
24
+ files. For the best experience, load the D3 examples from your own machine via
25
+ HTTP. Any static file web server will work; for example you can run Python's
26
+ built-in server:
27
+
28
+ python -m SimpleHTTPServer 8888
29
+
30
+ Once this is running, go to: <http://localhost:8888/examples/>
31
+
32
+ ### Development Setup
33
+
34
+ This repository should work out of the box if you just want to create new
35
+ visualizations using D3. On the other hand, if you want to extend D3 with new
36
+ features, fix bugs, or run tests, you'll need to install a few more things.
37
+
38
+ D3's test framework uses [Vows](http://vowsjs.org), which depends on
39
+ [Node.js](http://nodejs.org/) and [NPM](http://npmjs.org/). If you are
40
+ developing on Mac OS X, an easy way to install Node and NPM is using
41
+ [Homebrew](http://mxcl.github.com/homebrew/):
42
+
43
+ brew install node
44
+ brew install npm
45
+
46
+ Next, from the root directory of this repository, install D3's dependencies:
47
+
48
+ npm install
49
+
50
+ You can see the list of dependencies in package.json. The packages will be
51
+ installed in the node_modules directory.
@@ -0,0 +1,984 @@
1
+ (function(){d3.chart = {};
2
+ // Inspired by http://informationandvisualization.de/blog/box-plot
3
+ d3.chart.box = function() {
4
+ var width = 1,
5
+ height = 1,
6
+ duration = 0,
7
+ domain = null,
8
+ value = Number,
9
+ whiskers = d3_chart_boxWhiskers,
10
+ quartiles = d3_chart_boxQuartiles,
11
+ tickFormat = null;
12
+
13
+ // For each small multiple…
14
+ function box(g) {
15
+ g.each(function(d, i) {
16
+ d = d.map(value).sort(d3.ascending);
17
+ var g = d3.select(this),
18
+ n = d.length,
19
+ min = d[0],
20
+ max = d[n - 1];
21
+
22
+ // Compute quartiles. Must return exactly 3 elements.
23
+ var quartileData = d.quartiles = quartiles(d);
24
+
25
+ // Compute whiskers. Must return exactly 2 elements, or null.
26
+ var whiskerIndices = whiskers && whiskers.call(this, d, i),
27
+ whiskerData = whiskerIndices && whiskerIndices.map(function(i) { return d[i]; });
28
+
29
+ // Compute outliers. If no whiskers are specified, all data are "outliers".
30
+ // We compute the outliers as indices, so that we can join across transitions!
31
+ var outlierIndices = whiskerIndices
32
+ ? d3.range(0, whiskerIndices[0]).concat(d3.range(whiskerIndices[1] + 1, n))
33
+ : d3.range(n);
34
+
35
+ // Compute the new x-scale.
36
+ var x1 = d3.scale.linear()
37
+ .domain(domain && domain.call(this, d, i) || [min, max])
38
+ .range([height, 0]);
39
+
40
+ // Retrieve the old x-scale, if this is an update.
41
+ var x0 = this.__chart__ || d3.scale.linear()
42
+ .domain([0, Infinity])
43
+ .range(x1.range());
44
+
45
+ // Stash the new scale.
46
+ this.__chart__ = x1;
47
+
48
+ // Note: the box, median, and box tick elements are fixed in number,
49
+ // so we only have to handle enter and update. In contrast, the outliers
50
+ // and other elements are variable, so we need to exit them! Variable
51
+ // elements also fade in and out.
52
+
53
+ // Update center line: the vertical line spanning the whiskers.
54
+ var center = g.selectAll("line.center")
55
+ .data(whiskerData ? [whiskerData] : []);
56
+
57
+ center.enter().insert("svg:line", "rect")
58
+ .attr("class", "center")
59
+ .attr("x1", width / 2)
60
+ .attr("y1", function(d) { return x0(d[0]); })
61
+ .attr("x2", width / 2)
62
+ .attr("y2", function(d) { return x0(d[1]); })
63
+ .style("opacity", 1e-6)
64
+ .transition()
65
+ .duration(duration)
66
+ .style("opacity", 1)
67
+ .attr("y1", function(d) { return x1(d[0]); })
68
+ .attr("y2", function(d) { return x1(d[1]); });
69
+
70
+ center.transition()
71
+ .duration(duration)
72
+ .style("opacity", 1)
73
+ .attr("y1", function(d) { return x1(d[0]); })
74
+ .attr("y2", function(d) { return x1(d[1]); });
75
+
76
+ center.exit().transition()
77
+ .duration(duration)
78
+ .style("opacity", 1e-6)
79
+ .attr("y1", function(d) { return x1(d[0]); })
80
+ .attr("y2", function(d) { return x1(d[1]); })
81
+ .remove();
82
+
83
+ // Update innerquartile box.
84
+ var box = g.selectAll("rect.box")
85
+ .data([quartileData]);
86
+
87
+ box.enter().append("svg:rect")
88
+ .attr("class", "box")
89
+ .attr("x", 0)
90
+ .attr("y", function(d) { return x0(d[2]); })
91
+ .attr("width", width)
92
+ .attr("height", function(d) { return x0(d[0]) - x0(d[2]); })
93
+ .transition()
94
+ .duration(duration)
95
+ .attr("y", function(d) { return x1(d[2]); })
96
+ .attr("height", function(d) { return x1(d[0]) - x1(d[2]); });
97
+
98
+ box.transition()
99
+ .duration(duration)
100
+ .attr("y", function(d) { return x1(d[2]); })
101
+ .attr("height", function(d) { return x1(d[0]) - x1(d[2]); });
102
+
103
+ // Update median line.
104
+ var medianLine = g.selectAll("line.median")
105
+ .data([quartileData[1]]);
106
+
107
+ medianLine.enter().append("svg:line")
108
+ .attr("class", "median")
109
+ .attr("x1", 0)
110
+ .attr("y1", x0)
111
+ .attr("x2", width)
112
+ .attr("y2", x0)
113
+ .transition()
114
+ .duration(duration)
115
+ .attr("y1", x1)
116
+ .attr("y2", x1);
117
+
118
+ medianLine.transition()
119
+ .duration(duration)
120
+ .attr("y1", x1)
121
+ .attr("y2", x1);
122
+
123
+ // Update whiskers.
124
+ var whisker = g.selectAll("line.whisker")
125
+ .data(whiskerData || []);
126
+
127
+ whisker.enter().insert("svg:line", "circle, text")
128
+ .attr("class", "whisker")
129
+ .attr("x1", 0)
130
+ .attr("y1", x0)
131
+ .attr("x2", width)
132
+ .attr("y2", x0)
133
+ .style("opacity", 1e-6)
134
+ .transition()
135
+ .duration(duration)
136
+ .attr("y1", x1)
137
+ .attr("y2", x1)
138
+ .style("opacity", 1);
139
+
140
+ whisker.transition()
141
+ .duration(duration)
142
+ .attr("y1", x1)
143
+ .attr("y2", x1)
144
+ .style("opacity", 1);
145
+
146
+ whisker.exit().transition()
147
+ .duration(duration)
148
+ .attr("y1", x1)
149
+ .attr("y2", x1)
150
+ .style("opacity", 1e-6)
151
+ .remove();
152
+
153
+ // Update outliers.
154
+ var outlier = g.selectAll("circle.outlier")
155
+ .data(outlierIndices, Number);
156
+
157
+ outlier.enter().insert("svg:circle", "text")
158
+ .attr("class", "outlier")
159
+ .attr("r", 5)
160
+ .attr("cx", width / 2)
161
+ .attr("cy", function(i) { return x0(d[i]); })
162
+ .style("opacity", 1e-6)
163
+ .transition()
164
+ .duration(duration)
165
+ .attr("cy", function(i) { return x1(d[i]); })
166
+ .style("opacity", 1);
167
+
168
+ outlier.transition()
169
+ .duration(duration)
170
+ .attr("cy", function(i) { return x1(d[i]); })
171
+ .style("opacity", 1);
172
+
173
+ outlier.exit().transition()
174
+ .duration(duration)
175
+ .attr("cy", function(i) { return x1(d[i]); })
176
+ .style("opacity", 1e-6)
177
+ .remove();
178
+
179
+ // Compute the tick format.
180
+ var format = tickFormat || x1.tickFormat(8);
181
+
182
+ // Update box ticks.
183
+ var boxTick = g.selectAll("text.box")
184
+ .data(quartileData);
185
+
186
+ boxTick.enter().append("svg:text")
187
+ .attr("class", "box")
188
+ .attr("dy", ".3em")
189
+ .attr("dx", function(d, i) { return i & 1 ? 6 : -6 })
190
+ .attr("x", function(d, i) { return i & 1 ? width : 0 })
191
+ .attr("y", x0)
192
+ .attr("text-anchor", function(d, i) { return i & 1 ? "start" : "end"; })
193
+ .text(format)
194
+ .transition()
195
+ .duration(duration)
196
+ .attr("y", x1);
197
+
198
+ boxTick.transition()
199
+ .duration(duration)
200
+ .text(format)
201
+ .attr("y", x1);
202
+
203
+ // Update whisker ticks. These are handled separately from the box
204
+ // ticks because they may or may not exist, and we want don't want
205
+ // to join box ticks pre-transition with whisker ticks post-.
206
+ var whiskerTick = g.selectAll("text.whisker")
207
+ .data(whiskerData || []);
208
+
209
+ whiskerTick.enter().append("svg:text")
210
+ .attr("class", "whisker")
211
+ .attr("dy", ".3em")
212
+ .attr("dx", 6)
213
+ .attr("x", width)
214
+ .attr("y", x0)
215
+ .text(format)
216
+ .style("opacity", 1e-6)
217
+ .transition()
218
+ .duration(duration)
219
+ .attr("y", x1)
220
+ .style("opacity", 1);
221
+
222
+ whiskerTick.transition()
223
+ .duration(duration)
224
+ .text(format)
225
+ .attr("y", x1)
226
+ .style("opacity", 1);
227
+
228
+ whiskerTick.exit().transition()
229
+ .duration(duration)
230
+ .attr("y", x1)
231
+ .style("opacity", 1e-6)
232
+ .remove();
233
+ });
234
+ d3.timer.flush();
235
+ }
236
+
237
+ box.width = function(x) {
238
+ if (!arguments.length) return width;
239
+ width = x;
240
+ return box;
241
+ };
242
+
243
+ box.height = function(x) {
244
+ if (!arguments.length) return height;
245
+ height = x;
246
+ return box;
247
+ };
248
+
249
+ box.tickFormat = function(x) {
250
+ if (!arguments.length) return tickFormat;
251
+ tickFormat = x;
252
+ return box;
253
+ };
254
+
255
+ box.duration = function(x) {
256
+ if (!arguments.length) return duration;
257
+ duration = x;
258
+ return box;
259
+ };
260
+
261
+ box.domain = function(x) {
262
+ if (!arguments.length) return domain;
263
+ domain = x == null ? x : d3.functor(x);
264
+ return box;
265
+ };
266
+
267
+ box.value = function(x) {
268
+ if (!arguments.length) return value;
269
+ value = x;
270
+ return box;
271
+ };
272
+
273
+ box.whiskers = function(x) {
274
+ if (!arguments.length) return whiskers;
275
+ whiskers = x;
276
+ return box;
277
+ };
278
+
279
+ box.quartiles = function(x) {
280
+ if (!arguments.length) return quartiles;
281
+ quartiles = x;
282
+ return box;
283
+ };
284
+
285
+ return box;
286
+ };
287
+
288
+ function d3_chart_boxWhiskers(d) {
289
+ return [0, d.length - 1];
290
+ }
291
+
292
+ function d3_chart_boxQuartiles(d) {
293
+ return [
294
+ d3.quantile(d, .25),
295
+ d3.quantile(d, .5),
296
+ d3.quantile(d, .75)
297
+ ];
298
+ }
299
+ // Chart design based on the recommendations of Stephen Few. Implementation
300
+ // based on the work of Clint Ivy, Jamie Love, and Jason Davies.
301
+ // http://projects.instantcognition.com/protovis/bulletchart/
302
+ d3.chart.bullet = function() {
303
+ var orient = "left", // TODO top & bottom
304
+ reverse = false,
305
+ duration = 0,
306
+ ranges = d3_chart_bulletRanges,
307
+ markers = d3_chart_bulletMarkers,
308
+ measures = d3_chart_bulletMeasures,
309
+ width = 380,
310
+ height = 30,
311
+ tickFormat = null;
312
+
313
+ // For each small multiple…
314
+ function bullet(g) {
315
+ g.each(function(d, i) {
316
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
317
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
318
+ measurez = measures.call(this, d, i).slice().sort(d3.descending),
319
+ g = d3.select(this);
320
+
321
+ // Compute the new x-scale.
322
+ var x1 = d3.scale.linear()
323
+ .domain([0, Math.max(rangez[0], markerz[0], measurez[0])])
324
+ .range(reverse ? [width, 0] : [0, width]);
325
+
326
+ // Retrieve the old x-scale, if this is an update.
327
+ var x0 = this.__chart__ || d3.scale.linear()
328
+ .domain([0, Infinity])
329
+ .range(x1.range());
330
+
331
+ // Stash the new scale.
332
+ this.__chart__ = x1;
333
+
334
+ // Derive width-scales from the x-scales.
335
+ var w0 = d3_chart_bulletWidth(x0),
336
+ w1 = d3_chart_bulletWidth(x1);
337
+
338
+ // Update the range rects.
339
+ var range = g.selectAll("rect.range")
340
+ .data(rangez);
341
+
342
+ range.enter().append("svg:rect")
343
+ .attr("class", function(d, i) { return "range s" + i; })
344
+ .attr("width", w0)
345
+ .attr("height", height)
346
+ .attr("x", reverse ? x0 : 0)
347
+ .transition()
348
+ .duration(duration)
349
+ .attr("width", w1)
350
+ .attr("x", reverse ? x1 : 0);
351
+
352
+ range.transition()
353
+ .duration(duration)
354
+ .attr("x", reverse ? x1 : 0)
355
+ .attr("width", w1)
356
+ .attr("height", height);
357
+
358
+ // Update the measure rects.
359
+ var measure = g.selectAll("rect.measure")
360
+ .data(measurez);
361
+
362
+ measure.enter().append("svg:rect")
363
+ .attr("class", function(d, i) { return "measure s" + i; })
364
+ .attr("width", w0)
365
+ .attr("height", height / 3)
366
+ .attr("x", reverse ? x0 : 0)
367
+ .attr("y", height / 3)
368
+ .transition()
369
+ .duration(duration)
370
+ .attr("width", w1)
371
+ .attr("x", reverse ? x1 : 0);
372
+
373
+ measure.transition()
374
+ .duration(duration)
375
+ .attr("width", w1)
376
+ .attr("height", height / 3)
377
+ .attr("x", reverse ? x1 : 0)
378
+ .attr("y", height / 3);
379
+
380
+ // Update the marker lines.
381
+ var marker = g.selectAll("line.marker")
382
+ .data(markerz);
383
+
384
+ marker.enter().append("svg:line")
385
+ .attr("class", "marker")
386
+ .attr("x1", x0)
387
+ .attr("x2", x0)
388
+ .attr("y1", height / 6)
389
+ .attr("y2", height * 5 / 6)
390
+ .transition()
391
+ .duration(duration)
392
+ .attr("x1", x1)
393
+ .attr("x2", x1);
394
+
395
+ marker.transition()
396
+ .duration(duration)
397
+ .attr("x1", x1)
398
+ .attr("x2", x1)
399
+ .attr("y1", height / 6)
400
+ .attr("y2", height * 5 / 6);
401
+
402
+ // Compute the tick format.
403
+ var format = tickFormat || x1.tickFormat(8);
404
+
405
+ // Update the tick groups.
406
+ var tick = g.selectAll("g.tick")
407
+ .data(x1.ticks(8), function(d) {
408
+ return this.textContent || format(d);
409
+ });
410
+
411
+ // Initialize the ticks with the old scale, x0.
412
+ var tickEnter = tick.enter().append("svg:g")
413
+ .attr("class", "tick")
414
+ .attr("transform", d3_chart_bulletTranslate(x0))
415
+ .style("opacity", 1e-6);
416
+
417
+ tickEnter.append("svg:line")
418
+ .attr("y1", height)
419
+ .attr("y2", height * 7 / 6);
420
+
421
+ tickEnter.append("svg:text")
422
+ .attr("text-anchor", "middle")
423
+ .attr("dy", "1em")
424
+ .attr("y", height * 7 / 6)
425
+ .text(format);
426
+
427
+ // Transition the entering ticks to the new scale, x1.
428
+ tickEnter.transition()
429
+ .duration(duration)
430
+ .attr("transform", d3_chart_bulletTranslate(x1))
431
+ .style("opacity", 1);
432
+
433
+ // Transition the updating ticks to the new scale, x1.
434
+ var tickUpdate = tick.transition()
435
+ .duration(duration)
436
+ .attr("transform", d3_chart_bulletTranslate(x1))
437
+ .style("opacity", 1);
438
+
439
+ tickUpdate.select("line")
440
+ .attr("y1", height)
441
+ .attr("y2", height * 7 / 6);
442
+
443
+ tickUpdate.select("text")
444
+ .attr("y", height * 7 / 6);
445
+
446
+ // Transition the exiting ticks to the new scale, x1.
447
+ tick.exit().transition()
448
+ .duration(duration)
449
+ .attr("transform", d3_chart_bulletTranslate(x1))
450
+ .style("opacity", 1e-6)
451
+ .remove();
452
+ });
453
+ d3.timer.flush();
454
+ }
455
+
456
+ // left, right, top, bottom
457
+ bullet.orient = function(x) {
458
+ if (!arguments.length) return orient;
459
+ orient = x;
460
+ reverse = orient == "right" || orient == "bottom";
461
+ return bullet;
462
+ };
463
+
464
+ // ranges (bad, satisfactory, good)
465
+ bullet.ranges = function(x) {
466
+ if (!arguments.length) return ranges;
467
+ ranges = x;
468
+ return bullet;
469
+ };
470
+
471
+ // markers (previous, goal)
472
+ bullet.markers = function(x) {
473
+ if (!arguments.length) return markers;
474
+ markers = x;
475
+ return bullet;
476
+ };
477
+
478
+ // measures (actual, forecast)
479
+ bullet.measures = function(x) {
480
+ if (!arguments.length) return measures;
481
+ measures = x;
482
+ return bullet;
483
+ };
484
+
485
+ bullet.width = function(x) {
486
+ if (!arguments.length) return width;
487
+ width = x;
488
+ return bullet;
489
+ };
490
+
491
+ bullet.height = function(x) {
492
+ if (!arguments.length) return height;
493
+ height = x;
494
+ return bullet;
495
+ };
496
+
497
+ bullet.tickFormat = function(x) {
498
+ if (!arguments.length) return tickFormat;
499
+ tickFormat = x;
500
+ return bullet;
501
+ };
502
+
503
+ bullet.duration = function(x) {
504
+ if (!arguments.length) return duration;
505
+ duration = x;
506
+ return bullet;
507
+ };
508
+
509
+ return bullet;
510
+ };
511
+
512
+ function d3_chart_bulletRanges(d) {
513
+ return d.ranges;
514
+ }
515
+
516
+ function d3_chart_bulletMarkers(d) {
517
+ return d.markers;
518
+ }
519
+
520
+ function d3_chart_bulletMeasures(d) {
521
+ return d.measures;
522
+ }
523
+
524
+ function d3_chart_bulletTranslate(x) {
525
+ return function(d) {
526
+ return "translate(" + x(d) + ",0)";
527
+ };
528
+ }
529
+
530
+ function d3_chart_bulletWidth(x) {
531
+ var x0 = x(0);
532
+ return function(d) {
533
+ return Math.abs(x(d) - x0);
534
+ };
535
+ }
536
+ // Implements a horizon layout, which is a variation of a single-series
537
+ // area chart where the area is folded into multiple bands. Color is used to
538
+ // encode band, allowing the size of the chart to be reduced significantly
539
+ // without impeding readability. This layout algorithm is based on the work of
540
+ // J. Heer, N. Kong and M. Agrawala in "Sizing the Horizon: The Effects of Chart
541
+ // Size and Layering on the Graphical Perception of Time Series Visualizations",
542
+ // CHI 2009. http://hci.stanford.edu/publications/2009/heer-horizon-chi09.pdf
543
+ d3.chart.horizon = function() {
544
+ var bands = 1, // between 1 and 5, typically
545
+ mode = "offset", // or mirror
546
+ interpolate = "linear", // or basis, monotone, step-before, etc.
547
+ x = d3_chart_horizonX,
548
+ y = d3_chart_horizonY,
549
+ w = 960,
550
+ h = 40,
551
+ duration = 0;
552
+
553
+ var color = d3.scale.linear()
554
+ .domain([-1, 0, 1])
555
+ .range(["#d62728", "#fff", "#1f77b4"]);
556
+
557
+ // For each small multiple…
558
+ function horizon(g) {
559
+ g.each(function(d, i) {
560
+ var g = d3.select(this),
561
+ n = 2 * bands + 1,
562
+ xMin = Infinity,
563
+ xMax = -Infinity,
564
+ yMax = -Infinity,
565
+ x0, // old x-scale
566
+ y0, // old y-scale
567
+ id; // unique id for paths
568
+
569
+ // Compute x- and y-values along with extents.
570
+ var data = d.map(function(d, i) {
571
+ var xv = x.call(this, d, i),
572
+ yv = y.call(this, d, i);
573
+ if (xv < xMin) xMin = xv;
574
+ if (xv > xMax) xMax = xv;
575
+ if (-yv > yMax) yMax = -yv;
576
+ if (yv > yMax) yMax = yv;
577
+ return [xv, yv];
578
+ });
579
+
580
+ // Compute the new x- and y-scales.
581
+ var x1 = d3.scale.linear().domain([xMin, xMax]).range([0, w]),
582
+ y1 = d3.scale.linear().domain([0, yMax]).range([0, h * bands]);
583
+
584
+ // Retrieve the old scales, if this is an update.
585
+ if (this.__chart__) {
586
+ x0 = this.__chart__.x;
587
+ y0 = this.__chart__.y;
588
+ id = this.__chart__.id;
589
+ } else {
590
+ x0 = d3.scale.linear().domain([0, Infinity]).range(x1.range());
591
+ y0 = d3.scale.linear().domain([0, Infinity]).range(y1.range());
592
+ id = ++d3_chart_horizonId;
593
+ }
594
+
595
+ // We'll use a defs to store the area path and the clip path.
596
+ var defs = g.selectAll("defs")
597
+ .data([data]);
598
+
599
+ var defsEnter = defs.enter().append("svg:defs");
600
+
601
+ // The clip path is a simple rect.
602
+ defsEnter.append("svg:clipPath")
603
+ .attr("id", "d3_chart_horizon_clip" + id)
604
+ .append("svg:rect")
605
+ .attr("width", w)
606
+ .attr("height", h);
607
+
608
+ defs.select("rect").transition()
609
+ .duration(duration)
610
+ .attr("width", w)
611
+ .attr("height", h);
612
+
613
+ // The area path is rendered with our resuable d3.svg.area.
614
+ defsEnter.append("svg:path")
615
+ .attr("id", "d3_chart_horizon_path" + id)
616
+ .attr("d", d3_chart_horizonArea
617
+ .interpolate(interpolate)
618
+ .x(function(d) { return x0(d[0]); })
619
+ .y0(h * bands)
620
+ .y1(function(d) { return h * bands - y0(d[1]); }))
621
+ .transition()
622
+ .duration(duration)
623
+ .attr("d", d3_chart_horizonArea
624
+ .x(function(d) { return x1(d[0]); })
625
+ .y1(function(d) { return h * bands - y1(d[1]); }));
626
+
627
+ defs.select("path").transition()
628
+ .duration(duration)
629
+ .attr("d", d3_chart_horizonArea);
630
+
631
+ // We'll use a container to clip all horizon layers at once.
632
+ g.selectAll("g")
633
+ .data([null])
634
+ .enter().append("svg:g")
635
+ .attr("clip-path", "url(#d3_chart_horizon_clip" + id + ")");
636
+
637
+ // Define the transform function based on the mode.
638
+ var transform = mode == "offset"
639
+ ? function(d) { return "translate(0," + (d + (d < 0) - bands) * h + ")"; }
640
+ : function(d) { return (d < 0 ? "scale(1,-1)" : "") + "translate(0," + (d - bands) * h + ")"; };
641
+
642
+ // Instantiate each copy of the path with different transforms.
643
+ var u = g.select("g").selectAll("use")
644
+ .data(d3.range(-1, -bands - 1, -1).concat(d3.range(1, bands + 1)), Number);
645
+
646
+ // TODO don't fudge the enter transition
647
+ u.enter().append("svg:use")
648
+ .attr("xlink:href", "#d3_chart_horizon_path" + id)
649
+ .attr("transform", function(d) { return transform(d + (d > 0 ? 1 : -1)); })
650
+ .style("fill", color)
651
+ .transition()
652
+ .duration(duration)
653
+ .attr("transform", transform);
654
+
655
+ u.transition()
656
+ .duration(duration)
657
+ .attr("transform", transform)
658
+ .style("fill", color);
659
+
660
+ u.exit().transition()
661
+ .duration(duration)
662
+ .attr("transform", transform)
663
+ .remove();
664
+
665
+ // Stash the new scales.
666
+ this.__chart__ = {x: x1, y: y1, id: id};
667
+ });
668
+ d3.timer.flush();
669
+ }
670
+
671
+ horizon.duration = function(x) {
672
+ if (!arguments.length) return duration;
673
+ duration = +x;
674
+ return horizon;
675
+ };
676
+
677
+ horizon.bands = function(x) {
678
+ if (!arguments.length) return bands;
679
+ bands = +x;
680
+ color.domain([-bands, 0, bands]);
681
+ return horizon;
682
+ };
683
+
684
+ horizon.mode = function(x) {
685
+ if (!arguments.length) return mode;
686
+ mode = x + "";
687
+ return horizon;
688
+ };
689
+
690
+ horizon.colors = function(x) {
691
+ if (!arguments.length) return color.range();
692
+ color.range(x);
693
+ return horizon;
694
+ };
695
+
696
+ horizon.interpolate = function(x) {
697
+ if (!arguments.length) return interpolate;
698
+ interpolate = x + "";
699
+ return horizon;
700
+ };
701
+
702
+ horizon.x = function(z) {
703
+ if (!arguments.length) return x;
704
+ x = z;
705
+ return horizon;
706
+ };
707
+
708
+ horizon.y = function(z) {
709
+ if (!arguments.length) return y;
710
+ y = z;
711
+ return horizon;
712
+ };
713
+
714
+ horizon.width = function(x) {
715
+ if (!arguments.length) return w;
716
+ w = +x;
717
+ return horizon;
718
+ };
719
+
720
+ horizon.height = function(x) {
721
+ if (!arguments.length) return h;
722
+ h = +x;
723
+ return horizon;
724
+ };
725
+
726
+ return horizon;
727
+ };
728
+
729
+ var d3_chart_horizonArea = d3.svg.area(),
730
+ d3_chart_horizonId = 0;
731
+
732
+ function d3_chart_horizonX(d) {
733
+ return d[0];
734
+ }
735
+
736
+ function d3_chart_horizonY(d) {
737
+ return d[1];
738
+ }
739
+ // Based on http://vis.stanford.edu/protovis/ex/qqplot.html
740
+ d3.chart.qq = function() {
741
+ var width = 1,
742
+ height = 1,
743
+ duration = 0,
744
+ domain = null,
745
+ tickFormat = null,
746
+ n = 100,
747
+ x = d3_chart_qqX,
748
+ y = d3_chart_qqY;
749
+
750
+ // For each small multiple…
751
+ function qq(g) {
752
+ g.each(function(d, i) {
753
+ var g = d3.select(this),
754
+ qx = d3_chart_qqQuantiles(n, x.call(this, d, i)),
755
+ qy = d3_chart_qqQuantiles(n, y.call(this, d, i)),
756
+ xd = domain && domain.call(this, d, i) || [d3.min(qx), d3.max(qx)], // new x-domain
757
+ yd = domain && domain.call(this, d, i) || [d3.min(qy), d3.max(qy)], // new y-domain
758
+ x0, // old x-scale
759
+ y0; // old y-scale
760
+
761
+ // Compute the new x-scale.
762
+ var x1 = d3.scale.linear()
763
+ .domain(xd)
764
+ .range([0, width]);
765
+
766
+ // Compute the new y-scale.
767
+ var y1 = d3.scale.linear()
768
+ .domain(yd)
769
+ .range([height, 0]);
770
+
771
+ // Retrieve the old scales, if this is an update.
772
+ if (this.__chart__) {
773
+ x0 = this.__chart__.x;
774
+ y0 = this.__chart__.y;
775
+ } else {
776
+ x0 = d3.scale.linear().domain([0, Infinity]).range(x1.range());
777
+ y0 = d3.scale.linear().domain([0, Infinity]).range(y1.range());
778
+ }
779
+
780
+ // Stash the new scales.
781
+ this.__chart__ = {x: x1, y: y1};
782
+
783
+ // Update diagonal line.
784
+ var diagonal = g.selectAll("line.diagonal")
785
+ .data([null]);
786
+
787
+ diagonal.enter().append("svg:line")
788
+ .attr("class", "diagonal")
789
+ .attr("x1", x1(yd[0]))
790
+ .attr("y1", y1(xd[0]))
791
+ .attr("x2", x1(yd[1]))
792
+ .attr("y2", y1(xd[1]));
793
+
794
+ diagonal.transition()
795
+ .duration(duration)
796
+ .attr("x1", x1(yd[0]))
797
+ .attr("y1", y1(xd[0]))
798
+ .attr("x2", x1(yd[1]))
799
+ .attr("y2", y1(xd[1]));
800
+
801
+ // Update quantile plots.
802
+ var circle = g.selectAll("circle")
803
+ .data(d3.range(n).map(function(i) {
804
+ return {x: qx[i], y: qy[i]};
805
+ }));
806
+
807
+ circle.enter().append("svg:circle")
808
+ .attr("class", "quantile")
809
+ .attr("r", 4.5)
810
+ .attr("cx", function(d) { return x0(d.x); })
811
+ .attr("cy", function(d) { return y0(d.y); })
812
+ .style("opacity", 1e-6)
813
+ .transition()
814
+ .duration(duration)
815
+ .attr("cx", function(d) { return x1(d.x); })
816
+ .attr("cy", function(d) { return y1(d.y); })
817
+ .style("opacity", 1);
818
+
819
+ circle.transition()
820
+ .duration(duration)
821
+ .attr("cx", function(d) { return x1(d.x); })
822
+ .attr("cy", function(d) { return y1(d.y); })
823
+ .style("opacity", 1);
824
+
825
+ circle.exit().transition()
826
+ .duration(duration)
827
+ .attr("cx", function(d) { return x1(d.x); })
828
+ .attr("cy", function(d) { return y1(d.y); })
829
+ .style("opacity", 1e-6)
830
+ .remove();
831
+
832
+ var xformat = tickFormat || x1.tickFormat(4),
833
+ yformat = tickFormat || y1.tickFormat(4),
834
+ tx = function(d) { return "translate(" + x1(d) + "," + height + ")"; },
835
+ ty = function(d) { return "translate(0," + y1(d) + ")"; };
836
+
837
+ // Update x-ticks.
838
+ var xtick = g.selectAll("g.x.tick")
839
+ .data(x1.ticks(4), function(d) {
840
+ return this.textContent || xformat(d);
841
+ });
842
+
843
+ var xtickEnter = xtick.enter().append("svg:g")
844
+ .attr("class", "x tick")
845
+ .attr("transform", function(d) { return "translate(" + x0(d) + "," + height + ")"; })
846
+ .style("opacity", 1e-6);
847
+
848
+ xtickEnter.append("svg:line")
849
+ .attr("y1", 0)
850
+ .attr("y2", -6);
851
+
852
+ xtickEnter.append("svg:text")
853
+ .attr("text-anchor", "middle")
854
+ .attr("dy", "1em")
855
+ .text(xformat);
856
+
857
+ // Transition the entering ticks to the new scale, x1.
858
+ xtickEnter.transition()
859
+ .duration(duration)
860
+ .attr("transform", tx)
861
+ .style("opacity", 1);
862
+
863
+ // Transition the updating ticks to the new scale, x1.
864
+ xtick.transition()
865
+ .duration(duration)
866
+ .attr("transform", tx)
867
+ .style("opacity", 1);
868
+
869
+ // Transition the exiting ticks to the new scale, x1.
870
+ xtick.exit().transition()
871
+ .duration(duration)
872
+ .attr("transform", tx)
873
+ .style("opacity", 1e-6)
874
+ .remove();
875
+
876
+ // Update ticks.
877
+ var ytick = g.selectAll("g.y.tick")
878
+ .data(y1.ticks(4), function(d) {
879
+ return this.textContent || yformat(d);
880
+ });
881
+
882
+ var ytickEnter = ytick.enter().append("svg:g")
883
+ .attr("class", "y tick")
884
+ .attr("transform", function(d) { return "translate(0," + y0(d) + ")"; })
885
+ .style("opacity", 1e-6);
886
+
887
+ ytickEnter.append("svg:line")
888
+ .attr("x1", 0)
889
+ .attr("x2", 6);
890
+
891
+ ytickEnter.append("svg:text")
892
+ .attr("text-anchor", "end")
893
+ .attr("dx", "-.5em")
894
+ .attr("dy", ".3em")
895
+ .text(yformat);
896
+
897
+ // Transition the entering ticks to the new scale, y1.
898
+ ytickEnter.transition()
899
+ .duration(duration)
900
+ .attr("transform", ty)
901
+ .style("opacity", 1);
902
+
903
+ // Transition the updating ticks to the new scale, y1.
904
+ ytick.transition()
905
+ .duration(duration)
906
+ .attr("transform", ty)
907
+ .style("opacity", 1);
908
+
909
+ // Transition the exiting ticks to the new scale, y1.
910
+ ytick.exit().transition()
911
+ .duration(duration)
912
+ .attr("transform", ty)
913
+ .style("opacity", 1e-6)
914
+ .remove();
915
+ });
916
+ }
917
+
918
+ qq.width = function(x) {
919
+ if (!arguments.length) return width;
920
+ width = x;
921
+ return qq;
922
+ };
923
+
924
+ qq.height = function(x) {
925
+ if (!arguments.length) return height;
926
+ height = x;
927
+ return qq;
928
+ };
929
+
930
+ qq.duration = function(x) {
931
+ if (!arguments.length) return duration;
932
+ duration = x;
933
+ return qq;
934
+ };
935
+
936
+ qq.domain = function(x) {
937
+ if (!arguments.length) return domain;
938
+ domain = x == null ? x : d3.functor(x);
939
+ return qq;
940
+ };
941
+
942
+ qq.count = function(z) {
943
+ if (!arguments.length) return n;
944
+ n = z;
945
+ return qq;
946
+ };
947
+
948
+ qq.x = function(z) {
949
+ if (!arguments.length) return x;
950
+ x = z;
951
+ return qq;
952
+ };
953
+
954
+ qq.y = function(z) {
955
+ if (!arguments.length) return y;
956
+ y = z;
957
+ return qq;
958
+ };
959
+
960
+ qq.tickFormat = function(x) {
961
+ if (!arguments.length) return tickFormat;
962
+ tickFormat = x;
963
+ return qq;
964
+ };
965
+
966
+ return qq;
967
+ };
968
+
969
+ function d3_chart_qqQuantiles(n, values) {
970
+ var m = values.length - 1;
971
+ values = values.slice().sort(d3.ascending);
972
+ return d3.range(n).map(function(i) {
973
+ return values[~~(i * m / n)];
974
+ });
975
+ }
976
+
977
+ function d3_chart_qqX(d) {
978
+ return d.x;
979
+ }
980
+
981
+ function d3_chart_qqY(d) {
982
+ return d.y;
983
+ }
984
+ })();