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 @@
|
|
1
|
+
(function(){function n(a){return a.y}function m(a){return a.x}function l(a,b){var c=b.length-1;b=b.slice().sort(d3.ascending);return d3.range(a).map(function(d){return b[~~(d*c/a)]})}function k(a){return a[1]}function j(a){return a[0]}function g(a){var b=a(0);return function(c){return Math.abs(a(c)-b)}}function f(a){return function(b){return"translate("+a(b)+",0)"}}function e(a){return a.measures}function d(a){return a.markers}function c(a){return a.ranges}function b(a){return[d3.quantile(a,.25),d3.quantile(a,.5),d3.quantile(a,.75)]}function a(a){return[0,a.length-1]}d3.chart={},d3.chart.box=function(){function k(a){a.each(function(a,b){a=a.map(g).sort(d3.ascending);var k=d3.select(this),l=a.length,m=a[0],n=a[l-1],o=a.quartiles=i(a),p=h&&h.call(this,a,b),q=p&&p.map(function(b){return a[b]}),r=p?d3.range(0,p[0]).concat(d3.range(p[1]+1,l)):d3.range(l),s=d3.scale.linear().domain(f&&f.call(this,a,b)||[m,n]).range([d,0]),t=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(s.range());this.__chart__=s;var u=k.selectAll("line.center").data(q?[q]:[]);u.enter().insert("svg:line","rect").attr("class","center").attr("x1",c/2).attr("y1",function(a){return t(a[0])}).attr("x2",c/2).attr("y2",function(a){return t(a[1])}).style("opacity",1e-6).transition().duration(e).style("opacity",1).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}),u.transition().duration(e).style("opacity",1).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}),u.exit().transition().duration(e).style("opacity",1e-6).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}).remove();var v=k.selectAll("rect.box").data([o]);v.enter().append("svg:rect").attr("class","box").attr("x",0).attr("y",function(a){return t(a[2])}).attr("width",c).attr("height",function(a){return t(a[0])-t(a[2])}).transition().duration(e).attr("y",function(a){return s(a[2])}).attr("height",function(a){return s(a[0])-s(a[2])}),v.transition().duration(e).attr("y",function(a){return s(a[2])}).attr("height",function(a){return s(a[0])-s(a[2])});var w=k.selectAll("line.median").data([o[1]]);w.enter().append("svg:line").attr("class","median").attr("x1",0).attr("y1",t).attr("x2",c).attr("y2",t).transition().duration(e).attr("y1",s).attr("y2",s),w.transition().duration(e).attr("y1",s).attr("y2",s);var x=k.selectAll("line.whisker").data(q||[]);x.enter().insert("svg:line","circle, text").attr("class","whisker").attr("x1",0).attr("y1",t).attr("x2",c).attr("y2",t).style("opacity",1e-6).transition().duration(e).attr("y1",s).attr("y2",s).style("opacity",1),x.transition().duration(e).attr("y1",s).attr("y2",s).style("opacity",1),x.exit().transition().duration(e).attr("y1",s).attr("y2",s).style("opacity",1e-6).remove();var y=k.selectAll("circle.outlier").data(r,Number);y.enter().insert("svg:circle","text").attr("class","outlier").attr("r",5).attr("cx",c/2).attr("cy",function(b){return t(a[b])}).style("opacity",1e-6).transition().duration(e).attr("cy",function(b){return s(a[b])}).style("opacity",1),y.transition().duration(e).attr("cy",function(b){return s(a[b])}).style("opacity",1),y.exit().transition().duration(e).attr("cy",function(b){return s(a[b])}).style("opacity",1e-6).remove();var z=j||s.tickFormat(8),A=k.selectAll("text.box").data(o);A.enter().append("svg:text").attr("class","box").attr("dy",".3em").attr("dx",function(a,b){return b&1?6:-6}).attr("x",function(a,b){return b&1?c:0}).attr("y",t).attr("text-anchor",function(a,b){return b&1?"start":"end"}).text(z).transition().duration(e).attr("y",s),A.transition().duration(e).text(z).attr("y",s);var B=k.selectAll("text.whisker").data(q||[]);B.enter().append("svg:text").attr("class","whisker").attr("dy",".3em").attr("dx",6).attr("x",c).attr("y",t).text(z).style("opacity",1e-6).transition().duration(e).attr("y",s).style("opacity",1),B.transition().duration(e).text(z).attr("y",s).style("opacity",1),B.exit().transition().duration(e).attr("y",s).style("opacity",1e-6).remove()}),d3.timer.flush()}var c=1,d=1,e=0,f=null,g=Number,h=a,i=b,j=null;k.width=function(a){if(!arguments.length)return c;c=a;return k},k.height=function(a){if(!arguments.length)return d;d=a;return k},k.tickFormat=function(a){if(!arguments.length)return j;j=a;return k},k.duration=function(a){if(!arguments.length)return e;e=a;return k},k.domain=function(a){if(!arguments.length)return f;f=a==null?a:d3.functor(a);return k},k.value=function(a){if(!arguments.length)return g;g=a;return k},k.whiskers=function(a){if(!arguments.length)return h;h=a;return k},k.quartiles=function(a){if(!arguments.length)return i;i=a;return k};return k},d3.chart.bullet=function(){function o(a){a.each(function(a,c){var d=i.call(this,a,c).slice().sort(d3.descending),e=j.call(this,a,c).slice().sort(d3.descending),o=k.call(this,a,c).slice().sort(d3.descending),p=d3.select(this),q=d3.scale.linear().domain([0,Math.max(d[0],e[0],o[0])]).range(b?[l,0]:[0,l]),r=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(q.range());this.__chart__=q;var s=g(r),t=g(q),u=p.selectAll("rect.range").data(d);u.enter().append("svg:rect").attr("class",function(a,b){return"range s"+b}).attr("width",s).attr("height",m).attr("x",b?r:0).transition().duration(h).attr("width",t).attr("x",b?q:0),u.transition().duration(h).attr("x",b?q:0).attr("width",t).attr("height",m);var v=p.selectAll("rect.measure").data(o);v.enter().append("svg:rect").attr("class",function(a,b){return"measure s"+b}).attr("width",s).attr("height",m/3).attr("x",b?r:0).attr("y",m/3).transition().duration(h).attr("width",t).attr("x",b?q:0),v.transition().duration(h).attr("width",t).attr("height",m/3).attr("x",b?q:0).attr("y",m/3);var w=p.selectAll("line.marker").data(e);w.enter().append("svg:line").attr("class","marker").attr("x1",r).attr("x2",r).attr("y1",m/6).attr("y2",m*5/6).transition().duration(h).attr("x1",q).attr("x2",q),w.transition().duration(h).attr("x1",q).attr("x2",q).attr("y1",m/6).attr("y2",m*5/6);var x=n||q.tickFormat(8),y=p.selectAll("g.tick").data(q.ticks(8),function(a){return this.textContent||x(a)}),z=y.enter().append("svg:g").attr("class","tick").attr("transform",f(r)).style("opacity",1e-6);z.append("svg:line").attr("y1",m).attr("y2",m*7/6),z.append("svg:text").attr("text-anchor","middle").attr("dy","1em").attr("y",m*7/6).text(x),z.transition().duration(h).attr("transform",f(q)).style("opacity",1);var A=y.transition().duration(h).attr("transform",f(q)).style("opacity",1);A.select("line").attr("y1",m).attr("y2",m*7/6),A.select("text").attr("y",m*7/6),y.exit().transition().duration(h).attr("transform",f(q)).style("opacity",1e-6).remove()}),d3.timer.flush()}var a="left",b=!1,h=0,i=c,j=d,k=e,l=380,m=30,n=null;o.orient=function(c){if(!arguments.length)return a;a=c,b=a=="right"||a=="bottom";return o},o.ranges=function(a){if(!arguments.length)return i;i=a;return o},o.markers=function(a){if(!arguments.length)return j;j=a;return o},o.measures=function(a){if(!arguments.length)return k;k=a;return o},o.width=function(a){if(!arguments.length)return l;l=a;return o},o.height=function(a){if(!arguments.length)return m;m=a;return o},o.tickFormat=function(a){if(!arguments.length)return n;n=a;return o},o.duration=function(a){if(!arguments.length)return h;h=a;return o};return o},d3.chart.horizon=function(){function n(j){j.each(function(j,k){var n=d3.select(this),o=2*a+1,p=Infinity,q=-Infinity,r=-Infinity,s,t,u,v=j.map(function(a,b){var c=d.call(this,a,b),f=e.call(this,a,b);c<p&&(p=c),c>q&&(q=c),-f>r&&(r=-f),f>r&&(r=f);return[c,f]}),z=d3.scale.linear().domain([p,q]).range([0,f]),A=d3.scale.linear().domain([0,r]).range([0,g*a]);this.__chart__?(s=this.__chart__.x,t=this.__chart__.y,u=this.__chart__.id):(s=d3.scale.linear().domain([0,Infinity]).range(z.range()),t=d3.scale.linear().domain([0,Infinity]).range(A.range()),u=++i);var B=n.selectAll("defs").data([v]),C=B.enter().append("svg:defs");C.append("svg:clipPath").attr("id","d3_chart_horizon_clip"+u).append("svg:rect").attr("width",f).attr("height",g),B.select("rect").transition().duration(l).attr("width",f).attr("height",g),C.append("svg:path").attr("id","d3_chart_horizon_path"+u).attr("d",h.interpolate(c).x(function(a){return s(a[0])}).y0(g*a).y1(function(b){return g*a-t(b[1])})).transition().duration(l).attr("d",h.x(function(a){return z(a[0])}).y1(function(b){return g*a-A(b[1])})),B.select("path").transition().duration(l).attr("d",h),n.selectAll("g").data([null]).enter().append("svg:g").attr("clip-path","url(#d3_chart_horizon_clip"+u+")");var D=b=="offset"?function(b){return"translate(0,"+(b+(b<0)-a)*g+")"}:function(b){return(b<0?"scale(1,-1)":"")+"translate(0,"+(b-a)*g+")"},E=n.select("g").selectAll("use").data(d3.range(-1,-a-1,-1).concat(d3.range(1,a+1)),Number);E.enter().append("svg:use").attr("xlink:href","#d3_chart_horizon_path"+u).attr("transform",function(a){return D(a+(a>0?1:-1))}).style("fill",m).transition().duration(l).attr("transform",D),E.transition().duration(l).attr("transform",D).style("fill",m),E.exit().transition().duration(l).attr("transform",D).remove(),this.__chart__={x:z,y:A,id:u}}),d3.timer.flush()}var a=1,b="offset",c="linear",d=j,e=k,f=960,g=40,l=0,m=d3.scale.linear().domain([-1,0,1]).range(["#d62728","#fff","#1f77b4"]);n.duration=function(a){if(!arguments.length)return l;l=+a;return n},n.bands=function(b){if(!arguments.length)return a;a=+b,m.domain([-a,0,a]);return n},n.mode=function(a){if(!arguments.length)return b;b=a+"";return n},n.colors=function(a){if(!arguments.length)return m.range();m.range(a);return n},n.interpolate=function(a){if(!arguments.length)return c;c=a+"";return n},n.x=function(a){if(!arguments.length)return d;d=a;return n},n.y=function(a){if(!arguments.length)return e;e=a;return n},n.width=function(a){if(!arguments.length)return f;f=+a;return n},n.height=function(a){if(!arguments.length)return g;g=+a;return n};return n};var h=d3.svg.area(),i=0;d3.chart.qq=function(){function i(i){i.each(function(i,j){var k=d3.select(this),m=l(f,g.call(this,i,j)),n=l(f,h.call(this,i,j)),o=d&&d.call(this,i,j)||[d3.min(m),d3.max(m)],p=d&&d.call(this,i,j)||[d3.min(n),d3.max(n)],q,r,s=d3.scale.linear().domain(o).range([0,a]),t=d3.scale.linear().domain(p).range([b,0]);this.__chart__?(q=this.__chart__.x,r=this.__chart__.y):(q=d3.scale.linear().domain([0,Infinity]).range(s.range()),r=d3.scale.linear().domain([0,Infinity]).range(t.range())),this.__chart__={x:s,y:t};var u=k.selectAll("line.diagonal").data([null]);u.enter().append("svg:line").attr("class","diagonal").attr("x1",s(p[0])).attr("y1",t(o[0])).attr("x2",s(p[1])).attr("y2",t(o[1])),u.transition().duration(c).attr("x1",s(p[0])).attr("y1",t(o[0])).attr("x2",s(p[1])).attr("y2",t(o[1]));var v=k.selectAll("circle").data(d3.range(f).map(function(a){return{x:m[a],y:n[a]}}));v.enter().append("svg:circle").attr("class","quantile").attr("r",4.5).attr("cx",function(a){return q(a.x)}).attr("cy",function(a){return r(a.y)}).style("opacity",1e-6).transition().duration(c).attr("cx",function(a){return s(a.x)}).attr("cy",function(a){return t(a.y)}).style("opacity",1),v.transition().duration(c).attr("cx",function(a){return s(a.x)}).attr("cy",function(a){return t(a.y)}).style("opacity",1),v.exit().transition().duration(c).attr("cx",function(a){return s(a.x)}).attr("cy",function(a){return t(a.y)}).style("opacity",1e-6).remove();var w=e||s.tickFormat(4),z=e||t.tickFormat(4),A=function(a){return"translate("+s(a)+","+b+")"},B=function(a){return"translate(0,"+t(a)+")"},C=k.selectAll("g.x.tick").data(s.ticks(4),function(a){return this.textContent||w(a)}),D=C.enter().append("svg:g").attr("class","x tick").attr("transform",function(a){return"translate("+q(a)+","+b+")"}).style("opacity",1e-6);D.append("svg:line").attr("y1",0).attr("y2",-6),D.append("svg:text").attr("text-anchor","middle").attr("dy","1em").text(w),D.transition().duration(c).attr("transform",A).style("opacity",1),C.transition().duration(c).attr("transform",A).style("opacity",1),C.exit().transition().duration(c).attr("transform",A).style("opacity",1e-6).remove();var E=k.selectAll("g.y.tick").data(t.ticks(4),function(a){return this.textContent||z(a)}),F=E.enter().append("svg:g").attr("class","y tick").attr("transform",function(a){return"translate(0,"+r(a)+")"}).style("opacity",1e-6);F.append("svg:line").attr("x1",0).attr("x2",6),F.append("svg:text").attr("text-anchor","end").attr("dx","-.5em").attr("dy",".3em").text(z),F.transition().duration(c).attr("transform",B).style("opacity",1),E.transition().duration(c).attr("transform",B).style("opacity",1),E.exit().transition().duration(c).attr("transform",B).style("opacity",1e-6).remove()})}var a=1,b=1,c=0,d=null,e=null,f=100,g=m,h=n;i.width=function(b){if(!arguments.length)return a;a=b;return i},i.height=function(a){if(!arguments.length)return b;b=a;return i},i.duration=function(a){if(!arguments.length)return c;c=a;return i},i.domain=function(a){if(!arguments.length)return d;d=a==null?a:d3.functor(a);return i},i.count=function(a){if(!arguments.length)return f;f=a;return i},i.x=function(a){if(!arguments.length)return g;g=a;return i},i.y=function(a){if(!arguments.length)return h;h=a;return i},i.tickFormat=function(a){if(!arguments.length)return e;e=a;return i};return i}})()
|
data/public/d3/d3.csv.js
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
(function(){d3.csv = function(url, callback) {
|
2
|
+
d3.text(url, "text/csv", function(text) {
|
3
|
+
callback(text && d3.csv.parse(text));
|
4
|
+
});
|
5
|
+
};
|
6
|
+
d3.csv.parse = function(text) {
|
7
|
+
var header;
|
8
|
+
return d3.csv.parseRows(text, function(row, i) {
|
9
|
+
if (i) {
|
10
|
+
var o = {}, j = -1, m = header.length;
|
11
|
+
while (++j < m) o[header[j]] = row[j];
|
12
|
+
return o;
|
13
|
+
} else {
|
14
|
+
header = row;
|
15
|
+
return null;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
};
|
19
|
+
|
20
|
+
d3.csv.parseRows = function(text, f) {
|
21
|
+
var EOL = {}, // sentinel value for end-of-line
|
22
|
+
EOF = {}, // sentinel value for end-of-file
|
23
|
+
rows = [], // output rows
|
24
|
+
re = /\r\n|[,\r\n]/g, // field separator regex
|
25
|
+
n = 0, // the current line number
|
26
|
+
t, // the current token
|
27
|
+
eol; // is the current token followed by EOL?
|
28
|
+
|
29
|
+
re.lastIndex = 0; // work-around bug in FF 3.6
|
30
|
+
|
31
|
+
/** @private Returns the next token. */
|
32
|
+
function token() {
|
33
|
+
if (re.lastIndex >= text.length) return EOF; // special case: end of file
|
34
|
+
if (eol) { eol = false; return EOL; } // special case: end of line
|
35
|
+
|
36
|
+
// special case: quotes
|
37
|
+
var j = re.lastIndex;
|
38
|
+
if (text.charCodeAt(j) === 34) {
|
39
|
+
var i = j;
|
40
|
+
while (i++ < text.length) {
|
41
|
+
if (text.charCodeAt(i) === 34) {
|
42
|
+
if (text.charCodeAt(i + 1) !== 34) break;
|
43
|
+
i++;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
re.lastIndex = i + 2;
|
47
|
+
var c = text.charCodeAt(i + 1);
|
48
|
+
if (c === 13) {
|
49
|
+
eol = true;
|
50
|
+
if (text.charCodeAt(i + 2) === 10) re.lastIndex++;
|
51
|
+
} else if (c === 10) {
|
52
|
+
eol = true;
|
53
|
+
}
|
54
|
+
return text.substring(j + 1, i).replace(/""/g, "\"");
|
55
|
+
}
|
56
|
+
|
57
|
+
// common case
|
58
|
+
var m = re.exec(text);
|
59
|
+
if (m) {
|
60
|
+
eol = m[0].charCodeAt(0) !== 44;
|
61
|
+
return text.substring(j, m.index);
|
62
|
+
}
|
63
|
+
re.lastIndex = text.length;
|
64
|
+
return text.substring(j);
|
65
|
+
}
|
66
|
+
|
67
|
+
while ((t = token()) !== EOF) {
|
68
|
+
var a = [];
|
69
|
+
while ((t !== EOL) && (t !== EOF)) {
|
70
|
+
a.push(t);
|
71
|
+
t = token();
|
72
|
+
}
|
73
|
+
if (f && !(a = f(a, n++))) continue;
|
74
|
+
rows.push(a);
|
75
|
+
}
|
76
|
+
|
77
|
+
return rows;
|
78
|
+
};
|
79
|
+
d3.csv.format = function(rows) {
|
80
|
+
return rows.map(d3_csv_formatRow).join("\n");
|
81
|
+
};
|
82
|
+
|
83
|
+
function d3_csv_formatRow(row) {
|
84
|
+
return row.map(d3_csv_formatValue).join(",");
|
85
|
+
}
|
86
|
+
|
87
|
+
function d3_csv_formatValue(text) {
|
88
|
+
return /[",\n]/.test(text)
|
89
|
+
? "\"" + text.replace(/\"/g, "\"\"") + "\""
|
90
|
+
: text;
|
91
|
+
}
|
92
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(){function b(a){return/[",\n]/.test(a)?'"'+a.replace(/\"/g,'""')+'"':a}function a(a){return a.map(b).join(",")}d3.csv=function(a,b){d3.text(a,"text/csv",function(a){b(a&&d3.csv.parse(a))})},d3.csv.parse=function(a){var b;return d3.csv.parseRows(a,function(a,c){if(c){var d={},e=-1,f=b.length;while(++e<f)d[b[e]]=a[e];return d}b=a;return null})},d3.csv.parseRows=function(a,b){function j(){if(f.lastIndex>=a.length)return d;if(i){i=!1;return c}var b=f.lastIndex;if(a.charCodeAt(b)===34){var e=b;while(e++<a.length)if(a.charCodeAt(e)===34){if(a.charCodeAt(e+1)!==34)break;e++}f.lastIndex=e+2;var g=a.charCodeAt(e+1);g===13?(i=!0,a.charCodeAt(e+2)===10&&f.lastIndex++):g===10&&(i=!0);return a.substring(b+1,e).replace(/""/g,'"')}var h=f.exec(a);if(h){i=h[0].charCodeAt(0)!==44;return a.substring(b,h.index)}f.lastIndex=a.length;return a.substring(b)}var c={},d={},e=[],f=/\r\n|[,\r\n]/g,g=0,h,i;f.lastIndex=0;while((h=j())!==d){var k=[];while(h!==c&&h!==d)k.push(h),h=j();if(b&&!(k=b(k,g++)))continue;e.push(k)}return e},d3.csv.format=function(b){return b.map(a).join("\n")}})()
|
data/public/d3/d3.geo.js
ADDED
@@ -0,0 +1,692 @@
|
|
1
|
+
(function(){d3.geo = {};
|
2
|
+
// TODO clip input coordinates on opposite hemisphere
|
3
|
+
d3.geo.azimuthal = function() {
|
4
|
+
var mode = "orthographic", // or stereographic
|
5
|
+
origin,
|
6
|
+
scale = 200,
|
7
|
+
translate = [480, 250],
|
8
|
+
x0,
|
9
|
+
y0,
|
10
|
+
cy0,
|
11
|
+
sy0;
|
12
|
+
|
13
|
+
function azimuthal(coordinates) {
|
14
|
+
var x1 = coordinates[0] * d3_radians - x0,
|
15
|
+
y1 = coordinates[1] * d3_radians,
|
16
|
+
cx1 = Math.cos(x1),
|
17
|
+
sx1 = Math.sin(x1),
|
18
|
+
cy1 = Math.cos(y1),
|
19
|
+
sy1 = Math.sin(y1),
|
20
|
+
k = mode === "stereographic" ? 1 / (1 + sy0 * sy1 + cy0 * cy1 * cx1) : 1,
|
21
|
+
x = k * cy1 * sx1,
|
22
|
+
y = k * (sy0 * cy1 * cx1 - cy0 * sy1);
|
23
|
+
return [
|
24
|
+
scale * x + translate[0],
|
25
|
+
scale * y + translate[1]
|
26
|
+
];
|
27
|
+
}
|
28
|
+
|
29
|
+
azimuthal.invert = function(coordinates) {
|
30
|
+
var x = (coordinates[0] - translate[0]) / scale,
|
31
|
+
y = (coordinates[1] - translate[1]) / scale,
|
32
|
+
p = Math.sqrt(x * x + y * y),
|
33
|
+
c = mode === "stereographic" ? 2 * Math.atan(p) : Math.asin(p),
|
34
|
+
sc = Math.sin(c),
|
35
|
+
cc = Math.cos(c);
|
36
|
+
return [
|
37
|
+
(x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_radians,
|
38
|
+
Math.asin(cc * sy0 - (y * sc * cy0) / p) / d3_radians
|
39
|
+
];
|
40
|
+
};
|
41
|
+
|
42
|
+
azimuthal.mode = function(x) {
|
43
|
+
if (!arguments.length) return mode;
|
44
|
+
mode = x + "";
|
45
|
+
return azimuthal;
|
46
|
+
};
|
47
|
+
|
48
|
+
azimuthal.origin = function(x) {
|
49
|
+
if (!arguments.length) return origin;
|
50
|
+
origin = x;
|
51
|
+
x0 = origin[0] * d3_radians;
|
52
|
+
y0 = origin[1] * d3_radians;
|
53
|
+
cy0 = Math.cos(y0);
|
54
|
+
sy0 = Math.sin(y0);
|
55
|
+
return azimuthal;
|
56
|
+
};
|
57
|
+
|
58
|
+
azimuthal.scale = function(x) {
|
59
|
+
if (!arguments.length) return scale;
|
60
|
+
scale = +x;
|
61
|
+
return azimuthal;
|
62
|
+
};
|
63
|
+
|
64
|
+
azimuthal.translate = function(x) {
|
65
|
+
if (!arguments.length) return translate;
|
66
|
+
translate = [+x[0], +x[1]];
|
67
|
+
return azimuthal;
|
68
|
+
};
|
69
|
+
|
70
|
+
return azimuthal.origin([0, 0]);
|
71
|
+
};
|
72
|
+
// Derived from Tom Carden's Albers implementation for Protovis.
|
73
|
+
// http://gist.github.com/476238
|
74
|
+
// http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html
|
75
|
+
|
76
|
+
d3.geo.albers = function() {
|
77
|
+
var origin = [-98, 38],
|
78
|
+
parallels = [29.5, 45.5],
|
79
|
+
scale = 1000,
|
80
|
+
translate = [480, 250],
|
81
|
+
lng0, // d3_radians * origin[0]
|
82
|
+
n,
|
83
|
+
C,
|
84
|
+
p0;
|
85
|
+
|
86
|
+
function albers(coordinates) {
|
87
|
+
var t = n * (d3_radians * coordinates[0] - lng0),
|
88
|
+
p = Math.sqrt(C - 2 * n * Math.sin(d3_radians * coordinates[1])) / n;
|
89
|
+
return [
|
90
|
+
scale * p * Math.sin(t) + translate[0],
|
91
|
+
scale * (p * Math.cos(t) - p0) + translate[1]
|
92
|
+
];
|
93
|
+
}
|
94
|
+
|
95
|
+
albers.invert = function(coordinates) {
|
96
|
+
var x = (coordinates[0] - translate[0]) / scale,
|
97
|
+
y = (coordinates[1] - translate[1]) / scale,
|
98
|
+
p0y = p0 + y,
|
99
|
+
t = Math.atan2(x, p0y),
|
100
|
+
p = Math.sqrt(x * x + p0y * p0y);
|
101
|
+
return [
|
102
|
+
(lng0 + t / n) / d3_radians,
|
103
|
+
Math.asin((C - p * p * n * n) / (2 * n)) / d3_radians
|
104
|
+
];
|
105
|
+
};
|
106
|
+
|
107
|
+
function reload() {
|
108
|
+
var phi1 = d3_radians * parallels[0],
|
109
|
+
phi2 = d3_radians * parallels[1],
|
110
|
+
lat0 = d3_radians * origin[1],
|
111
|
+
s = Math.sin(phi1),
|
112
|
+
c = Math.cos(phi1);
|
113
|
+
lng0 = d3_radians * origin[0];
|
114
|
+
n = .5 * (s + Math.sin(phi2));
|
115
|
+
C = c * c + 2 * n * s;
|
116
|
+
p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n;
|
117
|
+
return albers;
|
118
|
+
}
|
119
|
+
|
120
|
+
albers.origin = function(x) {
|
121
|
+
if (!arguments.length) return origin;
|
122
|
+
origin = [+x[0], +x[1]];
|
123
|
+
return reload();
|
124
|
+
};
|
125
|
+
|
126
|
+
albers.parallels = function(x) {
|
127
|
+
if (!arguments.length) return parallels;
|
128
|
+
parallels = [+x[0], +x[1]];
|
129
|
+
return reload();
|
130
|
+
};
|
131
|
+
|
132
|
+
albers.scale = function(x) {
|
133
|
+
if (!arguments.length) return scale;
|
134
|
+
scale = +x;
|
135
|
+
return albers;
|
136
|
+
};
|
137
|
+
|
138
|
+
albers.translate = function(x) {
|
139
|
+
if (!arguments.length) return translate;
|
140
|
+
translate = [+x[0], +x[1]];
|
141
|
+
return albers;
|
142
|
+
};
|
143
|
+
|
144
|
+
return reload();
|
145
|
+
};
|
146
|
+
|
147
|
+
// A composite projection for the United States, 960x500. The set of standard
|
148
|
+
// parallels for each region comes from USGS, which is published here:
|
149
|
+
// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers
|
150
|
+
// TODO allow the composite projection to be rescaled?
|
151
|
+
d3.geo.albersUsa = function() {
|
152
|
+
var lower48 = d3.geo.albers();
|
153
|
+
|
154
|
+
var alaska = d3.geo.albers()
|
155
|
+
.origin([-160, 60])
|
156
|
+
.parallels([55, 65]);
|
157
|
+
|
158
|
+
var hawaii = d3.geo.albers()
|
159
|
+
.origin([-160, 20])
|
160
|
+
.parallels([8, 18]);
|
161
|
+
|
162
|
+
var puertoRico = d3.geo.albers()
|
163
|
+
.origin([-60, 10])
|
164
|
+
.parallels([8, 18]);
|
165
|
+
|
166
|
+
function albersUsa(coordinates) {
|
167
|
+
var lon = coordinates[0],
|
168
|
+
lat = coordinates[1];
|
169
|
+
return (lat > 50 ? alaska
|
170
|
+
: lon < -140 ? hawaii
|
171
|
+
: lat < 21 ? puertoRico
|
172
|
+
: lower48)(coordinates);
|
173
|
+
}
|
174
|
+
|
175
|
+
albersUsa.scale = function(x) {
|
176
|
+
if (!arguments.length) return lower48.scale();
|
177
|
+
lower48.scale(x);
|
178
|
+
alaska.scale(x * .6);
|
179
|
+
hawaii.scale(x);
|
180
|
+
puertoRico.scale(x * 1.5);
|
181
|
+
return albersUsa.translate(lower48.translate());
|
182
|
+
};
|
183
|
+
|
184
|
+
albersUsa.translate = function(x) {
|
185
|
+
if (!arguments.length) return lower48.translate();
|
186
|
+
var dz = lower48.scale() / 1000,
|
187
|
+
dx = x[0],
|
188
|
+
dy = x[1];
|
189
|
+
lower48.translate(x);
|
190
|
+
alaska.translate([dx - 400 * dz, dy + 170 * dz]);
|
191
|
+
hawaii.translate([dx - 190 * dz, dy + 200 * dz]);
|
192
|
+
puertoRico.translate([dx + 580 * dz, dy + 430 * dz]);
|
193
|
+
return albersUsa;
|
194
|
+
};
|
195
|
+
|
196
|
+
return albersUsa.scale(lower48.scale());
|
197
|
+
};
|
198
|
+
|
199
|
+
var d3_radians = Math.PI / 180;
|
200
|
+
d3.geo.mercator = function() {
|
201
|
+
var scale = 500,
|
202
|
+
translate = [480, 250];
|
203
|
+
|
204
|
+
function mercator(coordinates) {
|
205
|
+
var x = coordinates[0] / 360,
|
206
|
+
y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_radians / 2)) / d3_radians) / 360;
|
207
|
+
return [
|
208
|
+
scale * x + translate[0],
|
209
|
+
scale * Math.max(-.5, Math.min(.5, y)) + translate[1]
|
210
|
+
];
|
211
|
+
}
|
212
|
+
|
213
|
+
mercator.invert = function(coordinates) {
|
214
|
+
var x = (coordinates[0] - translate[0]) / scale,
|
215
|
+
y = (coordinates[1] - translate[1]) / scale;
|
216
|
+
return [
|
217
|
+
360 * x,
|
218
|
+
2 * Math.atan(Math.exp(-360 * y * d3_radians)) / d3_radians - 90
|
219
|
+
];
|
220
|
+
};
|
221
|
+
|
222
|
+
mercator.scale = function(x) {
|
223
|
+
if (!arguments.length) return scale;
|
224
|
+
scale = +x;
|
225
|
+
return mercator;
|
226
|
+
};
|
227
|
+
|
228
|
+
mercator.translate = function(x) {
|
229
|
+
if (!arguments.length) return translate;
|
230
|
+
translate = [+x[0], +x[1]];
|
231
|
+
return mercator;
|
232
|
+
};
|
233
|
+
|
234
|
+
return mercator;
|
235
|
+
};
|
236
|
+
/**
|
237
|
+
* Returns a function that, given a GeoJSON object (e.g., a feature), returns
|
238
|
+
* the corresponding SVG path. The function can be customized by overriding the
|
239
|
+
* projection. Point features are mapped to circles with a default radius of
|
240
|
+
* 4.5px; the radius can be specified either as a constant or a function that
|
241
|
+
* is evaluated per object.
|
242
|
+
*/
|
243
|
+
d3.geo.path = function() {
|
244
|
+
var pointRadius = 4.5,
|
245
|
+
pointCircle = d3_path_circle(pointRadius),
|
246
|
+
projection = d3.geo.albersUsa();
|
247
|
+
|
248
|
+
function path(d, i) {
|
249
|
+
if (typeof pointRadius === "function") {
|
250
|
+
pointCircle = d3_path_circle(pointRadius.apply(this, arguments));
|
251
|
+
}
|
252
|
+
return d3_geo_pathType(pathTypes, d);
|
253
|
+
}
|
254
|
+
|
255
|
+
function project(coordinates) {
|
256
|
+
return projection(coordinates).join(",");
|
257
|
+
}
|
258
|
+
|
259
|
+
var pathTypes = {
|
260
|
+
|
261
|
+
FeatureCollection: function(f) {
|
262
|
+
var path = [],
|
263
|
+
features = f.features,
|
264
|
+
i = -1, // features.index
|
265
|
+
n = features.length;
|
266
|
+
while (++i < n) path.push(d3_geo_pathType(pathTypes, features[i].geometry));
|
267
|
+
return path.join("");
|
268
|
+
},
|
269
|
+
|
270
|
+
Feature: function(f) {
|
271
|
+
return d3_geo_pathType(pathTypes, f.geometry);
|
272
|
+
},
|
273
|
+
|
274
|
+
Point: function(o) {
|
275
|
+
return "M" + project(o.coordinates) + pointCircle;
|
276
|
+
},
|
277
|
+
|
278
|
+
MultiPoint: function(o) {
|
279
|
+
var path = [],
|
280
|
+
coordinates = o.coordinates,
|
281
|
+
i = -1, // coordinates.index
|
282
|
+
n = coordinates.length;
|
283
|
+
while (++i < n) path.push("M", project(coordinates[i]), pointCircle);
|
284
|
+
return path.join("");
|
285
|
+
},
|
286
|
+
|
287
|
+
LineString: function(o) {
|
288
|
+
var path = ["M"],
|
289
|
+
coordinates = o.coordinates,
|
290
|
+
i = -1, // coordinates.index
|
291
|
+
n = coordinates.length;
|
292
|
+
while (++i < n) path.push(project(coordinates[i]), "L");
|
293
|
+
path.pop();
|
294
|
+
return path.join("");
|
295
|
+
},
|
296
|
+
|
297
|
+
MultiLineString: function(o) {
|
298
|
+
var path = [],
|
299
|
+
coordinates = o.coordinates,
|
300
|
+
i = -1, // coordinates.index
|
301
|
+
n = coordinates.length,
|
302
|
+
subcoordinates, // coordinates[i]
|
303
|
+
j, // subcoordinates.index
|
304
|
+
m; // subcoordinates.length
|
305
|
+
while (++i < n) {
|
306
|
+
subcoordinates = coordinates[i];
|
307
|
+
j = -1;
|
308
|
+
m = subcoordinates.length;
|
309
|
+
path.push("M");
|
310
|
+
while (++j < m) path.push(project(subcoordinates[j]), "L");
|
311
|
+
path.pop();
|
312
|
+
}
|
313
|
+
return path.join("");
|
314
|
+
},
|
315
|
+
|
316
|
+
Polygon: function(o) {
|
317
|
+
var path = [],
|
318
|
+
coordinates = o.coordinates,
|
319
|
+
i = -1, // coordinates.index
|
320
|
+
n = coordinates.length,
|
321
|
+
subcoordinates, // coordinates[i]
|
322
|
+
j, // subcoordinates.index
|
323
|
+
m; // subcoordinates.length
|
324
|
+
while (++i < n) {
|
325
|
+
subcoordinates = coordinates[i];
|
326
|
+
j = -1;
|
327
|
+
m = subcoordinates.length;
|
328
|
+
path.push("M");
|
329
|
+
while (++j < m) path.push(project(subcoordinates[j]), "L");
|
330
|
+
path[path.length - 1] = "Z";
|
331
|
+
}
|
332
|
+
return path.join("");
|
333
|
+
},
|
334
|
+
|
335
|
+
MultiPolygon: function(o) {
|
336
|
+
var path = [],
|
337
|
+
coordinates = o.coordinates,
|
338
|
+
i = -1, // coordinates index
|
339
|
+
n = coordinates.length,
|
340
|
+
subcoordinates, // coordinates[i]
|
341
|
+
j, // subcoordinates index
|
342
|
+
m, // subcoordinates.length
|
343
|
+
subsubcoordinates, // subcoordinates[j]
|
344
|
+
k, // subsubcoordinates index
|
345
|
+
p; // subsubcoordinates.length
|
346
|
+
while (++i < n) {
|
347
|
+
subcoordinates = coordinates[i];
|
348
|
+
j = -1;
|
349
|
+
m = subcoordinates.length;
|
350
|
+
while (++j < m) {
|
351
|
+
subsubcoordinates = subcoordinates[j];
|
352
|
+
k = -1;
|
353
|
+
p = subsubcoordinates.length - 1;
|
354
|
+
path.push("M");
|
355
|
+
while (++k < p) path.push(project(subsubcoordinates[k]), "L");
|
356
|
+
path[path.length - 1] = "Z";
|
357
|
+
}
|
358
|
+
}
|
359
|
+
return path.join("");
|
360
|
+
},
|
361
|
+
|
362
|
+
GeometryCollection: function(o) {
|
363
|
+
var path = [],
|
364
|
+
geometries = o.geometries,
|
365
|
+
i = -1, // geometries index
|
366
|
+
n = geometries.length;
|
367
|
+
while (++i < n) path.push(d3_geo_pathType(pathTypes, geometries[i]));
|
368
|
+
return path.join("");
|
369
|
+
}
|
370
|
+
|
371
|
+
};
|
372
|
+
|
373
|
+
var areaTypes = {
|
374
|
+
|
375
|
+
FeatureCollection: function(f) {
|
376
|
+
var area = 0,
|
377
|
+
features = f.features,
|
378
|
+
i = -1, // features.index
|
379
|
+
n = features.length;
|
380
|
+
while (++i < n) area += d3_geo_pathType(areaTypes, features[i]);
|
381
|
+
return area;
|
382
|
+
},
|
383
|
+
|
384
|
+
Feature: function(f) {
|
385
|
+
return d3_geo_pathType(areaTypes, f.geometry);
|
386
|
+
},
|
387
|
+
|
388
|
+
Point: d3_geo_pathZero,
|
389
|
+
MultiPoint: d3_geo_pathZero,
|
390
|
+
LineString: d3_geo_pathZero,
|
391
|
+
MultiLineString: d3_geo_pathZero,
|
392
|
+
|
393
|
+
Polygon: function(o) {
|
394
|
+
return polygonArea(o.coordinates);
|
395
|
+
},
|
396
|
+
|
397
|
+
MultiPolygon: function(o) {
|
398
|
+
var sum = 0,
|
399
|
+
coordinates = o.coordinates,
|
400
|
+
i = -1, // coordinates index
|
401
|
+
n = coordinates.length;
|
402
|
+
while (++i < n) sum += polygonArea(coordinates[i]);
|
403
|
+
return sum;
|
404
|
+
},
|
405
|
+
|
406
|
+
GeometryCollection: function(o) {
|
407
|
+
var sum = 0,
|
408
|
+
geometries = o.geometries,
|
409
|
+
i = -1, // geometries index
|
410
|
+
n = geometries.length;
|
411
|
+
while (++i < n) sum += d3_geo_pathType(areaTypes, geometries[i]);
|
412
|
+
return sum;
|
413
|
+
}
|
414
|
+
|
415
|
+
};
|
416
|
+
|
417
|
+
function polygonArea(coordinates) {
|
418
|
+
var sum = area(coordinates[0]), // exterior ring
|
419
|
+
i = 0, // coordinates.index
|
420
|
+
n = coordinates.length;
|
421
|
+
while (++i < n) sum -= area(coordinates[i]); // holes
|
422
|
+
return sum;
|
423
|
+
}
|
424
|
+
|
425
|
+
function polygonCentroid(coordinates) {
|
426
|
+
var polygon = d3.geom.polygon(coordinates[0].map(projection)), // exterior ring
|
427
|
+
centroid = polygon.centroid(1),
|
428
|
+
x = centroid[0],
|
429
|
+
y = centroid[1],
|
430
|
+
z = Math.abs(polygon.area()),
|
431
|
+
i = 0, // coordinates index
|
432
|
+
n = coordinates.length;
|
433
|
+
while (++i < n) {
|
434
|
+
polygon = d3.geom.polygon(coordinates[i].map(projection)); // holes
|
435
|
+
centroid = polygon.centroid(1);
|
436
|
+
x -= centroid[0];
|
437
|
+
y -= centroid[1];
|
438
|
+
z -= Math.abs(polygon.area());
|
439
|
+
}
|
440
|
+
return [x, y, 6 * z]; // weighted centroid
|
441
|
+
}
|
442
|
+
|
443
|
+
var centroidTypes = {
|
444
|
+
|
445
|
+
// TODO FeatureCollection
|
446
|
+
// TODO Point
|
447
|
+
// TODO MultiPoint
|
448
|
+
// TODO LineString
|
449
|
+
// TODO MultiLineString
|
450
|
+
// TODO GeometryCollection
|
451
|
+
|
452
|
+
Feature: function(f) {
|
453
|
+
return d3_geo_pathType(centroidTypes, f.geometry);
|
454
|
+
},
|
455
|
+
|
456
|
+
Polygon: function(o) {
|
457
|
+
var centroid = polygonCentroid(o.coordinates);
|
458
|
+
return [centroid[0] / centroid[2], centroid[1] / centroid[2]];
|
459
|
+
},
|
460
|
+
|
461
|
+
MultiPolygon: function(o) {
|
462
|
+
var area = 0,
|
463
|
+
coordinates = o.coordinates,
|
464
|
+
centroid,
|
465
|
+
x = 0,
|
466
|
+
y = 0,
|
467
|
+
z = 0,
|
468
|
+
i = -1, // coordinates index
|
469
|
+
n = coordinates.length;
|
470
|
+
while (++i < n) {
|
471
|
+
centroid = polygonCentroid(coordinates[i]);
|
472
|
+
x += centroid[0];
|
473
|
+
y += centroid[1];
|
474
|
+
z += centroid[2];
|
475
|
+
}
|
476
|
+
return [x / z, y / z];
|
477
|
+
}
|
478
|
+
|
479
|
+
};
|
480
|
+
|
481
|
+
|
482
|
+
function area(coordinates) {
|
483
|
+
return Math.abs(d3.geom.polygon(coordinates.map(projection)).area());
|
484
|
+
}
|
485
|
+
|
486
|
+
path.projection = function(x) {
|
487
|
+
projection = x;
|
488
|
+
return path;
|
489
|
+
};
|
490
|
+
|
491
|
+
path.area = function(d) {
|
492
|
+
return d3_geo_pathType(areaTypes, d);
|
493
|
+
};
|
494
|
+
|
495
|
+
path.centroid = function(d) {
|
496
|
+
return d3_geo_pathType(centroidTypes, d);
|
497
|
+
};
|
498
|
+
|
499
|
+
path.pointRadius = function(x) {
|
500
|
+
if (typeof x === "function") pointRadius = x;
|
501
|
+
else {
|
502
|
+
pointRadius = +x;
|
503
|
+
pointCircle = d3_path_circle(pointRadius);
|
504
|
+
}
|
505
|
+
return path;
|
506
|
+
};
|
507
|
+
|
508
|
+
return path;
|
509
|
+
};
|
510
|
+
|
511
|
+
function d3_path_circle(radius) {
|
512
|
+
return "m0," + radius
|
513
|
+
+ "a" + radius + "," + radius + " 0 1,1 0," + (-2 * radius)
|
514
|
+
+ "a" + radius + "," + radius + " 0 1,1 0," + (+2 * radius)
|
515
|
+
+ "z";
|
516
|
+
}
|
517
|
+
|
518
|
+
function d3_geo_pathZero() {
|
519
|
+
return 0;
|
520
|
+
}
|
521
|
+
|
522
|
+
function d3_geo_pathType(types, o) {
|
523
|
+
return o && o.type in types ? types[o.type](o) : "";
|
524
|
+
}
|
525
|
+
/**
|
526
|
+
* Given a GeoJSON object, returns the corresponding bounding box. The bounding
|
527
|
+
* box is represented by a two-dimensional array: [[left, bottom], [right,
|
528
|
+
* top]], where left is the minimum longitude, bottom is the minimum latitude,
|
529
|
+
* right is maximum longitude, and top is the maximum latitude.
|
530
|
+
*/
|
531
|
+
d3.geo.bounds = function(feature) {
|
532
|
+
var left = Infinity,
|
533
|
+
bottom = Infinity,
|
534
|
+
right = -Infinity,
|
535
|
+
top = -Infinity;
|
536
|
+
d3_geo_bounds(feature, function(x, y) {
|
537
|
+
if (x < left) left = x;
|
538
|
+
if (x > right) right = x;
|
539
|
+
if (y < bottom) bottom = y;
|
540
|
+
if (y > top) top = y;
|
541
|
+
});
|
542
|
+
return [[left, bottom], [right, top]];
|
543
|
+
};
|
544
|
+
|
545
|
+
function d3_geo_bounds(o, f) {
|
546
|
+
if (o.type in d3_geo_boundsTypes) d3_geo_boundsTypes[o.type](o, f);
|
547
|
+
}
|
548
|
+
|
549
|
+
var d3_geo_boundsTypes = {
|
550
|
+
Feature: d3_geo_boundsFeature,
|
551
|
+
FeatureCollection: d3_geo_boundsFeatureCollection,
|
552
|
+
LineString: d3_geo_boundsLineString,
|
553
|
+
MultiLineString: d3_geo_boundsMultiLineString,
|
554
|
+
MultiPoint: d3_geo_boundsLineString,
|
555
|
+
MultiPolygon: d3_geo_boundsMultiPolygon,
|
556
|
+
Point: d3_geo_boundsPoint,
|
557
|
+
Polygon: d3_geo_boundsPolygon
|
558
|
+
};
|
559
|
+
|
560
|
+
function d3_geo_boundsFeature(o, f) {
|
561
|
+
d3_geo_bounds(o.geometry, f);
|
562
|
+
}
|
563
|
+
|
564
|
+
function d3_geo_boundsFeatureCollection(o, f) {
|
565
|
+
for (var a = o.features, i = 0, n = a.length; i < n; i++) {
|
566
|
+
d3_geo_bounds(a[i].geometry, f);
|
567
|
+
}
|
568
|
+
}
|
569
|
+
|
570
|
+
function d3_geo_boundsLineString(o, f) {
|
571
|
+
for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
|
572
|
+
f.apply(null, a[i]);
|
573
|
+
}
|
574
|
+
}
|
575
|
+
|
576
|
+
function d3_geo_boundsMultiLineString(o, f) {
|
577
|
+
for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
|
578
|
+
for (var b = a[i], j = 0, m = b.length; j < m; j++) {
|
579
|
+
f.apply(null, b[j]);
|
580
|
+
}
|
581
|
+
}
|
582
|
+
}
|
583
|
+
|
584
|
+
function d3_geo_boundsMultiPolygon(o, f) {
|
585
|
+
for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
|
586
|
+
for (var b = a[i][0], j = 0, m = b.length; j < m; j++) {
|
587
|
+
f.apply(null, b[j]);
|
588
|
+
}
|
589
|
+
}
|
590
|
+
}
|
591
|
+
|
592
|
+
function d3_geo_boundsPoint(o, f) {
|
593
|
+
f.apply(null, o.coordinates);
|
594
|
+
}
|
595
|
+
|
596
|
+
function d3_geo_boundsPolygon(o, f) {
|
597
|
+
for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) {
|
598
|
+
f.apply(null, a[i]);
|
599
|
+
}
|
600
|
+
}
|
601
|
+
// From http://williams.best.vwh.net/avform.htm#Intermediate
|
602
|
+
d3.geo.greatCircle = function() {
|
603
|
+
var source = d3_geo_greatCircleSource,
|
604
|
+
target = d3_geo_greatCircleTarget,
|
605
|
+
n = 100,
|
606
|
+
radius = 6371; // Mean radius of Earth, in km.
|
607
|
+
// TODO: breakAtDateLine?
|
608
|
+
|
609
|
+
function greatCircle(d, i) {
|
610
|
+
var from = source.call(this, d, i),
|
611
|
+
to = target.call(this, d, i),
|
612
|
+
x0 = from[0] * d3_radians,
|
613
|
+
y0 = from[1] * d3_radians,
|
614
|
+
x1 = to[0] * d3_radians,
|
615
|
+
y1 = to[1] * d3_radians,
|
616
|
+
cx0 = Math.cos(x0), sx0 = Math.sin(x0),
|
617
|
+
cy0 = Math.cos(y0), sy0 = Math.sin(y0),
|
618
|
+
cx1 = Math.cos(x1), sx1 = Math.sin(x1),
|
619
|
+
cy1 = Math.cos(y1), sy1 = Math.sin(y1),
|
620
|
+
d = Math.acos(sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)),
|
621
|
+
sd = Math.sin(d),
|
622
|
+
f = d / (n - 1),
|
623
|
+
e = -f,
|
624
|
+
path = [],
|
625
|
+
i = -1;
|
626
|
+
|
627
|
+
while (++i < n) {
|
628
|
+
e += f;
|
629
|
+
var A = Math.sin(d - e) / sd,
|
630
|
+
B = Math.sin(e) / sd,
|
631
|
+
x = A * cy0 * cx0 + B * cy1 * cx1,
|
632
|
+
y = A * cy0 * sx0 + B * cy1 * sx1,
|
633
|
+
z = A * sy0 + B * sy1;
|
634
|
+
path[i] = [
|
635
|
+
Math.atan2(y, x) / d3_radians,
|
636
|
+
Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_radians
|
637
|
+
];
|
638
|
+
}
|
639
|
+
|
640
|
+
return path;
|
641
|
+
}
|
642
|
+
|
643
|
+
greatCircle.source = function(x) {
|
644
|
+
if (!arguments.length) return source;
|
645
|
+
source = x;
|
646
|
+
return greatCircle;
|
647
|
+
};
|
648
|
+
|
649
|
+
greatCircle.target = function(x) {
|
650
|
+
if (!arguments.length) return target;
|
651
|
+
target = x;
|
652
|
+
return greatCircle;
|
653
|
+
};
|
654
|
+
|
655
|
+
greatCircle.n = function(x) {
|
656
|
+
if (!arguments.length) return n;
|
657
|
+
n = +x;
|
658
|
+
return greatCircle;
|
659
|
+
};
|
660
|
+
|
661
|
+
greatCircle.radius = function(x) {
|
662
|
+
if (!arguments.length) return radius;
|
663
|
+
radius = +x;
|
664
|
+
return greatCircle;
|
665
|
+
};
|
666
|
+
|
667
|
+
// Haversine formula for great-circle distance.
|
668
|
+
greatCircle.distance = function(d, i) {
|
669
|
+
var from = source.call(this, d, i),
|
670
|
+
to = target.call(this, d, i),
|
671
|
+
x0 = from[0] * d3_radians,
|
672
|
+
y0 = from[1] * d3_radians,
|
673
|
+
x1 = to[0] * d3_radians,
|
674
|
+
y1 = to[1] * d3_radians,
|
675
|
+
sy = Math.sin((y1 - y0) / 2),
|
676
|
+
sx = Math.sin((x1 - x0) / 2),
|
677
|
+
a = sy * sy + Math.cos(y0) * Math.cos(y1) * sx * sx;
|
678
|
+
|
679
|
+
return radius * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
680
|
+
};
|
681
|
+
|
682
|
+
return greatCircle;
|
683
|
+
};
|
684
|
+
|
685
|
+
function d3_geo_greatCircleSource(d) {
|
686
|
+
return d.source;
|
687
|
+
}
|
688
|
+
|
689
|
+
function d3_geo_greatCircleTarget(d) {
|
690
|
+
return d.target;
|
691
|
+
}
|
692
|
+
})();
|