bum 0.0.4 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README +0 -12
- data/bin/bum +16 -49
- data/bin/bum_master +20 -0
- data/lib/actor.rb +0 -0
- data/lib/app_role.rb +83 -0
- data/lib/client.rb +104 -0
- data/lib/db_crap.rb +85 -0
- data/lib/db_role.rb +107 -0
- data/lib/demo_socket.rb +51 -0
- data/lib/master.rb +109 -0
- data/lib/master_web.rb +81 -0
- data/lib/nice_socket.rb +77 -0
- data/lib/node.rb +96 -0
- data/lib/proxy_role.rb +132 -0
- data/lib/role.rb +99 -0
- data/lib/scenario.rb +186 -0
- data/lib/server.rb +30 -0
- data/lib/stats_role.rb +89 -0
- data/public/app.css +91 -0
- data/public/css/light.css +105 -0
- data/public/d3/LICENSE +26 -0
- data/public/d3/Makefile +247 -0
- data/public/d3/README.md +51 -0
- data/public/d3/d3.chart.js +984 -0
- data/public/d3/d3.chart.min.js +1 -0
- data/public/d3/d3.csv.js +92 -0
- data/public/d3/d3.csv.min.js +1 -0
- data/public/d3/d3.geo.js +692 -0
- data/public/d3/d3.geo.min.js +1 -0
- data/public/d3/d3.geom.js +825 -0
- data/public/d3/d3.geom.min.js +1 -0
- data/public/d3/d3.js +4013 -0
- data/public/d3/d3.layout.js +1865 -0
- data/public/d3/d3.layout.min.js +1 -0
- data/public/d3/d3.min.js +2 -0
- data/public/d3/d3.time.js +663 -0
- data/public/d3/d3.time.min.js +1 -0
- data/public/d3/examples/albers/albers.html +168 -0
- data/public/d3/examples/area/area-radial.html +48 -0
- data/public/d3/examples/area/area.html +113 -0
- data/public/d3/examples/axis/axis-alternating.html +50 -0
- data/public/d3/examples/axis/axis-ggplot2.html +68 -0
- data/public/d3/examples/axis/axis-multiples.html +117 -0
- data/public/d3/examples/axis/axis-orientations.html +63 -0
- data/public/d3/examples/axis/axis-transition.html +153 -0
- data/public/d3/examples/azimuthal/azimuthal.css +21 -0
- data/public/d3/examples/azimuthal/azimuthal.html +84 -0
- data/public/d3/examples/azimuthal/azimuthal.js +27 -0
- data/public/d3/examples/bar/bar.html +93 -0
- data/public/d3/examples/box/box.css +4 -0
- data/public/d3/examples/box/box.html +19 -0
- data/public/d3/examples/box/box.js +68 -0
- data/public/d3/examples/bubble/bubble.css +8 -0
- data/public/d3/examples/bubble/bubble.html +14 -0
- data/public/d3/examples/bubble/bubble.js +46 -0
- data/public/d3/examples/bullet/bullet.css +10 -0
- data/public/d3/examples/bullet/bullet.html +18 -0
- data/public/d3/examples/bullet/bullet.js +53 -0
- data/public/d3/examples/bullet/bullets.json +7 -0
- data/public/d3/examples/bundle/bundle-radial.css +9 -0
- data/public/d3/examples/bundle/bundle-radial.html +15 -0
- data/public/d3/examples/bundle/bundle-radial.js +50 -0
- data/public/d3/examples/bundle/bundle-treemap.css +14 -0
- data/public/d3/examples/bundle/bundle-treemap.html +16 -0
- data/public/d3/examples/bundle/bundle-treemap.js +53 -0
- data/public/d3/examples/bundle/packages.js +49 -0
- data/public/d3/examples/button.css +35 -0
- data/public/d3/examples/calendar/calendar.css +16 -0
- data/public/d3/examples/calendar/calendar.js +50 -0
- data/public/d3/examples/calendar/dji.csv +5233 -0
- data/public/d3/examples/calendar/dji.html +16 -0
- data/public/d3/examples/calendar/dji.js +61 -0
- data/public/d3/examples/calendar/vix.csv +5231 -0
- data/public/d3/examples/calendar/vix.html +16 -0
- data/public/d3/examples/calendar/vix.js +60 -0
- data/public/d3/examples/cartogram/cartogram.css +20 -0
- data/public/d3/examples/cartogram/cartogram.html +15 -0
- data/public/d3/examples/cartogram/cartogram.js +51 -0
- data/public/d3/examples/cartogram/demers.css +9 -0
- data/public/d3/examples/cartogram/demers.html +16 -0
- data/public/d3/examples/cartogram/demers.js +79 -0
- data/public/d3/examples/cartogram/dorling.css +9 -0
- data/public/d3/examples/cartogram/dorling.html +16 -0
- data/public/d3/examples/cartogram/dorling.js +80 -0
- data/public/d3/examples/chord/chord-flare.html +109 -0
- data/public/d3/examples/chord/chord.css +9 -0
- data/public/d3/examples/chord/chord.html +14 -0
- data/public/d3/examples/chord/chord.js +98 -0
- data/public/d3/examples/choropleth/choropleth-area.html +51 -0
- data/public/d3/examples/choropleth/choropleth-bounds.html +46 -0
- data/public/d3/examples/choropleth/choropleth.css +16 -0
- data/public/d3/examples/choropleth/choropleth.html +15 -0
- data/public/d3/examples/choropleth/choropleth.js +38 -0
- data/public/d3/examples/choropleth/unemployment.json +1 -0
- data/public/d3/examples/clock/clock.css +23 -0
- data/public/d3/examples/clock/clock.html +17 -0
- data/public/d3/examples/clock/clock.js +87 -0
- data/public/d3/examples/cluster/cluster-radial.html +14 -0
- data/public/d3/examples/cluster/cluster-radial.js +39 -0
- data/public/d3/examples/cluster/cluster.css +15 -0
- data/public/d3/examples/cluster/cluster.html +14 -0
- data/public/d3/examples/cluster/cluster.js +39 -0
- data/public/d3/examples/contour/contour.html +108 -0
- data/public/d3/examples/crimea/crimea-stacked-area.html +109 -0
- data/public/d3/examples/crimea/crimea-stacked-bar.html +98 -0
- data/public/d3/examples/crimea/crimea.csv +24 -0
- data/public/d3/examples/data/README +5 -0
- data/public/d3/examples/data/faithful.json +8 -0
- data/public/d3/examples/data/flare-imports.json +222 -0
- data/public/d3/examples/data/flare.json +380 -0
- data/public/d3/examples/data/morley.csv +101 -0
- data/public/d3/examples/data/sample.csv +2 -0
- data/public/d3/examples/data/sample.html +5 -0
- data/public/d3/examples/data/sample.json +1 -0
- data/public/d3/examples/data/sample.txt +1 -0
- data/public/d3/examples/data/sample.xml +4 -0
- data/public/d3/examples/data/stocks.csv +807 -0
- data/public/d3/examples/data/unemployment.csv +1709 -0
- data/public/d3/examples/data/us-borders.json +1 -0
- data/public/d3/examples/data/us-counties.json +3216 -0
- data/public/d3/examples/data/us-state-centroids.json +1 -0
- data/public/d3/examples/data/us-states.json +54 -0
- data/public/d3/examples/data/world-countries.json +246 -0
- data/public/d3/examples/delaunay/delaunay.html +44 -0
- data/public/d3/examples/donut/donut.html +124 -0
- data/public/d3/examples/dot/dot.html +103 -0
- data/public/d3/examples/force/README +10 -0
- data/public/d3/examples/force/force-bounds.html +70 -0
- data/public/d3/examples/force/force-cluster.html +251 -0
- data/public/d3/examples/force/force-dynamic.html +118 -0
- data/public/d3/examples/force/force-interactive.html +136 -0
- data/public/d3/examples/force/force-map.html +104 -0
- data/public/d3/examples/force/force-multi-foci.html +68 -0
- data/public/d3/examples/force/force.css +9 -0
- data/public/d3/examples/force/force.html +14 -0
- data/public/d3/examples/force/force.js +56 -0
- data/public/d3/examples/force/miserables.json +1 -0
- data/public/d3/examples/hello-world/hello-data-key.html +60 -0
- data/public/d3/examples/hello-world/hello-data-nested-key.html +75 -0
- data/public/d3/examples/hello-world/hello-data-nested.html +77 -0
- data/public/d3/examples/hello-world/hello-data.html +46 -0
- data/public/d3/examples/hello-world/hello-event.html +53 -0
- data/public/d3/examples/hello-world/hello-node-key.html +25 -0
- data/public/d3/examples/hello-world/hello-sort.html +75 -0
- data/public/d3/examples/hello-world/hello-transform.html +41 -0
- data/public/d3/examples/hello-world/hello-transition-undefined.html +43 -0
- data/public/d3/examples/hello-world/hello-transition.html +47 -0
- data/public/d3/examples/hello-world/hello-webkit-transition.html +64 -0
- data/public/d3/examples/hello-world/select-enter-add.html +29 -0
- data/public/d3/examples/hello-world/selectAll-enter-add.html +20 -0
- data/public/d3/examples/histogram/histogram.html +80 -0
- data/public/d3/examples/horizon/horizon.css +9 -0
- data/public/d3/examples/horizon/horizon.html +25 -0
- data/public/d3/examples/horizon/horizon.js +43 -0
- data/public/d3/examples/horizon/unemployment.json +1 -0
- data/public/d3/examples/hull/hull.html +75 -0
- data/public/d3/examples/kde/kde.css +9 -0
- data/public/d3/examples/kde/kde.html +14 -0
- data/public/d3/examples/kde/kde.js +40 -0
- data/public/d3/examples/line/line.css +22 -0
- data/public/d3/examples/line/line.html +11 -0
- data/public/d3/examples/line/line.js +63 -0
- data/public/d3/examples/marimekko/marimekko.html +116 -0
- data/public/d3/examples/marimekko/marimekko.json +18 -0
- data/public/d3/examples/marker/marker.html +169 -0
- data/public/d3/examples/mercator/mercator.html +133 -0
- data/public/d3/examples/moire/moire.html +53 -0
- data/public/d3/examples/pack/pack.css +15 -0
- data/public/d3/examples/pack/pack.html +14 -0
- data/public/d3/examples/pack/pack.js +33 -0
- data/public/d3/examples/partition/partition-icicle-zoom.html +59 -0
- data/public/d3/examples/partition/partition-icicle.html +45 -0
- data/public/d3/examples/partition/partition-sunburst-zoom.html +72 -0
- data/public/d3/examples/partition/partition-sunburst.html +21 -0
- data/public/d3/examples/partition/partition-sunburst.js +72 -0
- data/public/d3/examples/pie/pie-transition.html +70 -0
- data/public/d3/examples/pie/pie.html +51 -0
- data/public/d3/examples/population/population.css +28 -0
- data/public/d3/examples/population/population.csv +571 -0
- data/public/d3/examples/population/population.html +13 -0
- data/public/d3/examples/population/population.js +126 -0
- data/public/d3/examples/qq/qq.css +18 -0
- data/public/d3/examples/qq/qq.html +21 -0
- data/public/d3/examples/qq/qq.js +66 -0
- data/public/d3/examples/qq/stats.js +28 -0
- data/public/d3/examples/qq/turkers.json +1 -0
- data/public/d3/examples/quadtree/quadtree.html +114 -0
- data/public/d3/examples/sizzle/sizzle.html +27 -0
- data/public/d3/examples/sort/sort.css +4 -0
- data/public/d3/examples/sort/sort.html +12 -0
- data/public/d3/examples/sort/sort.js +112 -0
- data/public/d3/examples/spline/spline.css +30 -0
- data/public/d3/examples/spline/spline.html +14 -0
- data/public/d3/examples/spline/spline.js +113 -0
- data/public/d3/examples/splom/cross.js +7 -0
- data/public/d3/examples/splom/flowers.json +1 -0
- data/public/d3/examples/splom/splom.css +8 -0
- data/public/d3/examples/splom/splom.html +14 -0
- data/public/d3/examples/splom/splom.js +149 -0
- data/public/d3/examples/stream/stack.css +7 -0
- data/public/d3/examples/stream/stack.html +22 -0
- data/public/d3/examples/stream/stack.js +119 -0
- data/public/d3/examples/stream/stream.css +3 -0
- data/public/d3/examples/stream/stream.html +19 -0
- data/public/d3/examples/stream/stream.js +42 -0
- data/public/d3/examples/stream/stream_layers.js +33 -0
- data/public/d3/examples/superformula/dot.html +104 -0
- data/public/d3/examples/superformula/explorer.html +120 -0
- data/public/d3/examples/superformula/superformula.html +70 -0
- data/public/d3/examples/superformula/superformula.js +98 -0
- data/public/d3/examples/symbol-map/symbol-map.html +67 -0
- data/public/d3/examples/touch/touch.html +65 -0
- data/public/d3/examples/tree/tree-dynamic.html +111 -0
- data/public/d3/examples/tree/tree-interactive.html +139 -0
- data/public/d3/examples/tree/tree-radial.html +14 -0
- data/public/d3/examples/tree/tree-radial.js +40 -0
- data/public/d3/examples/tree/tree.css +15 -0
- data/public/d3/examples/tree/tree.html +14 -0
- data/public/d3/examples/tree/tree.js +39 -0
- data/public/d3/examples/treemap/treemap-svg.html +22 -0
- data/public/d3/examples/treemap/treemap-svg.js +34 -0
- data/public/d3/examples/treemap/treemap.css +8 -0
- data/public/d3/examples/treemap/treemap.html +22 -0
- data/public/d3/examples/treemap/treemap.js +53 -0
- data/public/d3/examples/voroboids/boid.js +235 -0
- data/public/d3/examples/voroboids/voroboids.css +15 -0
- data/public/d3/examples/voroboids/voroboids.html +14 -0
- data/public/d3/examples/voroboids/voroboids.js +65 -0
- data/public/d3/examples/voronoi/voronoi.css +16 -0
- data/public/d3/examples/voronoi/voronoi.html +15 -0
- data/public/d3/examples/voronoi/voronoi.js +34 -0
- data/public/d3/examples/zoom-pan/zoom-pan-transform.html +95 -0
- data/public/d3/examples/zoom-pan/zoom-pan.html +119 -0
- data/public/d3/examples/zoom/dji.csv +5233 -0
- data/public/d3/examples/zoom/zoom.html +162 -0
- data/public/d3/lib/colorbrewer/LICENSE +38 -0
- data/public/d3/lib/colorbrewer/colorbrewer.css +1327 -0
- data/public/d3/lib/colorbrewer/colorbrewer.js +32 -0
- data/public/d3/lib/jit/LICENSE +27 -0
- data/public/d3/lib/jquery-ui/LICENSE +25 -0
- data/public/d3/lib/jquery-ui/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/public/d3/lib/jquery-ui/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/public/d3/lib/jquery-ui/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/public/d3/lib/jquery-ui/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/public/d3/lib/jquery-ui/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/public/d3/lib/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/d3/lib/jquery-ui/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/public/d3/lib/jquery-ui/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/public/d3/lib/jquery-ui/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/public/d3/lib/jquery-ui/images/ui-icons_222222_256x240.png +0 -0
- data/public/d3/lib/jquery-ui/images/ui-icons_228ef1_256x240.png +0 -0
- data/public/d3/lib/jquery-ui/images/ui-icons_ef8c08_256x240.png +0 -0
- data/public/d3/lib/jquery-ui/images/ui-icons_ffd27a_256x240.png +0 -0
- data/public/d3/lib/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/d3/lib/jquery-ui/jquery-ui.css +318 -0
- data/public/d3/lib/jquery-ui/jquery-ui.min.js +83 -0
- data/public/d3/lib/jquery/LICENSE +20 -0
- data/public/d3/lib/jquery/jquery.js +6883 -0
- data/public/d3/lib/jquery/jquery.min.js +166 -0
- data/public/d3/lib/polymaps/LICENSE +28 -0
- data/public/d3/lib/protovis/LICENSE +27 -0
- data/public/d3/lib/science/LICENSE +26 -0
- data/public/d3/lib/science/science.js +5 -0
- data/public/d3/lib/science/science.min.js +1 -0
- data/public/d3/lib/science/science.stats.js +166 -0
- data/public/d3/lib/science/science.stats.min.js +1 -0
- data/public/d3/lib/sizzle/LICENSE +24 -0
- data/public/d3/lib/sizzle/sizzle.js +1376 -0
- data/public/d3/lib/sizzle/sizzle.min.js +28 -0
- data/public/d3/package.json +14 -0
- data/public/d3/src/behavior/behavior.js +1 -0
- data/public/d3/src/behavior/drag.js +106 -0
- data/public/d3/src/behavior/zoom.js +212 -0
- data/public/d3/src/chart/box.js +297 -0
- data/public/d3/src/chart/bullet.js +237 -0
- data/public/d3/src/chart/chart.js +1 -0
- data/public/d3/src/chart/horizon.js +203 -0
- data/public/d3/src/chart/qq.js +245 -0
- data/public/d3/src/compat/date.js +3 -0
- data/public/d3/src/compat/style.js +9 -0
- data/public/d3/src/core/array.js +11 -0
- data/public/d3/src/core/ascending.js +3 -0
- data/public/d3/src/core/bisect.js +38 -0
- data/public/d3/src/core/collapse.js +3 -0
- data/public/d3/src/core/core.js +1 -0
- data/public/d3/src/core/descending.js +3 -0
- data/public/d3/src/core/dispatch.js +45 -0
- data/public/d3/src/core/ease.js +128 -0
- data/public/d3/src/core/entries.js +5 -0
- data/public/d3/src/core/event.js +1 -0
- data/public/d3/src/core/first.js +13 -0
- data/public/d3/src/core/format.js +85 -0
- data/public/d3/src/core/functor.js +3 -0
- data/public/d3/src/core/hsl.js +62 -0
- data/public/d3/src/core/html.js +10 -0
- data/public/d3/src/core/interpolate.js +180 -0
- data/public/d3/src/core/json.js +5 -0
- data/public/d3/src/core/keys.js +5 -0
- data/public/d3/src/core/last.js +13 -0
- data/public/d3/src/core/max.js +14 -0
- data/public/d3/src/core/merge.js +3 -0
- data/public/d3/src/core/min.js +14 -0
- data/public/d3/src/core/nest.js +87 -0
- data/public/d3/src/core/noop.js +1 -0
- data/public/d3/src/core/ns.js +19 -0
- data/public/d3/src/core/permute.js +7 -0
- data/public/d3/src/core/quantile.js +8 -0
- data/public/d3/src/core/range.js +21 -0
- data/public/d3/src/core/rebind.js +7 -0
- data/public/d3/src/core/requote.js +5 -0
- data/public/d3/src/core/rgb.js +284 -0
- data/public/d3/src/core/round.js +5 -0
- data/public/d3/src/core/selection-append.js +15 -0
- data/public/d3/src/core/selection-attr.js +44 -0
- data/public/d3/src/core/selection-call.js +13 -0
- data/public/d3/src/core/selection-classed.js +46 -0
- data/public/d3/src/core/selection-data.js +110 -0
- data/public/d3/src/core/selection-each.js +9 -0
- data/public/d3/src/core/selection-empty.js +3 -0
- data/public/d3/src/core/selection-enter-select.js +24 -0
- data/public/d3/src/core/selection-enter.js +10 -0
- data/public/d3/src/core/selection-filter.js +19 -0
- data/public/d3/src/core/selection-html.js +6 -0
- data/public/d3/src/core/selection-insert.js +20 -0
- data/public/d3/src/core/selection-map.js +5 -0
- data/public/d3/src/core/selection-node.js +9 -0
- data/public/d3/src/core/selection-on.js +34 -0
- data/public/d3/src/core/selection-property.js +23 -0
- data/public/d3/src/core/selection-remove.js +9 -0
- data/public/d3/src/core/selection-root.js +16 -0
- data/public/d3/src/core/selection-select.js +30 -0
- data/public/d3/src/core/selection-selectAll.js +24 -0
- data/public/d3/src/core/selection-sort.js +20 -0
- data/public/d3/src/core/selection-style.js +26 -0
- data/public/d3/src/core/selection-text.js +6 -0
- data/public/d3/src/core/selection-transition.js +14 -0
- data/public/d3/src/core/selection.js +21 -0
- data/public/d3/src/core/split.js +21 -0
- data/public/d3/src/core/sum.js +14 -0
- data/public/d3/src/core/text.js +10 -0
- data/public/d3/src/core/this.js +3 -0
- data/public/d3/src/core/timer.js +104 -0
- data/public/d3/src/core/transition-attr.js +23 -0
- data/public/d3/src/core/transition-delay.js +6 -0
- data/public/d3/src/core/transition-duration.js +6 -0
- data/public/d3/src/core/transition-each.js +9 -0
- data/public/d3/src/core/transition-remove.js +6 -0
- data/public/d3/src/core/transition-select.js +22 -0
- data/public/d3/src/core/transition-selectAll.js +20 -0
- data/public/d3/src/core/transition-style.js +14 -0
- data/public/d3/src/core/transition-text.js +7 -0
- data/public/d3/src/core/transition-transition.js +3 -0
- data/public/d3/src/core/transition.js +105 -0
- data/public/d3/src/core/uninterpolate.js +9 -0
- data/public/d3/src/core/values.js +5 -0
- data/public/d3/src/core/xhr.js +10 -0
- data/public/d3/src/core/xml.js +10 -0
- data/public/d3/src/core/zip.js +13 -0
- data/public/d3/src/csv/csv.js +5 -0
- data/public/d3/src/csv/format.js +13 -0
- data/public/d3/src/csv/parse.js +73 -0
- data/public/d3/src/end.js +1 -0
- data/public/d3/src/externs.js +6 -0
- data/public/d3/src/geo/albers.js +128 -0
- data/public/d3/src/geo/azimuthal.js +70 -0
- data/public/d3/src/geo/bounds.js +76 -0
- data/public/d3/src/geo/geo.js +1 -0
- data/public/d3/src/geo/greatCircle.js +91 -0
- data/public/d3/src/geo/mercator.js +36 -0
- data/public/d3/src/geo/path.js +289 -0
- data/public/d3/src/geom/contour.js +78 -0
- data/public/d3/src/geom/delaunay.js +31 -0
- data/public/d3/src/geom/geom.js +1 -0
- data/public/d3/src/geom/hull.js +98 -0
- data/public/d3/src/geom/polygon.js +88 -0
- data/public/d3/src/geom/quadtree.js +129 -0
- data/public/d3/src/geom/voronoi.js +399 -0
- data/public/d3/src/layout/bundle.js +57 -0
- data/public/d3/src/layout/chord.js +148 -0
- data/public/d3/src/layout/cluster.js +77 -0
- data/public/d3/src/layout/force.js +332 -0
- data/public/d3/src/layout/hierarchy.js +120 -0
- data/public/d3/src/layout/histogram.js +102 -0
- data/public/d3/src/layout/layout.js +1 -0
- data/public/d3/src/layout/pack.js +200 -0
- data/public/d3/src/layout/partition.js +48 -0
- data/public/d3/src/layout/pie.js +95 -0
- data/public/d3/src/layout/stack.js +237 -0
- data/public/d3/src/layout/tree.js +234 -0
- data/public/d3/src/layout/treemap.js +213 -0
- data/public/d3/src/scale/bilinear.js +7 -0
- data/public/d3/src/scale/category.js +54 -0
- data/public/d3/src/scale/linear.js +115 -0
- data/public/d3/src/scale/log.js +80 -0
- data/public/d3/src/scale/nice.js +21 -0
- data/public/d3/src/scale/ordinal.js +74 -0
- data/public/d3/src/scale/polylinear.js +16 -0
- data/public/d3/src/scale/pow.js +54 -0
- data/public/d3/src/scale/quantile.js +43 -0
- data/public/d3/src/scale/quantize.js +36 -0
- data/public/d3/src/scale/scale.js +6 -0
- data/public/d3/src/scale/sqrt.js +3 -0
- data/public/d3/src/start.js +1 -0
- data/public/d3/src/svg/arc.js +95 -0
- data/public/d3/src/svg/area-radial.js +10 -0
- data/public/d3/src/svg/area.js +84 -0
- data/public/d3/src/svg/axis.js +182 -0
- data/public/d3/src/svg/chord.js +99 -0
- data/public/d3/src/svg/diagonal-radial.js +22 -0
- data/public/d3/src/svg/diagonal.js +38 -0
- data/public/d3/src/svg/line-radial.js +22 -0
- data/public/d3/src/svg/line.js +419 -0
- data/public/d3/src/svg/mouse.js +29 -0
- data/public/d3/src/svg/svg.js +1 -0
- data/public/d3/src/svg/symbol.js +98 -0
- data/public/d3/src/svg/touches.js +8 -0
- data/public/d3/src/time/day.js +7 -0
- data/public/d3/src/time/days.js +11 -0
- data/public/d3/src/time/format-iso.js +1 -0
- data/public/d3/src/time/format-utc.js +48 -0
- data/public/d3/src/time/format.js +315 -0
- data/public/d3/src/time/hour.js +8 -0
- data/public/d3/src/time/hours.js +11 -0
- data/public/d3/src/time/minute.js +5 -0
- data/public/d3/src/time/minutes.js +11 -0
- data/public/d3/src/time/month.js +7 -0
- data/public/d3/src/time/months.js +11 -0
- data/public/d3/src/time/range.js +16 -0
- data/public/d3/src/time/scale-utc.js +36 -0
- data/public/d3/src/time/scale.js +123 -0
- data/public/d3/src/time/second.js +5 -0
- data/public/d3/src/time/seconds.js +7 -0
- data/public/d3/src/time/time.js +3 -0
- data/public/d3/src/time/week.js +9 -0
- data/public/d3/src/time/weeks.js +11 -0
- data/public/d3/src/time/year.js +7 -0
- data/public/d3/src/time/years.js +11 -0
- data/public/d3/test/core/ascending-test.js +47 -0
- data/public/d3/test/core/bisect-test.js +103 -0
- data/public/d3/test/core/descending-test.js +47 -0
- data/public/d3/test/core/dispatch-test.js +116 -0
- data/public/d3/test/core/ease-test.js +129 -0
- data/public/d3/test/core/entries-test.js +43 -0
- data/public/d3/test/core/first-test.js +42 -0
- data/public/d3/test/core/format-test.js +204 -0
- data/public/d3/test/core/functor-test.js +29 -0
- data/public/d3/test/core/hsl-test.js +87 -0
- data/public/d3/test/core/html-test.js +37 -0
- data/public/d3/test/core/interpolate-test.js +203 -0
- data/public/d3/test/core/json-test.js +37 -0
- data/public/d3/test/core/keys-test.js +31 -0
- data/public/d3/test/core/last-test.js +42 -0
- data/public/d3/test/core/max-test.js +50 -0
- data/public/d3/test/core/merge-test.js +27 -0
- data/public/d3/test/core/min-test.js +50 -0
- data/public/d3/test/core/nest-test.js +236 -0
- data/public/d3/test/core/ns-test.js +53 -0
- data/public/d3/test/core/permute-test.js +53 -0
- data/public/d3/test/core/quantile-test.js +50 -0
- data/public/d3/test/core/range-test.js +93 -0
- data/public/d3/test/core/rebind-test.js +38 -0
- data/public/d3/test/core/requote-test.js +53 -0
- data/public/d3/test/core/rgb-test.js +89 -0
- data/public/d3/test/core/round-test.js +70 -0
- data/public/d3/test/core/select-test.js +42 -0
- data/public/d3/test/core/selectAll-test.js +42 -0
- data/public/d3/test/core/selection-append-test.js +119 -0
- data/public/d3/test/core/selection-attr-test.js +153 -0
- data/public/d3/test/core/selection-call-test.js +71 -0
- data/public/d3/test/core/selection-classed-test.js +200 -0
- data/public/d3/test/core/selection-data-test.js +165 -0
- data/public/d3/test/core/selection-each-test.js +83 -0
- data/public/d3/test/core/selection-empty-test.js +51 -0
- data/public/d3/test/core/selection-filter-test.js +63 -0
- data/public/d3/test/core/selection-html-test.js +121 -0
- data/public/d3/test/core/selection-insert-test.js +132 -0
- data/public/d3/test/core/selection-map-test.js +47 -0
- data/public/d3/test/core/selection-node-test.js +50 -0
- data/public/d3/test/core/selection-on-test.js +95 -0
- data/public/d3/test/core/selection-property-test.js +91 -0
- data/public/d3/test/core/selection-remove-test.js +39 -0
- data/public/d3/test/core/selection-select-test.js +125 -0
- data/public/d3/test/core/selection-selectAll-test.js +127 -0
- data/public/d3/test/core/selection-sort-test.js +59 -0
- data/public/d3/test/core/selection-style-test.js +100 -0
- data/public/d3/test/core/selection-test.js +35 -0
- data/public/d3/test/core/selection-text-test.js +109 -0
- data/public/d3/test/core/split-test.js +34 -0
- data/public/d3/test/core/sum-test.js +47 -0
- data/public/d3/test/core/text-test.js +48 -0
- data/public/d3/test/core/timer-test.js +62 -0
- data/public/d3/test/core/transition-test-attr.js +33 -0
- data/public/d3/test/core/transition-test-attrTween.js +67 -0
- data/public/d3/test/core/transition-test-call.js +33 -0
- data/public/d3/test/core/transition-test-delay.js +41 -0
- data/public/d3/test/core/transition-test-duration.js +41 -0
- data/public/d3/test/core/transition-test-each.js +166 -0
- data/public/d3/test/core/transition-test-id.js +20 -0
- data/public/d3/test/core/transition-test-remove.js +46 -0
- data/public/d3/test/core/transition-test-select.js +63 -0
- data/public/d3/test/core/transition-test-selectAll.js +55 -0
- data/public/d3/test/core/transition-test-style.js +38 -0
- data/public/d3/test/core/transition-test-styleTween.js +73 -0
- data/public/d3/test/core/transition-test-text.js +30 -0
- data/public/d3/test/core/transition-test-transition.js +60 -0
- data/public/d3/test/core/transition-test-tween.js +71 -0
- data/public/d3/test/core/transition-test.js +65 -0
- data/public/d3/test/core/values-test.js +35 -0
- data/public/d3/test/core/version-test.js +18 -0
- data/public/d3/test/core/xhr-test.js +56 -0
- data/public/d3/test/core/xml-test.js +48 -0
- data/public/d3/test/core/zip-test.js +32 -0
- data/public/d3/test/csv/csv-test.js +38 -0
- data/public/d3/test/csv/format-test.js +39 -0
- data/public/d3/test/csv/parse-test.js +101 -0
- data/public/d3/test/env-assert.js +96 -0
- data/public/d3/test/env-fragment.js +8 -0
- data/public/d3/test/env-xhr.js +56 -0
- data/public/d3/test/env.js +13 -0
- data/public/d3/test/geo/albers-test.js +57 -0
- data/public/d3/test/geo/azimuthal-test.js +89 -0
- data/public/d3/test/geo/greatCircle-test.js +42 -0
- data/public/d3/test/geo/mercator-test.js +57 -0
- data/public/d3/test/layout/histogram-test.js +91 -0
- data/public/d3/test/layout/partition-test.js +39 -0
- data/public/d3/test/layout/tree-test.js +21 -0
- data/public/d3/test/layout/treemap-test.js +180 -0
- data/public/d3/test/scale/category-test.js +74 -0
- data/public/d3/test/scale/linear-test.js +239 -0
- data/public/d3/test/scale/log-test.js +220 -0
- data/public/d3/test/scale/ordinal-test.js +193 -0
- data/public/d3/test/scale/pow-test.js +259 -0
- data/public/d3/test/scale/quantile-test.js +64 -0
- data/public/d3/test/scale/quantize-test.js +69 -0
- data/public/d3/test/scale/sqrt-test.js +256 -0
- data/public/d3/test/svg/arc-test.js +147 -0
- data/public/d3/test/svg/area-radial-test.js +200 -0
- data/public/d3/test/svg/area-test.js +191 -0
- data/public/d3/test/svg/axis-test.js +347 -0
- data/public/d3/test/svg/line-radial-test.js +125 -0
- data/public/d3/test/svg/line-test.js +189 -0
- data/public/d3/test/svg/symbol-test.js +96 -0
- data/public/d3/test/time/day-test.js +65 -0
- data/public/d3/test/time/days-test.js +105 -0
- data/public/d3/test/time/format-test.js +430 -0
- data/public/d3/test/time/hour-test.js +103 -0
- data/public/d3/test/time/hours-test.js +135 -0
- data/public/d3/test/time/minute-test.js +43 -0
- data/public/d3/test/time/minutes-test.js +101 -0
- data/public/d3/test/time/month-test.js +53 -0
- data/public/d3/test/time/months-test.js +105 -0
- data/public/d3/test/time/scale-test.js +525 -0
- data/public/d3/test/time/second-test.js +41 -0
- data/public/d3/test/time/seconds-test.js +101 -0
- data/public/d3/test/time/week-test.js +59 -0
- data/public/d3/test/time/weeks-test.js +105 -0
- data/public/d3/test/time/year-test.js +41 -0
- data/public/d3/test/time/years-test.js +73 -0
- data/public/graph.js +42 -0
- data/public/jquery.min.js +4 -0
- data/public/test.html +36 -0
- data/public/testdata/bigfucker.js +212 -0
- data/public/testdata/names_and_enabled.js +232 -0
- data/public/testdata/one.js +79 -0
- data/public/testdata/withnames.js +198 -0
- data/public/viz.js +289 -0
- data/views/graph.erb +15 -0
- data/views/one.erb +34 -0
- data/views/two.erb +44 -0
- data/views/vis.erb +47 -0
- metadata +594 -18
- data/lib/bum.rb +0 -385
- data/lib/client.rb.erb +0 -7
- data/lib/dhcpd.rb +0 -84
- data/lib/hosts.rb +0 -61
- data/lib/vmx.rb +0 -24
@@ -0,0 +1,57 @@
|
|
1
|
+
// Implements hierarchical edge bundling using Holten's algorithm. For each
|
2
|
+
// input link, a path is computed that travels through the tree, up the parent
|
3
|
+
// hierarchy to the least common ancestor, and then back down to the destination
|
4
|
+
// node. Each path is simply an array of nodes.
|
5
|
+
d3.layout.bundle = function() {
|
6
|
+
return function(links) {
|
7
|
+
var paths = [],
|
8
|
+
i = -1,
|
9
|
+
n = links.length;
|
10
|
+
while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
|
11
|
+
return paths;
|
12
|
+
};
|
13
|
+
};
|
14
|
+
|
15
|
+
function d3_layout_bundlePath(link) {
|
16
|
+
var start = link.source,
|
17
|
+
end = link.target,
|
18
|
+
lca = d3_layout_bundleLeastCommonAncestor(start, end),
|
19
|
+
points = [start];
|
20
|
+
while (start !== lca) {
|
21
|
+
start = start.parent;
|
22
|
+
points.push(start);
|
23
|
+
}
|
24
|
+
var k = points.length;
|
25
|
+
while (end !== lca) {
|
26
|
+
points.splice(k, 0, end);
|
27
|
+
end = end.parent;
|
28
|
+
}
|
29
|
+
return points;
|
30
|
+
}
|
31
|
+
|
32
|
+
function d3_layout_bundleAncestors(node) {
|
33
|
+
var ancestors = [],
|
34
|
+
parent = node.parent;
|
35
|
+
while (parent != null) {
|
36
|
+
ancestors.push(node);
|
37
|
+
node = parent;
|
38
|
+
parent = parent.parent;
|
39
|
+
}
|
40
|
+
ancestors.push(node);
|
41
|
+
return ancestors;
|
42
|
+
}
|
43
|
+
|
44
|
+
function d3_layout_bundleLeastCommonAncestor(a, b) {
|
45
|
+
if (a === b) return a;
|
46
|
+
var aNodes = d3_layout_bundleAncestors(a),
|
47
|
+
bNodes = d3_layout_bundleAncestors(b),
|
48
|
+
aNode = aNodes.pop(),
|
49
|
+
bNode = bNodes.pop(),
|
50
|
+
sharedNode = null;
|
51
|
+
while (aNode === bNode) {
|
52
|
+
sharedNode = aNode;
|
53
|
+
aNode = aNodes.pop();
|
54
|
+
bNode = bNodes.pop();
|
55
|
+
}
|
56
|
+
return sharedNode;
|
57
|
+
}
|
@@ -0,0 +1,148 @@
|
|
1
|
+
d3.layout.chord = function() {
|
2
|
+
var chord = {},
|
3
|
+
chords,
|
4
|
+
groups,
|
5
|
+
matrix,
|
6
|
+
n,
|
7
|
+
padding = 0,
|
8
|
+
sortGroups,
|
9
|
+
sortSubgroups,
|
10
|
+
sortChords;
|
11
|
+
|
12
|
+
function relayout() {
|
13
|
+
var subgroups = {},
|
14
|
+
groupSums = [],
|
15
|
+
groupIndex = d3.range(n),
|
16
|
+
subgroupIndex = [],
|
17
|
+
k,
|
18
|
+
x,
|
19
|
+
x0,
|
20
|
+
i,
|
21
|
+
j;
|
22
|
+
|
23
|
+
chords = [];
|
24
|
+
groups = [];
|
25
|
+
|
26
|
+
// Compute the sum.
|
27
|
+
k = 0, i = -1; while (++i < n) {
|
28
|
+
x = 0, j = -1; while (++j < n) {
|
29
|
+
x += matrix[i][j];
|
30
|
+
}
|
31
|
+
groupSums.push(x);
|
32
|
+
subgroupIndex.push(d3.range(n));
|
33
|
+
k += x;
|
34
|
+
}
|
35
|
+
|
36
|
+
// Sort groups…
|
37
|
+
if (sortGroups) {
|
38
|
+
groupIndex.sort(function(a, b) {
|
39
|
+
return sortGroups(groupSums[a], groupSums[b]);
|
40
|
+
});
|
41
|
+
}
|
42
|
+
|
43
|
+
// Sort subgroups…
|
44
|
+
if (sortSubgroups) {
|
45
|
+
subgroupIndex.forEach(function(d, i) {
|
46
|
+
d.sort(function(a, b) {
|
47
|
+
return sortSubgroups(matrix[i][a], matrix[i][b]);
|
48
|
+
});
|
49
|
+
});
|
50
|
+
}
|
51
|
+
|
52
|
+
// Convert the sum to scaling factor for [0, 2pi].
|
53
|
+
// TODO Allow start and end angle to be specified.
|
54
|
+
// TODO Allow padding to be specified as percentage?
|
55
|
+
k = (2 * Math.PI - padding * n) / k;
|
56
|
+
|
57
|
+
// Compute the start and end angle for each group and subgroup.
|
58
|
+
x = 0, i = -1; while (++i < n) {
|
59
|
+
x0 = x, j = -1; while (++j < n) {
|
60
|
+
var di = groupIndex[i],
|
61
|
+
dj = subgroupIndex[i][j],
|
62
|
+
v = matrix[di][dj];
|
63
|
+
subgroups[di + "-" + dj] = {
|
64
|
+
index: di,
|
65
|
+
subindex: dj,
|
66
|
+
startAngle: x,
|
67
|
+
endAngle: x += v * k,
|
68
|
+
value: v
|
69
|
+
};
|
70
|
+
}
|
71
|
+
groups.push({
|
72
|
+
index: di,
|
73
|
+
startAngle: x0,
|
74
|
+
endAngle: x,
|
75
|
+
value: (x - x0) / k
|
76
|
+
});
|
77
|
+
x += padding;
|
78
|
+
}
|
79
|
+
|
80
|
+
// Generate chords for each (non-empty) subgroup-subgroup link.
|
81
|
+
i = -1; while (++i < n) {
|
82
|
+
j = i - 1; while (++j < n) {
|
83
|
+
var source = subgroups[i + "-" + j],
|
84
|
+
target = subgroups[j + "-" + i];
|
85
|
+
if (source.value || target.value) {
|
86
|
+
chords.push(source.value < target.value
|
87
|
+
? {source: target, target: source}
|
88
|
+
: {source: source, target: target});
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
if (sortChords) resort();
|
94
|
+
}
|
95
|
+
|
96
|
+
function resort() {
|
97
|
+
chords.sort(function(a, b) {
|
98
|
+
return sortChords(a.target.value, b.target.value);
|
99
|
+
});
|
100
|
+
}
|
101
|
+
|
102
|
+
chord.matrix = function(x) {
|
103
|
+
if (!arguments.length) return matrix;
|
104
|
+
n = (matrix = x) && matrix.length;
|
105
|
+
chords = groups = null;
|
106
|
+
return chord;
|
107
|
+
};
|
108
|
+
|
109
|
+
chord.padding = function(x) {
|
110
|
+
if (!arguments.length) return padding;
|
111
|
+
padding = x;
|
112
|
+
chords = groups = null;
|
113
|
+
return chord;
|
114
|
+
};
|
115
|
+
|
116
|
+
chord.sortGroups = function(x) {
|
117
|
+
if (!arguments.length) return sortGroups;
|
118
|
+
sortGroups = x;
|
119
|
+
chords = groups = null;
|
120
|
+
return chord;
|
121
|
+
};
|
122
|
+
|
123
|
+
chord.sortSubgroups = function(x) {
|
124
|
+
if (!arguments.length) return sortSubgroups;
|
125
|
+
sortSubgroups = x;
|
126
|
+
chords = null;
|
127
|
+
return chord;
|
128
|
+
};
|
129
|
+
|
130
|
+
chord.sortChords = function(x) {
|
131
|
+
if (!arguments.length) return sortChords;
|
132
|
+
sortChords = x;
|
133
|
+
if (chords) resort();
|
134
|
+
return chord;
|
135
|
+
};
|
136
|
+
|
137
|
+
chord.chords = function() {
|
138
|
+
if (!chords) relayout();
|
139
|
+
return chords;
|
140
|
+
};
|
141
|
+
|
142
|
+
chord.groups = function() {
|
143
|
+
if (!groups) relayout();
|
144
|
+
return groups;
|
145
|
+
};
|
146
|
+
|
147
|
+
return chord;
|
148
|
+
};
|
@@ -0,0 +1,77 @@
|
|
1
|
+
// Implements a hierarchical layout using the cluster (or dendogram) algorithm.
|
2
|
+
d3.layout.cluster = function() {
|
3
|
+
var hierarchy = d3.layout.hierarchy().sort(null).value(null),
|
4
|
+
separation = d3_layout_treeSeparation,
|
5
|
+
size = [1, 1]; // width, height
|
6
|
+
|
7
|
+
function cluster(d, i) {
|
8
|
+
var nodes = hierarchy.call(this, d, i),
|
9
|
+
root = nodes[0],
|
10
|
+
previousNode,
|
11
|
+
x = 0,
|
12
|
+
kx,
|
13
|
+
ky;
|
14
|
+
|
15
|
+
// First walk, computing the initial x & y values.
|
16
|
+
d3_layout_treeVisitAfter(root, function(node) {
|
17
|
+
if (node.children) {
|
18
|
+
node.x = d3_layout_clusterX(node.children);
|
19
|
+
node.y = d3_layout_clusterY(node.children);
|
20
|
+
} else {
|
21
|
+
node.x = previousNode ? x += separation(node, previousNode) : 0;
|
22
|
+
node.y = 0;
|
23
|
+
previousNode = node;
|
24
|
+
}
|
25
|
+
});
|
26
|
+
|
27
|
+
// Compute the left-most, right-most, and depth-most nodes for extents.
|
28
|
+
var left = d3_layout_clusterLeft(root),
|
29
|
+
right = d3_layout_clusterRight(root),
|
30
|
+
x0 = left.x - separation(left, right) / 2,
|
31
|
+
x1 = right.x + separation(right, left) / 2;
|
32
|
+
|
33
|
+
// Second walk, normalizing x & y to the desired size.
|
34
|
+
d3_layout_treeVisitAfter(root, function(node) {
|
35
|
+
node.x = (node.x - x0) / (x1 - x0) * size[0];
|
36
|
+
node.y = (1 - node.y / root.y) * size[1];
|
37
|
+
});
|
38
|
+
|
39
|
+
return nodes;
|
40
|
+
}
|
41
|
+
|
42
|
+
cluster.separation = function(x) {
|
43
|
+
if (!arguments.length) return separation;
|
44
|
+
separation = x;
|
45
|
+
return cluster;
|
46
|
+
};
|
47
|
+
|
48
|
+
cluster.size = function(x) {
|
49
|
+
if (!arguments.length) return size;
|
50
|
+
size = x;
|
51
|
+
return cluster;
|
52
|
+
};
|
53
|
+
|
54
|
+
return d3_layout_hierarchyRebind(cluster, hierarchy);
|
55
|
+
};
|
56
|
+
|
57
|
+
function d3_layout_clusterY(children) {
|
58
|
+
return 1 + d3.max(children, function(child) {
|
59
|
+
return child.y;
|
60
|
+
});
|
61
|
+
}
|
62
|
+
|
63
|
+
function d3_layout_clusterX(children) {
|
64
|
+
return children.reduce(function(x, child) {
|
65
|
+
return x + child.x;
|
66
|
+
}, 0) / children.length;
|
67
|
+
}
|
68
|
+
|
69
|
+
function d3_layout_clusterLeft(node) {
|
70
|
+
var children = node.children;
|
71
|
+
return children ? d3_layout_clusterLeft(children[0]) : node;
|
72
|
+
}
|
73
|
+
|
74
|
+
function d3_layout_clusterRight(node) {
|
75
|
+
var children = node.children;
|
76
|
+
return children ? d3_layout_clusterRight(children[children.length - 1]) : node;
|
77
|
+
}
|
@@ -0,0 +1,332 @@
|
|
1
|
+
// A rudimentary force layout using Gauss-Seidel.
|
2
|
+
d3.layout.force = function() {
|
3
|
+
var force = {},
|
4
|
+
event = d3.dispatch("tick"),
|
5
|
+
size = [1, 1],
|
6
|
+
drag,
|
7
|
+
alpha,
|
8
|
+
friction = .9,
|
9
|
+
linkDistance = d3_layout_forceLinkDistance,
|
10
|
+
linkStrength = d3_layout_forceLinkStrength,
|
11
|
+
charge = -30,
|
12
|
+
gravity = .1,
|
13
|
+
theta = .8,
|
14
|
+
interval,
|
15
|
+
nodes = [],
|
16
|
+
links = [],
|
17
|
+
distances,
|
18
|
+
strengths;
|
19
|
+
|
20
|
+
function repulse(node, kc) {
|
21
|
+
return function(quad, x1, y1, x2, y2) {
|
22
|
+
if (quad.point !== node) {
|
23
|
+
var dx = quad.cx - node.x,
|
24
|
+
dy = quad.cy - node.y,
|
25
|
+
dn = 1 / Math.sqrt(dx * dx + dy * dy);
|
26
|
+
|
27
|
+
/* Barnes-Hut criterion. */
|
28
|
+
if ((x2 - x1) * dn < theta) {
|
29
|
+
var k = kc * quad.count * dn * dn;
|
30
|
+
node.px -= dx * k;
|
31
|
+
node.py -= dy * k;
|
32
|
+
return true;
|
33
|
+
}
|
34
|
+
|
35
|
+
if (quad.point && isFinite(dn)) {
|
36
|
+
var k = kc * dn * dn;
|
37
|
+
node.px -= dx * k;
|
38
|
+
node.py -= dy * k;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
};
|
42
|
+
}
|
43
|
+
|
44
|
+
function tick() {
|
45
|
+
var n = nodes.length,
|
46
|
+
m = links.length,
|
47
|
+
q,
|
48
|
+
i, // current index
|
49
|
+
o, // current object
|
50
|
+
s, // current source
|
51
|
+
t, // current target
|
52
|
+
l, // current distance
|
53
|
+
k, // current force
|
54
|
+
x, // x-distance
|
55
|
+
y; // y-distance
|
56
|
+
|
57
|
+
// gauss-seidel relaxation for links
|
58
|
+
for (i = 0; i < m; ++i) {
|
59
|
+
o = links[i];
|
60
|
+
s = o.source;
|
61
|
+
t = o.target;
|
62
|
+
x = t.x - s.x;
|
63
|
+
y = t.y - s.y;
|
64
|
+
if (l = (x * x + y * y)) {
|
65
|
+
l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
|
66
|
+
x *= l;
|
67
|
+
y *= l;
|
68
|
+
t.x -= x * (k = s.weight / (t.weight + s.weight));
|
69
|
+
t.y -= y * k;
|
70
|
+
s.x += x * (k = 1 - k);
|
71
|
+
s.y += y * k;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
// apply gravity forces
|
76
|
+
if (k = alpha * gravity) {
|
77
|
+
x = size[0] / 2;
|
78
|
+
y = size[1] / 2;
|
79
|
+
i = -1; if (k) while (++i < n) {
|
80
|
+
o = nodes[i];
|
81
|
+
o.x += (x - o.x) * k;
|
82
|
+
o.y += (y - o.y) * k;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
// compute quadtree center of mass and apply charge forces
|
87
|
+
if (k = alpha * charge) {
|
88
|
+
d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes));
|
89
|
+
i = -1; while (++i < n) {
|
90
|
+
if (!(o = nodes[i]).fixed) {
|
91
|
+
q.visit(repulse(o, k));
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
// position verlet integration
|
97
|
+
i = -1; while (++i < n) {
|
98
|
+
o = nodes[i];
|
99
|
+
if (o.fixed) {
|
100
|
+
o.x = o.px;
|
101
|
+
o.y = o.py;
|
102
|
+
} else {
|
103
|
+
o.x -= (o.px - (o.px = o.x)) * friction;
|
104
|
+
o.y -= (o.py - (o.py = o.y)) * friction;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
event.tick.dispatch({type: "tick", alpha: alpha});
|
109
|
+
|
110
|
+
// simulated annealing, basically
|
111
|
+
return (alpha *= .99) < .005;
|
112
|
+
}
|
113
|
+
|
114
|
+
force.on = function(type, listener) {
|
115
|
+
event[type].add(listener);
|
116
|
+
return force;
|
117
|
+
};
|
118
|
+
|
119
|
+
force.nodes = function(x) {
|
120
|
+
if (!arguments.length) return nodes;
|
121
|
+
nodes = x;
|
122
|
+
return force;
|
123
|
+
};
|
124
|
+
|
125
|
+
force.links = function(x) {
|
126
|
+
if (!arguments.length) return links;
|
127
|
+
links = x;
|
128
|
+
return force;
|
129
|
+
};
|
130
|
+
|
131
|
+
force.size = function(x) {
|
132
|
+
if (!arguments.length) return size;
|
133
|
+
size = x;
|
134
|
+
return force;
|
135
|
+
};
|
136
|
+
|
137
|
+
force.linkDistance = function(x) {
|
138
|
+
if (!arguments.length) return linkDistance;
|
139
|
+
linkDistance = d3.functor(x);
|
140
|
+
return force;
|
141
|
+
};
|
142
|
+
|
143
|
+
// For backwards-compatibility.
|
144
|
+
force.distance = force.linkDistance;
|
145
|
+
|
146
|
+
force.linkStrength = function(x) {
|
147
|
+
if (!arguments.length) return linkStrength;
|
148
|
+
linkStrength = d3.functor(x);
|
149
|
+
return force;
|
150
|
+
};
|
151
|
+
|
152
|
+
force.friction = function(x) {
|
153
|
+
if (!arguments.length) return friction;
|
154
|
+
friction = x;
|
155
|
+
return force;
|
156
|
+
};
|
157
|
+
|
158
|
+
force.charge = function(x) {
|
159
|
+
if (!arguments.length) return charge;
|
160
|
+
charge = x;
|
161
|
+
return force;
|
162
|
+
};
|
163
|
+
|
164
|
+
force.gravity = function(x) {
|
165
|
+
if (!arguments.length) return gravity;
|
166
|
+
gravity = x;
|
167
|
+
return force;
|
168
|
+
};
|
169
|
+
|
170
|
+
force.theta = function(x) {
|
171
|
+
if (!arguments.length) return theta;
|
172
|
+
theta = x;
|
173
|
+
return force;
|
174
|
+
};
|
175
|
+
|
176
|
+
force.start = function() {
|
177
|
+
var i,
|
178
|
+
j,
|
179
|
+
n = nodes.length,
|
180
|
+
m = links.length,
|
181
|
+
w = size[0],
|
182
|
+
h = size[1],
|
183
|
+
neighbors,
|
184
|
+
o;
|
185
|
+
|
186
|
+
for (i = 0; i < n; ++i) {
|
187
|
+
(o = nodes[i]).index = i;
|
188
|
+
o.weight = 0;
|
189
|
+
}
|
190
|
+
|
191
|
+
distances = [];
|
192
|
+
strengths = [];
|
193
|
+
for (i = 0; i < m; ++i) {
|
194
|
+
o = links[i];
|
195
|
+
if (typeof o.source == "number") o.source = nodes[o.source];
|
196
|
+
if (typeof o.target == "number") o.target = nodes[o.target];
|
197
|
+
distances[i] = linkDistance.call(this, o, i);
|
198
|
+
strengths[i] = linkStrength.call(this, o, i);
|
199
|
+
++o.source.weight;
|
200
|
+
++o.target.weight;
|
201
|
+
}
|
202
|
+
|
203
|
+
for (i = 0; i < n; ++i) {
|
204
|
+
o = nodes[i];
|
205
|
+
if (isNaN(o.x)) o.x = position("x", w);
|
206
|
+
if (isNaN(o.y)) o.y = position("y", h);
|
207
|
+
if (isNaN(o.px)) o.px = o.x;
|
208
|
+
if (isNaN(o.py)) o.py = o.y;
|
209
|
+
}
|
210
|
+
|
211
|
+
// initialize node position based on first neighbor
|
212
|
+
function position(dimension, size) {
|
213
|
+
var neighbors = neighbor(i),
|
214
|
+
j = -1,
|
215
|
+
m = neighbors.length,
|
216
|
+
x;
|
217
|
+
while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
|
218
|
+
return Math.random() * size;
|
219
|
+
}
|
220
|
+
|
221
|
+
// initialize neighbors lazily
|
222
|
+
function neighbor() {
|
223
|
+
if (!neighbors) {
|
224
|
+
neighbors = [];
|
225
|
+
for (j = 0; j < n; ++j) {
|
226
|
+
neighbors[j] = [];
|
227
|
+
}
|
228
|
+
for (j = 0; j < m; ++j) {
|
229
|
+
var o = links[j];
|
230
|
+
neighbors[o.source.index].push(o.target);
|
231
|
+
neighbors[o.target.index].push(o.source);
|
232
|
+
}
|
233
|
+
}
|
234
|
+
return neighbors[i];
|
235
|
+
}
|
236
|
+
|
237
|
+
return force.resume();
|
238
|
+
};
|
239
|
+
|
240
|
+
force.resume = function() {
|
241
|
+
alpha = .1;
|
242
|
+
d3.timer(tick);
|
243
|
+
return force;
|
244
|
+
};
|
245
|
+
|
246
|
+
force.stop = function() {
|
247
|
+
alpha = 0;
|
248
|
+
return force;
|
249
|
+
};
|
250
|
+
|
251
|
+
// use `node.call(force.drag)` to make nodes draggable
|
252
|
+
force.drag = function() {
|
253
|
+
if (!drag) drag = d3.behavior.drag()
|
254
|
+
.on("dragstart", dragstart)
|
255
|
+
.on("drag", d3_layout_forceDrag)
|
256
|
+
.on("dragend", d3_layout_forceDragEnd);
|
257
|
+
|
258
|
+
this.on("mouseover.force", d3_layout_forceDragOver)
|
259
|
+
.on("mouseout.force", d3_layout_forceDragOut)
|
260
|
+
.call(drag);
|
261
|
+
};
|
262
|
+
|
263
|
+
function dragstart(d) {
|
264
|
+
d3_layout_forceDragOver(d3_layout_forceDragNode = d);
|
265
|
+
d3_layout_forceDragForce = force;
|
266
|
+
}
|
267
|
+
|
268
|
+
return force;
|
269
|
+
};
|
270
|
+
|
271
|
+
var d3_layout_forceDragForce,
|
272
|
+
d3_layout_forceDragNode;
|
273
|
+
|
274
|
+
function d3_layout_forceDragOver(d) {
|
275
|
+
d.fixed |= 2;
|
276
|
+
}
|
277
|
+
|
278
|
+
function d3_layout_forceDragOut(d) {
|
279
|
+
if (d !== d3_layout_forceDragNode) d.fixed &= 1;
|
280
|
+
}
|
281
|
+
|
282
|
+
function d3_layout_forceDragEnd() {
|
283
|
+
d3_layout_forceDrag();
|
284
|
+
d3_layout_forceDragNode.fixed &= 1;
|
285
|
+
d3_layout_forceDragForce = d3_layout_forceDragNode = null;
|
286
|
+
}
|
287
|
+
|
288
|
+
function d3_layout_forceDrag() {
|
289
|
+
d3_layout_forceDragNode.px += d3.event.dx;
|
290
|
+
d3_layout_forceDragNode.py += d3.event.dy;
|
291
|
+
d3_layout_forceDragForce.resume(); // restart annealing
|
292
|
+
}
|
293
|
+
|
294
|
+
function d3_layout_forceAccumulate(quad) {
|
295
|
+
var cx = 0,
|
296
|
+
cy = 0;
|
297
|
+
quad.count = 0;
|
298
|
+
if (!quad.leaf) {
|
299
|
+
var nodes = quad.nodes,
|
300
|
+
n = nodes.length,
|
301
|
+
i = -1,
|
302
|
+
c;
|
303
|
+
while (++i < n) {
|
304
|
+
c = nodes[i];
|
305
|
+
if (c == null) continue;
|
306
|
+
d3_layout_forceAccumulate(c);
|
307
|
+
quad.count += c.count;
|
308
|
+
cx += c.count * c.cx;
|
309
|
+
cy += c.count * c.cy;
|
310
|
+
}
|
311
|
+
}
|
312
|
+
if (quad.point) {
|
313
|
+
// jitter internal nodes that are coincident
|
314
|
+
if (!quad.leaf) {
|
315
|
+
quad.point.x += Math.random() - .5;
|
316
|
+
quad.point.y += Math.random() - .5;
|
317
|
+
}
|
318
|
+
quad.count++;
|
319
|
+
cx += quad.point.x;
|
320
|
+
cy += quad.point.y;
|
321
|
+
}
|
322
|
+
quad.cx = cx / quad.count;
|
323
|
+
quad.cy = cy / quad.count;
|
324
|
+
}
|
325
|
+
|
326
|
+
function d3_layout_forceLinkDistance(link) {
|
327
|
+
return 20;
|
328
|
+
}
|
329
|
+
|
330
|
+
function d3_layout_forceLinkStrength(link) {
|
331
|
+
return 1;
|
332
|
+
}
|