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,95 @@
|
|
1
|
+
d3.layout.pie = function() {
|
2
|
+
var value = Number,
|
3
|
+
sort = null,
|
4
|
+
startAngle = 0,
|
5
|
+
endAngle = 2 * Math.PI;
|
6
|
+
|
7
|
+
function pie(data, i) {
|
8
|
+
|
9
|
+
// Compute the start angle.
|
10
|
+
var a = +(typeof startAngle === "function"
|
11
|
+
? startAngle.apply(this, arguments)
|
12
|
+
: startAngle);
|
13
|
+
|
14
|
+
// Compute the angular range (end - start).
|
15
|
+
var k = (typeof endAngle === "function"
|
16
|
+
? endAngle.apply(this, arguments)
|
17
|
+
: endAngle) - startAngle;
|
18
|
+
|
19
|
+
// Optionally sort the data.
|
20
|
+
var index = d3.range(data.length);
|
21
|
+
if (sort != null) index.sort(function(i, j) {
|
22
|
+
return sort(data[i], data[j]);
|
23
|
+
});
|
24
|
+
|
25
|
+
// Compute the numeric values for each data element.
|
26
|
+
var values = data.map(value);
|
27
|
+
|
28
|
+
// Convert k into a scale factor from value to angle, using the sum.
|
29
|
+
k /= values.reduce(function(p, d) { return p + d; }, 0);
|
30
|
+
|
31
|
+
// Compute the arcs!
|
32
|
+
var arcs = index.map(function(i) {
|
33
|
+
return {
|
34
|
+
data: data[i],
|
35
|
+
value: d = values[i],
|
36
|
+
startAngle: a,
|
37
|
+
endAngle: a += d * k
|
38
|
+
};
|
39
|
+
});
|
40
|
+
|
41
|
+
// Return the arcs in the original data's order.
|
42
|
+
return data.map(function(d, i) {
|
43
|
+
return arcs[index[i]];
|
44
|
+
});
|
45
|
+
}
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Specifies the value function *x*, which returns a nonnegative numeric value
|
49
|
+
* for each datum. The default value function is `Number`. The value function
|
50
|
+
* is passed two arguments: the current datum and the current index.
|
51
|
+
*/
|
52
|
+
pie.value = function(x) {
|
53
|
+
if (!arguments.length) return value;
|
54
|
+
value = x;
|
55
|
+
return pie;
|
56
|
+
};
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Specifies a sort comparison operator *x*. The comparator is passed two data
|
60
|
+
* elements from the data array, a and b; it returns a negative value if a is
|
61
|
+
* less than b, a positive value if a is greater than b, and zero if a equals
|
62
|
+
* b.
|
63
|
+
*/
|
64
|
+
pie.sort = function(x) {
|
65
|
+
if (!arguments.length) return sort;
|
66
|
+
sort = x;
|
67
|
+
return pie;
|
68
|
+
};
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Specifies the overall start angle of the pie chart. Defaults to 0. The
|
72
|
+
* start angle can be specified either as a constant or as a function; in the
|
73
|
+
* case of a function, it is evaluated once per array (as opposed to per
|
74
|
+
* element).
|
75
|
+
*/
|
76
|
+
pie.startAngle = function(x) {
|
77
|
+
if (!arguments.length) return startAngle;
|
78
|
+
startAngle = x;
|
79
|
+
return pie;
|
80
|
+
};
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Specifies the overall end angle of the pie chart. Defaults to 2π. The
|
84
|
+
* end angle can be specified either as a constant or as a function; in the
|
85
|
+
* case of a function, it is evaluated once per array (as opposed to per
|
86
|
+
* element).
|
87
|
+
*/
|
88
|
+
pie.endAngle = function(x) {
|
89
|
+
if (!arguments.length) return endAngle;
|
90
|
+
endAngle = x;
|
91
|
+
return pie;
|
92
|
+
};
|
93
|
+
|
94
|
+
return pie;
|
95
|
+
};
|
@@ -0,0 +1,237 @@
|
|
1
|
+
// data is two-dimensional array of x,y; we populate y0
|
2
|
+
d3.layout.stack = function() {
|
3
|
+
var values = Object,
|
4
|
+
order = d3_layout_stackOrders["default"],
|
5
|
+
offset = d3_layout_stackOffsets["zero"],
|
6
|
+
out = d3_layout_stackOut,
|
7
|
+
x = d3_layout_stackX,
|
8
|
+
y = d3_layout_stackY;
|
9
|
+
|
10
|
+
function stack(data, index) {
|
11
|
+
|
12
|
+
// Convert series to canonical two-dimensional representation.
|
13
|
+
var series = data.map(function(d, i) {
|
14
|
+
return values.call(stack, d, i);
|
15
|
+
});
|
16
|
+
|
17
|
+
// Convert each series to canonical [[x,y]] representation.
|
18
|
+
var points = series.map(function(d, i) {
|
19
|
+
return d.map(function(v, i) {
|
20
|
+
return [x.call(stack, v, i), y.call(stack, v, i)];
|
21
|
+
});
|
22
|
+
});
|
23
|
+
|
24
|
+
// Compute the order of series, and permute them.
|
25
|
+
var orders = order.call(stack, points, index);
|
26
|
+
series = d3.permute(series, orders);
|
27
|
+
points = d3.permute(points, orders);
|
28
|
+
|
29
|
+
// Compute the baseline…
|
30
|
+
var offsets = offset.call(stack, points, index);
|
31
|
+
|
32
|
+
// And propagate it to other series.
|
33
|
+
var n = series.length,
|
34
|
+
m = series[0].length,
|
35
|
+
i,
|
36
|
+
j,
|
37
|
+
o;
|
38
|
+
for (j = 0; j < m; ++j) {
|
39
|
+
out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
|
40
|
+
for (i = 1; i < n; ++i) {
|
41
|
+
out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
return data;
|
46
|
+
}
|
47
|
+
|
48
|
+
stack.values = function(x) {
|
49
|
+
if (!arguments.length) return values;
|
50
|
+
values = x;
|
51
|
+
return stack;
|
52
|
+
};
|
53
|
+
|
54
|
+
stack.order = function(x) {
|
55
|
+
if (!arguments.length) return order;
|
56
|
+
order = typeof x === "function" ? x : d3_layout_stackOrders[x];
|
57
|
+
return stack;
|
58
|
+
};
|
59
|
+
|
60
|
+
stack.offset = function(x) {
|
61
|
+
if (!arguments.length) return offset;
|
62
|
+
offset = typeof x === "function" ? x : d3_layout_stackOffsets[x];
|
63
|
+
return stack;
|
64
|
+
};
|
65
|
+
|
66
|
+
stack.x = function(z) {
|
67
|
+
if (!arguments.length) return x;
|
68
|
+
x = z;
|
69
|
+
return stack;
|
70
|
+
};
|
71
|
+
|
72
|
+
stack.y = function(z) {
|
73
|
+
if (!arguments.length) return y;
|
74
|
+
y = z;
|
75
|
+
return stack;
|
76
|
+
};
|
77
|
+
|
78
|
+
stack.out = function(z) {
|
79
|
+
if (!arguments.length) return out;
|
80
|
+
out = z;
|
81
|
+
return stack;
|
82
|
+
};
|
83
|
+
|
84
|
+
return stack;
|
85
|
+
}
|
86
|
+
|
87
|
+
function d3_layout_stackX(d) {
|
88
|
+
return d.x;
|
89
|
+
}
|
90
|
+
|
91
|
+
function d3_layout_stackY(d) {
|
92
|
+
return d.y;
|
93
|
+
}
|
94
|
+
|
95
|
+
function d3_layout_stackOut(d, y0, y) {
|
96
|
+
d.y0 = y0;
|
97
|
+
d.y = y;
|
98
|
+
}
|
99
|
+
|
100
|
+
var d3_layout_stackOrders = {
|
101
|
+
|
102
|
+
"inside-out": function(data) {
|
103
|
+
var n = data.length,
|
104
|
+
i,
|
105
|
+
j,
|
106
|
+
max = data.map(d3_layout_stackMaxIndex),
|
107
|
+
sums = data.map(d3_layout_stackReduceSum),
|
108
|
+
index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }),
|
109
|
+
top = 0,
|
110
|
+
bottom = 0,
|
111
|
+
tops = [],
|
112
|
+
bottoms = [];
|
113
|
+
for (i = 0; i < n; ++i) {
|
114
|
+
j = index[i];
|
115
|
+
if (top < bottom) {
|
116
|
+
top += sums[j];
|
117
|
+
tops.push(j);
|
118
|
+
} else {
|
119
|
+
bottom += sums[j];
|
120
|
+
bottoms.push(j);
|
121
|
+
}
|
122
|
+
}
|
123
|
+
return bottoms.reverse().concat(tops);
|
124
|
+
},
|
125
|
+
|
126
|
+
"reverse": function(data) {
|
127
|
+
return d3.range(data.length).reverse();
|
128
|
+
},
|
129
|
+
|
130
|
+
"default": function(data) {
|
131
|
+
return d3.range(data.length);
|
132
|
+
}
|
133
|
+
|
134
|
+
};
|
135
|
+
|
136
|
+
var d3_layout_stackOffsets = {
|
137
|
+
|
138
|
+
"silhouette": function(data) {
|
139
|
+
var n = data.length,
|
140
|
+
m = data[0].length,
|
141
|
+
sums = [],
|
142
|
+
max = 0,
|
143
|
+
i,
|
144
|
+
j,
|
145
|
+
o,
|
146
|
+
y0 = [];
|
147
|
+
for (j = 0; j < m; ++j) {
|
148
|
+
for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
|
149
|
+
if (o > max) max = o;
|
150
|
+
sums.push(o);
|
151
|
+
}
|
152
|
+
for (j = 0; j < m; ++j) {
|
153
|
+
y0[j] = (max - sums[j]) / 2;
|
154
|
+
}
|
155
|
+
return y0;
|
156
|
+
},
|
157
|
+
|
158
|
+
"wiggle": function(data) {
|
159
|
+
var n = data.length,
|
160
|
+
x = data[0],
|
161
|
+
m = x.length,
|
162
|
+
max = 0,
|
163
|
+
i,
|
164
|
+
j,
|
165
|
+
k,
|
166
|
+
s1,
|
167
|
+
s2,
|
168
|
+
s3,
|
169
|
+
dx,
|
170
|
+
o,
|
171
|
+
o0,
|
172
|
+
y0 = [];
|
173
|
+
y0[0] = o = o0 = 0;
|
174
|
+
for (j = 1; j < m; ++j) {
|
175
|
+
for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
|
176
|
+
for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
|
177
|
+
for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
|
178
|
+
s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
|
179
|
+
}
|
180
|
+
s2 += s3 * data[i][j][1];
|
181
|
+
}
|
182
|
+
y0[j] = o -= s1 ? s2 / s1 * dx : 0;
|
183
|
+
if (o < o0) o0 = o;
|
184
|
+
}
|
185
|
+
for (j = 0; j < m; ++j) y0[j] -= o0;
|
186
|
+
return y0;
|
187
|
+
},
|
188
|
+
|
189
|
+
"expand": function(data) {
|
190
|
+
var n = data.length,
|
191
|
+
m = data[0].length,
|
192
|
+
k = 1 / n,
|
193
|
+
i,
|
194
|
+
j,
|
195
|
+
o,
|
196
|
+
y0 = [];
|
197
|
+
for (j = 0; j < m; ++j) {
|
198
|
+
for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
|
199
|
+
if (o) for (i = 0; i < n; i++) data[i][j][1] /= o;
|
200
|
+
else for (i = 0; i < n; i++) data[i][j][1] = k;
|
201
|
+
}
|
202
|
+
for (j = 0; j < m; ++j) y0[j] = 0;
|
203
|
+
return y0;
|
204
|
+
},
|
205
|
+
|
206
|
+
"zero": function(data) {
|
207
|
+
var j = -1,
|
208
|
+
m = data[0].length,
|
209
|
+
y0 = [];
|
210
|
+
while (++j < m) y0[j] = 0;
|
211
|
+
return y0;
|
212
|
+
}
|
213
|
+
|
214
|
+
};
|
215
|
+
|
216
|
+
function d3_layout_stackMaxIndex(array) {
|
217
|
+
var i = 1,
|
218
|
+
j = 0,
|
219
|
+
v = array[0][1],
|
220
|
+
k,
|
221
|
+
n = array.length;
|
222
|
+
for (; i < n; ++i) {
|
223
|
+
if ((k = array[i][1]) > v) {
|
224
|
+
j = i;
|
225
|
+
v = k;
|
226
|
+
}
|
227
|
+
}
|
228
|
+
return j;
|
229
|
+
}
|
230
|
+
|
231
|
+
function d3_layout_stackReduceSum(d) {
|
232
|
+
return d.reduce(d3_layout_stackSum, 0);
|
233
|
+
}
|
234
|
+
|
235
|
+
function d3_layout_stackSum(p, d) {
|
236
|
+
return p + d[1];
|
237
|
+
}
|
@@ -0,0 +1,234 @@
|
|
1
|
+
// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm
|
2
|
+
d3.layout.tree = 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 tree(d, i) {
|
8
|
+
var nodes = hierarchy.call(this, d, i),
|
9
|
+
root = nodes[0];
|
10
|
+
|
11
|
+
function firstWalk(node, previousSibling) {
|
12
|
+
var children = node.children,
|
13
|
+
layout = node._tree;
|
14
|
+
if (children && (n = children.length)) {
|
15
|
+
var n,
|
16
|
+
firstChild = children[0],
|
17
|
+
previousChild,
|
18
|
+
ancestor = firstChild,
|
19
|
+
child,
|
20
|
+
i = -1;
|
21
|
+
while (++i < n) {
|
22
|
+
child = children[i];
|
23
|
+
firstWalk(child, previousChild);
|
24
|
+
ancestor = apportion(child, previousChild, ancestor);
|
25
|
+
previousChild = child;
|
26
|
+
}
|
27
|
+
d3_layout_treeShift(node);
|
28
|
+
var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
|
29
|
+
if (previousSibling) {
|
30
|
+
layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
|
31
|
+
layout.mod = layout.prelim - midpoint;
|
32
|
+
} else {
|
33
|
+
layout.prelim = midpoint;
|
34
|
+
}
|
35
|
+
} else {
|
36
|
+
if (previousSibling) {
|
37
|
+
layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
function secondWalk(node, x) {
|
43
|
+
node.x = node._tree.prelim + x;
|
44
|
+
var children = node.children;
|
45
|
+
if (children) {
|
46
|
+
var i = -1,
|
47
|
+
n = children.length;
|
48
|
+
x += node._tree.mod;
|
49
|
+
while (++i < n) {
|
50
|
+
secondWalk(children[i], x);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
function apportion(node, previousSibling, ancestor) {
|
56
|
+
if (previousSibling) {
|
57
|
+
var vip = node,
|
58
|
+
vop = node,
|
59
|
+
vim = previousSibling,
|
60
|
+
vom = node.parent.children[0],
|
61
|
+
sip = vip._tree.mod,
|
62
|
+
sop = vop._tree.mod,
|
63
|
+
sim = vim._tree.mod,
|
64
|
+
som = vom._tree.mod,
|
65
|
+
shift;
|
66
|
+
while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
|
67
|
+
vom = d3_layout_treeLeft(vom);
|
68
|
+
vop = d3_layout_treeRight(vop);
|
69
|
+
vop._tree.ancestor = node;
|
70
|
+
shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
|
71
|
+
if (shift > 0) {
|
72
|
+
d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
|
73
|
+
sip += shift;
|
74
|
+
sop += shift;
|
75
|
+
}
|
76
|
+
sim += vim._tree.mod;
|
77
|
+
sip += vip._tree.mod;
|
78
|
+
som += vom._tree.mod;
|
79
|
+
sop += vop._tree.mod;
|
80
|
+
}
|
81
|
+
if (vim && !d3_layout_treeRight(vop)) {
|
82
|
+
vop._tree.thread = vim;
|
83
|
+
vop._tree.mod += sim - sop;
|
84
|
+
}
|
85
|
+
if (vip && !d3_layout_treeLeft(vom)) {
|
86
|
+
vom._tree.thread = vip;
|
87
|
+
vom._tree.mod += sip - som;
|
88
|
+
ancestor = node;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
return ancestor;
|
92
|
+
}
|
93
|
+
|
94
|
+
// Initialize temporary layout variables.
|
95
|
+
d3_layout_treeVisitAfter(root, function(node, previousSibling) {
|
96
|
+
node._tree = {
|
97
|
+
ancestor: node,
|
98
|
+
prelim: 0,
|
99
|
+
mod: 0,
|
100
|
+
change: 0,
|
101
|
+
shift: 0,
|
102
|
+
number: previousSibling ? previousSibling._tree.number + 1 : 0
|
103
|
+
};
|
104
|
+
});
|
105
|
+
|
106
|
+
// Compute the layout using Buchheim et al.'s algorithm.
|
107
|
+
firstWalk(root);
|
108
|
+
secondWalk(root, -root._tree.prelim);
|
109
|
+
|
110
|
+
// Compute the left-most, right-most, and depth-most nodes for extents.
|
111
|
+
var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost),
|
112
|
+
right = d3_layout_treeSearch(root, d3_layout_treeRightmost),
|
113
|
+
deep = d3_layout_treeSearch(root, d3_layout_treeDeepest),
|
114
|
+
x0 = left.x - separation(left, right) / 2,
|
115
|
+
x1 = right.x + separation(right, left) / 2,
|
116
|
+
y1 = deep.depth || 1;
|
117
|
+
|
118
|
+
// Clear temporary layout variables; transform x and y.
|
119
|
+
d3_layout_treeVisitAfter(root, function(node) {
|
120
|
+
node.x = (node.x - x0) / (x1 - x0) * size[0];
|
121
|
+
node.y = node.depth / y1 * size[1];
|
122
|
+
delete node._tree;
|
123
|
+
});
|
124
|
+
|
125
|
+
return nodes;
|
126
|
+
}
|
127
|
+
|
128
|
+
tree.separation = function(x) {
|
129
|
+
if (!arguments.length) return separation;
|
130
|
+
separation = x;
|
131
|
+
return tree;
|
132
|
+
};
|
133
|
+
|
134
|
+
tree.size = function(x) {
|
135
|
+
if (!arguments.length) return size;
|
136
|
+
size = x;
|
137
|
+
return tree;
|
138
|
+
};
|
139
|
+
|
140
|
+
return d3_layout_hierarchyRebind(tree, hierarchy);
|
141
|
+
};
|
142
|
+
|
143
|
+
function d3_layout_treeSeparation(a, b) {
|
144
|
+
return a.parent == b.parent ? 1 : 2;
|
145
|
+
}
|
146
|
+
|
147
|
+
// function d3_layout_treeSeparationRadial(a, b) {
|
148
|
+
// return (a.parent == b.parent ? 1 : 2) / a.depth;
|
149
|
+
// }
|
150
|
+
|
151
|
+
function d3_layout_treeLeft(node) {
|
152
|
+
return node.children ? node.children[0] : node._tree.thread;
|
153
|
+
}
|
154
|
+
|
155
|
+
function d3_layout_treeRight(node) {
|
156
|
+
return node.children ? node.children[node.children.length - 1] : node._tree.thread;
|
157
|
+
}
|
158
|
+
|
159
|
+
function d3_layout_treeSearch(node, compare) {
|
160
|
+
var children = node.children;
|
161
|
+
if (children) {
|
162
|
+
var child,
|
163
|
+
n = children.length,
|
164
|
+
i = -1;
|
165
|
+
while (++i < n) {
|
166
|
+
if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
|
167
|
+
node = child;
|
168
|
+
}
|
169
|
+
}
|
170
|
+
}
|
171
|
+
return node;
|
172
|
+
}
|
173
|
+
|
174
|
+
function d3_layout_treeRightmost(a, b) {
|
175
|
+
return a.x - b.x;
|
176
|
+
}
|
177
|
+
|
178
|
+
function d3_layout_treeLeftmost(a, b) {
|
179
|
+
return b.x - a.x;
|
180
|
+
}
|
181
|
+
|
182
|
+
function d3_layout_treeDeepest(a, b) {
|
183
|
+
return a.depth - b.depth;
|
184
|
+
}
|
185
|
+
|
186
|
+
function d3_layout_treeVisitAfter(node, callback) {
|
187
|
+
function visit(node, previousSibling) {
|
188
|
+
var children = node.children;
|
189
|
+
if (children) {
|
190
|
+
var child,
|
191
|
+
previousChild = null,
|
192
|
+
i = -1,
|
193
|
+
n = children.length;
|
194
|
+
while (++i < n) {
|
195
|
+
child = children[i];
|
196
|
+
visit(child, previousChild);
|
197
|
+
previousChild = child;
|
198
|
+
}
|
199
|
+
}
|
200
|
+
callback(node, previousSibling);
|
201
|
+
}
|
202
|
+
visit(node, null);
|
203
|
+
}
|
204
|
+
|
205
|
+
function d3_layout_treeShift(node) {
|
206
|
+
var shift = 0,
|
207
|
+
change = 0,
|
208
|
+
children = node.children,
|
209
|
+
i = children.length,
|
210
|
+
child;
|
211
|
+
while (--i >= 0) {
|
212
|
+
child = children[i]._tree;
|
213
|
+
child.prelim += shift;
|
214
|
+
child.mod += shift;
|
215
|
+
shift += child.shift + (change += child.change);
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
function d3_layout_treeMove(ancestor, node, shift) {
|
220
|
+
ancestor = ancestor._tree;
|
221
|
+
node = node._tree;
|
222
|
+
var change = shift / (node.number - ancestor.number);
|
223
|
+
ancestor.change += change;
|
224
|
+
node.change -= change;
|
225
|
+
node.shift += shift;
|
226
|
+
node.prelim += shift;
|
227
|
+
node.mod += shift;
|
228
|
+
}
|
229
|
+
|
230
|
+
function d3_layout_treeAncestor(vim, node, ancestor) {
|
231
|
+
return vim._tree.ancestor.parent == node.parent
|
232
|
+
? vim._tree.ancestor
|
233
|
+
: ancestor;
|
234
|
+
}
|