From 5217badbaf360702d2877c6cd8a1dcb33f363ffc Mon Sep 17 00:00:00 2001 From: dsc Date: Wed, 22 Feb 2012 15:19:23 -0800 Subject: [PATCH] Adds d3.js -- http://mbostock.github.com/d3 --- static/vendor/d3 | 1 + static/vendor/d3-2.7.5/.gitignore | 3 + static/vendor/d3-2.7.5/.npmignore | 4 + static/vendor/d3-2.7.5/LICENSE | 26 + static/vendor/d3-2.7.5/Makefile | 273 + static/vendor/d3-2.7.5/README.md | 51 + static/vendor/d3-2.7.5/d3.chart.js | 984 +++ static/vendor/d3-2.7.5/d3.chart.min.js | 1 + static/vendor/d3-2.7.5/d3.csv.js | 92 + static/vendor/d3-2.7.5/d3.csv.min.js | 1 + static/vendor/d3-2.7.5/d3.geo.js | 938 +++ static/vendor/d3-2.7.5/d3.geo.min.js | 1 + static/vendor/d3-2.7.5/d3.geom.js | 835 +++ static/vendor/d3-2.7.5/d3.geom.min.js | 1 + static/vendor/d3-2.7.5/d3.js | 4765 ++++++++++++++ static/vendor/d3-2.7.5/d3.layout.js | 1882 ++++++ static/vendor/d3-2.7.5/d3.layout.min.js | 1 + static/vendor/d3-2.7.5/d3.min.js | 2 + static/vendor/d3-2.7.5/d3.time.js | 726 +++ static/vendor/d3-2.7.5/d3.time.min.js | 1 + static/vendor/d3-2.7.5/examples/albers/albers.html | 168 + .../vendor/d3-2.7.5/examples/area/area-radial.html | 48 + static/vendor/d3-2.7.5/examples/area/area.html | 113 + .../d3-2.7.5/examples/axis/axis-alternating.html | 50 + .../d3-2.7.5/examples/axis/axis-ggplot2.html | 68 + .../d3-2.7.5/examples/axis/axis-multiples.html | 117 + .../d3-2.7.5/examples/axis/axis-orientations.html | 63 + .../d3-2.7.5/examples/axis/axis-transition.html | 153 + .../d3-2.7.5/examples/azimuthal/azimuthal.css | 21 + .../d3-2.7.5/examples/azimuthal/azimuthal.html | 99 + .../d3-2.7.5/examples/azimuthal/azimuthal.js | 29 + .../d3-2.7.5/examples/bar/bar-hierarchy.html | 223 + static/vendor/d3-2.7.5/examples/bar/bar.html | 101 + .../vendor/d3-2.7.5/examples/bar/sample-data.csv | 53 + static/vendor/d3-2.7.5/examples/bonne/bonne.html | 159 + static/vendor/d3-2.7.5/examples/box/box.css | 4 + static/vendor/d3-2.7.5/examples/box/box.html | 19 + static/vendor/d3-2.7.5/examples/box/box.js | 68 + .../d3-2.7.5/examples/brush/brush-ordinal.html | 92 + static/vendor/d3-2.7.5/examples/brush/brush-x.html | 92 + static/vendor/d3-2.7.5/examples/brush/brush-y.html | 91 + static/vendor/d3-2.7.5/examples/brush/brush.html | 98 + static/vendor/d3-2.7.5/examples/bubble/bubble.css | 8 + static/vendor/d3-2.7.5/examples/bubble/bubble.html | 14 + static/vendor/d3-2.7.5/examples/bubble/bubble.js | 46 + static/vendor/d3-2.7.5/examples/bullet/bullet.css | 10 + static/vendor/d3-2.7.5/examples/bullet/bullet.html | 18 + static/vendor/d3-2.7.5/examples/bullet/bullet.js | 53 + .../vendor/d3-2.7.5/examples/bullet/bullets.json | 7 + .../d3-2.7.5/examples/bundle/bundle-radial.css | 9 + .../d3-2.7.5/examples/bundle/bundle-radial.html | 15 + .../d3-2.7.5/examples/bundle/bundle-radial.js | 50 + .../d3-2.7.5/examples/bundle/bundle-treemap.css | 14 + .../d3-2.7.5/examples/bundle/bundle-treemap.html | 16 + .../d3-2.7.5/examples/bundle/bundle-treemap.js | 53 + static/vendor/d3-2.7.5/examples/bundle/packages.js | 49 + static/vendor/d3-2.7.5/examples/button.css | 35 + .../vendor/d3-2.7.5/examples/calendar/calendar.css | 15 + .../d3-2.7.5/examples/calendar/dji-area.html | 120 + static/vendor/d3-2.7.5/examples/calendar/dji.csv | 5233 +++++++++++++++ static/vendor/d3-2.7.5/examples/calendar/dji.html | 15 + static/vendor/d3-2.7.5/examples/calendar/dji.js | 69 + static/vendor/d3-2.7.5/examples/calendar/vix.csv | 5231 +++++++++++++++ static/vendor/d3-2.7.5/examples/calendar/vix.html | 15 + static/vendor/d3-2.7.5/examples/calendar/vix.js | 69 + .../d3-2.7.5/examples/cartogram/cartogram.css | 20 + .../d3-2.7.5/examples/cartogram/cartogram.html | 15 + .../d3-2.7.5/examples/cartogram/cartogram.js | 51 + .../vendor/d3-2.7.5/examples/cartogram/demers.css | 9 + .../vendor/d3-2.7.5/examples/cartogram/demers.html | 16 + .../vendor/d3-2.7.5/examples/cartogram/demers.js | 79 + .../vendor/d3-2.7.5/examples/cartogram/dorling.css | 9 + .../d3-2.7.5/examples/cartogram/dorling.html | 16 + .../vendor/d3-2.7.5/examples/cartogram/dorling.js | 80 + .../d3-2.7.5/examples/chord/chord-flare.html | 109 + static/vendor/d3-2.7.5/examples/chord/chord.css | 9 + static/vendor/d3-2.7.5/examples/chord/chord.html | 14 + static/vendor/d3-2.7.5/examples/chord/chord.js | 98 + .../examples/choropleth/choropleth-area.html | 51 + .../examples/choropleth/choropleth-bounds.html | 46 + .../d3-2.7.5/examples/choropleth/choropleth.css | 16 + .../d3-2.7.5/examples/choropleth/choropleth.html | 15 + .../d3-2.7.5/examples/choropleth/choropleth.js | 38 + .../d3-2.7.5/examples/choropleth/unemployment.json | 1 + static/vendor/d3-2.7.5/examples/clock/clock.css | 23 + static/vendor/d3-2.7.5/examples/clock/clock.html | 17 + static/vendor/d3-2.7.5/examples/clock/clock.js | 87 + .../d3-2.7.5/examples/cluster/cluster-radial.html | 14 + .../d3-2.7.5/examples/cluster/cluster-radial.js | 39 + .../vendor/d3-2.7.5/examples/cluster/cluster.css | 15 + .../vendor/d3-2.7.5/examples/cluster/cluster.html | 14 + static/vendor/d3-2.7.5/examples/cluster/cluster.js | 39 + .../vendor/d3-2.7.5/examples/contour/contour.html | 108 + .../examples/crimea/crimea-stacked-area.html | 109 + .../examples/crimea/crimea-stacked-bar.html | 98 + static/vendor/d3-2.7.5/examples/crimea/crimea.csv | 24 + static/vendor/d3-2.7.5/examples/custom/custom.html | 83 + static/vendor/d3-2.7.5/examples/data/README.md | 13 + static/vendor/d3-2.7.5/examples/data/faithful.json | 8 + .../d3-2.7.5/examples/data/flare-imports.json | 222 + static/vendor/d3-2.7.5/examples/data/flare.json | 380 ++ static/vendor/d3-2.7.5/examples/data/morley.csv | 101 + static/vendor/d3-2.7.5/examples/data/sample.csv | 2 + static/vendor/d3-2.7.5/examples/data/sample.html | 5 + static/vendor/d3-2.7.5/examples/data/sample.json | 1 + static/vendor/d3-2.7.5/examples/data/sample.txt | 1 + static/vendor/d3-2.7.5/examples/data/sample.xml | 4 + static/vendor/d3-2.7.5/examples/data/stocks.csv | 807 +++ .../vendor/d3-2.7.5/examples/data/unemployment.csv | 1709 +++++ .../vendor/d3-2.7.5/examples/data/us-borders.json | 1 + .../vendor/d3-2.7.5/examples/data/us-counties.json | 3216 +++++++++ .../d3-2.7.5/examples/data/us-state-centroids.json | 54 + .../vendor/d3-2.7.5/examples/data/us-states.json | 54 + .../d3-2.7.5/examples/data/world-countries.json | 179 + .../d3-2.7.5/examples/delaunay/delaunay.html | 44 + static/vendor/d3-2.7.5/examples/donut/donut.html | 124 + static/vendor/d3-2.7.5/examples/dot/dot.html | 103 + static/vendor/d3-2.7.5/examples/drag/drag.html | 44 + static/vendor/d3-2.7.5/examples/force/README | 10 + .../d3-2.7.5/examples/force/force-bounds.html | 70 + .../d3-2.7.5/examples/force/force-cluster.html | 249 + .../d3-2.7.5/examples/force/force-collapsible.html | 144 + .../d3-2.7.5/examples/force/force-dynamic.html | 118 + .../vendor/d3-2.7.5/examples/force/force-map.html | 104 + .../d3-2.7.5/examples/force/force-multi-foci.html | 68 + static/vendor/d3-2.7.5/examples/force/force.css | 9 + static/vendor/d3-2.7.5/examples/force/force.html | 14 + static/vendor/d3-2.7.5/examples/force/force.js | 50 + .../vendor/d3-2.7.5/examples/force/miserables.json | 1 + .../d3-2.7.5/examples/great-arc/great-arc.html | 78 + .../examples/hello-world/hello-data-key.html | 60 + .../hello-world/hello-data-nested-key.html | 75 + .../examples/hello-world/hello-data-nested.html | 77 + .../d3-2.7.5/examples/hello-world/hello-data.html | 46 + .../d3-2.7.5/examples/hello-world/hello-event.html | 53 + .../examples/hello-world/hello-node-key.html | 25 + .../d3-2.7.5/examples/hello-world/hello-order.html | 25 + .../d3-2.7.5/examples/hello-world/hello-sort.html | 75 + .../examples/hello-world/hello-transform.html | 41 + .../hello-world/hello-transition-undefined.html | 43 + .../examples/hello-world/hello-transition.html | 47 + .../hello-world/hello-webkit-transition.html | 64 + .../examples/hello-world/select-enter-add.html | 29 + .../examples/hello-world/selectAll-enter-add.html | 20 + .../d3-2.7.5/examples/histogram/histogram.html | 80 + .../vendor/d3-2.7.5/examples/horizon/horizon.css | 9 + .../vendor/d3-2.7.5/examples/horizon/horizon.html | 25 + static/vendor/d3-2.7.5/examples/horizon/horizon.js | 43 + .../d3-2.7.5/examples/horizon/unemployment.json | 1 + static/vendor/d3-2.7.5/examples/hull/hull.html | 75 + static/vendor/d3-2.7.5/examples/kde/kde.css | 9 + static/vendor/d3-2.7.5/examples/kde/kde.html | 14 + static/vendor/d3-2.7.5/examples/kde/kde.js | 40 + static/vendor/d3-2.7.5/examples/line/line.css | 22 + static/vendor/d3-2.7.5/examples/line/line.html | 11 + static/vendor/d3-2.7.5/examples/line/line.js | 63 + .../d3-2.7.5/examples/marimekko/marimekko.html | 116 + .../d3-2.7.5/examples/marimekko/marimekko.json | 18 + static/vendor/d3-2.7.5/examples/marker/marker.html | 169 + .../d3-2.7.5/examples/mercator/mercator.html | 133 + static/vendor/d3-2.7.5/examples/moire/moire.html | 53 + .../d3-2.7.5/examples/node-canvas/us-counties.js | 70 + static/vendor/d3-2.7.5/examples/pack/pack.css | 15 + static/vendor/d3-2.7.5/examples/pack/pack.html | 14 + static/vendor/d3-2.7.5/examples/pack/pack.js | 33 + static/vendor/d3-2.7.5/examples/parallel/cars.csv | 407 ++ .../d3-2.7.5/examples/parallel/parallel.html | 134 + .../examples/partition/partition-icicle-zoom.html | 59 + .../examples/partition/partition-icicle.html | 45 + .../partition/partition-sunburst-zoom.html | 72 + .../examples/partition/partition-sunburst.html | 21 + .../examples/partition/partition-sunburst.js | 72 + .../d3-2.7.5/examples/pie/pie-transition.html | 69 + static/vendor/d3-2.7.5/examples/pie/pie.html | 51 + .../d3-2.7.5/examples/population/population.css | 28 + .../d3-2.7.5/examples/population/population.csv | 571 ++ .../d3-2.7.5/examples/population/population.html | 13 + .../d3-2.7.5/examples/population/population.js | 126 + static/vendor/d3-2.7.5/examples/qq/qq.css | 18 + static/vendor/d3-2.7.5/examples/qq/qq.html | 21 + static/vendor/d3-2.7.5/examples/qq/qq.js | 66 + static/vendor/d3-2.7.5/examples/qq/stats.js | 28 + static/vendor/d3-2.7.5/examples/qq/turkers.json | 1 + .../d3-2.7.5/examples/quadtree/quadtree.html | 114 + static/vendor/d3-2.7.5/examples/rollup/rollup.html | 236 + .../d3-2.7.5/examples/showreel/showreel.html | 661 ++ static/vendor/d3-2.7.5/examples/sizzle/sizzle.html | 27 + static/vendor/d3-2.7.5/examples/sort/sort.css | 4 + static/vendor/d3-2.7.5/examples/sort/sort.html | 12 + static/vendor/d3-2.7.5/examples/sort/sort.js | 112 + static/vendor/d3-2.7.5/examples/spline/spline.css | 30 + static/vendor/d3-2.7.5/examples/spline/spline.html | 14 + static/vendor/d3-2.7.5/examples/spline/spline.js | 110 + static/vendor/d3-2.7.5/examples/splom/flowers.json | 1 + static/vendor/d3-2.7.5/examples/splom/splom.css | 49 + static/vendor/d3-2.7.5/examples/splom/splom.html | 13 + static/vendor/d3-2.7.5/examples/splom/splom.js | 119 + static/vendor/d3-2.7.5/examples/stream/stack.css | 7 + static/vendor/d3-2.7.5/examples/stream/stack.html | 22 + static/vendor/d3-2.7.5/examples/stream/stack.js | 119 + static/vendor/d3-2.7.5/examples/stream/stream.css | 3 + static/vendor/d3-2.7.5/examples/stream/stream.html | 19 + static/vendor/d3-2.7.5/examples/stream/stream.js | 42 + .../d3-2.7.5/examples/stream/stream_layers.js | 33 + .../vendor/d3-2.7.5/examples/superformula/dot.html | 104 + .../d3-2.7.5/examples/superformula/explorer.html | 120 + .../examples/superformula/superformula.html | 70 + .../d3-2.7.5/examples/superformula/superformula.js | 98 + .../d3-2.7.5/examples/symbol-map/symbol-map.html | 67 + static/vendor/d3-2.7.5/examples/touch/touch.html | 65 + .../vendor/d3-2.7.5/examples/transform/test.html | 85 + .../d3-2.7.5/examples/transform/transform.html | 60 + .../d3-2.7.5/examples/tree/tree-dynamic.html | 104 + .../d3-2.7.5/examples/tree/tree-interactive.html | 169 + .../vendor/d3-2.7.5/examples/tree/tree-radial.html | 14 + .../vendor/d3-2.7.5/examples/tree/tree-radial.js | 40 + static/vendor/d3-2.7.5/examples/tree/tree.css | 15 + static/vendor/d3-2.7.5/examples/tree/tree.html | 14 + static/vendor/d3-2.7.5/examples/tree/tree.js | 39 + .../d3-2.7.5/examples/treemap/treemap-svg.html | 22 + .../d3-2.7.5/examples/treemap/treemap-svg.js | 34 + .../vendor/d3-2.7.5/examples/treemap/treemap.css | 8 + .../vendor/d3-2.7.5/examples/treemap/treemap.html | 22 + static/vendor/d3-2.7.5/examples/treemap/treemap.js | 53 + static/vendor/d3-2.7.5/examples/voroboids/boid.js | 235 + .../d3-2.7.5/examples/voroboids/voroboids.css | 15 + .../d3-2.7.5/examples/voroboids/voroboids.html | 14 + .../d3-2.7.5/examples/voroboids/voroboids.js | 65 + .../vendor/d3-2.7.5/examples/voronoi/voronoi.css | 16 + .../vendor/d3-2.7.5/examples/voronoi/voronoi.html | 15 + static/vendor/d3-2.7.5/examples/voronoi/voronoi.js | 34 + .../examples/zoom-pan/zoom-pan-transform.html | 96 + .../d3-2.7.5/examples/zoom-pan/zoom-pan.html | 120 + static/vendor/d3-2.7.5/examples/zoom/sp500.csv | 124 + static/vendor/d3-2.7.5/examples/zoom/zoom.html | 133 + static/vendor/d3-2.7.5/index.js | 26 + static/vendor/d3-2.7.5/lib/colorbrewer/LICENSE | 38 + .../d3-2.7.5/lib/colorbrewer/colorbrewer.css | 1327 ++++ .../vendor/d3-2.7.5/lib/colorbrewer/colorbrewer.js | 32 + static/vendor/d3-2.7.5/lib/jit/LICENSE | 27 + static/vendor/d3-2.7.5/lib/jquery-ui/LICENSE | 25 + .../ui-bg_diagonals-thick_18_b81900_40x40.png | Bin 0 -> 260 bytes .../ui-bg_diagonals-thick_20_666666_40x40.png | Bin 0 -> 251 bytes .../images/ui-bg_flat_10_000000_40x100.png | Bin 0 -> 178 bytes .../images/ui-bg_glass_100_f6f6f6_1x400.png | Bin 0 -> 104 bytes .../images/ui-bg_glass_100_fdf5ce_1x400.png | Bin 0 -> 125 bytes .../images/ui-bg_glass_65_ffffff_1x400.png | Bin 0 -> 105 bytes .../images/ui-bg_gloss-wave_35_f6a828_500x100.png | Bin 0 -> 3762 bytes .../ui-bg_highlight-soft_100_eeeeee_1x100.png | Bin 0 -> 90 bytes .../ui-bg_highlight-soft_75_ffe45c_1x100.png | Bin 0 -> 129 bytes .../jquery-ui/images/ui-icons_222222_256x240.png | Bin 0 -> 4369 bytes .../jquery-ui/images/ui-icons_228ef1_256x240.png | Bin 0 -> 4369 bytes .../jquery-ui/images/ui-icons_ef8c08_256x240.png | Bin 0 -> 4369 bytes .../jquery-ui/images/ui-icons_ffd27a_256x240.png | Bin 0 -> 4369 bytes .../jquery-ui/images/ui-icons_ffffff_256x240.png | Bin 0 -> 4369 bytes static/vendor/d3-2.7.5/lib/jquery-ui/jquery-ui.css | 318 + .../vendor/d3-2.7.5/lib/jquery-ui/jquery-ui.min.js | 83 + static/vendor/d3-2.7.5/lib/jquery/LICENSE | 20 + static/vendor/d3-2.7.5/lib/jquery/jquery.js | 6883 ++++++++++++++++++++ static/vendor/d3-2.7.5/lib/jquery/jquery.min.js | 166 + static/vendor/d3-2.7.5/lib/polymaps/LICENSE | 28 + static/vendor/d3-2.7.5/lib/protovis/LICENSE | 27 + static/vendor/d3-2.7.5/lib/science/LICENSE | 26 + static/vendor/d3-2.7.5/lib/science/science.js | 225 + static/vendor/d3-2.7.5/lib/science/science.lin.js | 27 + .../vendor/d3-2.7.5/lib/science/science.lin.min.js | 1 + static/vendor/d3-2.7.5/lib/science/science.min.js | 1 + .../vendor/d3-2.7.5/lib/science/science.stats.js | 720 ++ .../d3-2.7.5/lib/science/science.stats.min.js | 1 + static/vendor/d3-2.7.5/lib/sizzle/LICENSE | 24 + static/vendor/d3-2.7.5/lib/sizzle/sizzle.js | 1376 ++++ static/vendor/d3-2.7.5/lib/sizzle/sizzle.min.js | 28 + static/vendor/d3-2.7.5/package.json | 33 + static/vendor/d3-2.7.5/src/behavior/behavior.js | 1 + static/vendor/d3-2.7.5/src/behavior/drag.js | 125 + static/vendor/d3-2.7.5/src/behavior/zoom.js | 242 + static/vendor/d3-2.7.5/src/chart/box.js | 297 + static/vendor/d3-2.7.5/src/chart/bullet.js | 237 + static/vendor/d3-2.7.5/src/chart/chart.js | 1 + static/vendor/d3-2.7.5/src/chart/horizon.js | 203 + static/vendor/d3-2.7.5/src/chart/qq.js | 245 + static/vendor/d3-2.7.5/src/compat/date.js | 3 + static/vendor/d3-2.7.5/src/compat/style.js | 9 + static/vendor/d3-2.7.5/src/core/array.js | 29 + static/vendor/d3-2.7.5/src/core/ascending.js | 3 + static/vendor/d3-2.7.5/src/core/bisect.js | 38 + static/vendor/d3-2.7.5/src/core/collapse.js | 3 + static/vendor/d3-2.7.5/src/core/core.js | 1 + static/vendor/d3-2.7.5/src/core/descending.js | 3 + static/vendor/d3-2.7.5/src/core/dispatch.js | 61 + static/vendor/d3-2.7.5/src/core/ease.js | 128 + static/vendor/d3-2.7.5/src/core/entries.js | 5 + static/vendor/d3-2.7.5/src/core/event.js | 6 + static/vendor/d3-2.7.5/src/core/extent.js | 21 + static/vendor/d3-2.7.5/src/core/first.js | 13 + static/vendor/d3-2.7.5/src/core/format.js | 100 + static/vendor/d3-2.7.5/src/core/formatPrefix.js | 20 + static/vendor/d3-2.7.5/src/core/functor.js | 3 + static/vendor/d3-2.7.5/src/core/hsl.js | 63 + static/vendor/d3-2.7.5/src/core/html.js | 10 + static/vendor/d3-2.7.5/src/core/interpolate.js | 230 + static/vendor/d3-2.7.5/src/core/json.js | 5 + static/vendor/d3-2.7.5/src/core/keys.js | 5 + static/vendor/d3-2.7.5/src/core/last.js | 13 + static/vendor/d3-2.7.5/src/core/max.js | 14 + static/vendor/d3-2.7.5/src/core/mean.js | 13 + static/vendor/d3-2.7.5/src/core/median.js | 5 + static/vendor/d3-2.7.5/src/core/merge.js | 3 + static/vendor/d3-2.7.5/src/core/min.js | 14 + static/vendor/d3-2.7.5/src/core/nest.js | 87 + static/vendor/d3-2.7.5/src/core/noop.js | 1 + static/vendor/d3-2.7.5/src/core/ns.js | 17 + static/vendor/d3-2.7.5/src/core/number.js | 3 + static/vendor/d3-2.7.5/src/core/permute.js | 7 + static/vendor/d3-2.7.5/src/core/quantile.js | 8 + static/vendor/d3-2.7.5/src/core/random.js | 15 + static/vendor/d3-2.7.5/src/core/range.js | 24 + static/vendor/d3-2.7.5/src/core/rebind.js | 16 + static/vendor/d3-2.7.5/src/core/requote.js | 5 + static/vendor/d3-2.7.5/src/core/rgb.js | 287 + static/vendor/d3-2.7.5/src/core/round.js | 5 + .../vendor/d3-2.7.5/src/core/selection-append.js | 15 + static/vendor/d3-2.7.5/src/core/selection-attr.js | 44 + static/vendor/d3-2.7.5/src/core/selection-call.js | 13 + .../vendor/d3-2.7.5/src/core/selection-classed.js | 61 + static/vendor/d3-2.7.5/src/core/selection-data.js | 110 + static/vendor/d3-2.7.5/src/core/selection-each.js | 9 + static/vendor/d3-2.7.5/src/core/selection-empty.js | 3 + .../d3-2.7.5/src/core/selection-enter-select.js | 24 + static/vendor/d3-2.7.5/src/core/selection-enter.js | 11 + .../vendor/d3-2.7.5/src/core/selection-filter.js | 26 + static/vendor/d3-2.7.5/src/core/selection-html.js | 7 + .../vendor/d3-2.7.5/src/core/selection-insert.js | 20 + static/vendor/d3-2.7.5/src/core/selection-map.js | 5 + static/vendor/d3-2.7.5/src/core/selection-node.js | 9 + static/vendor/d3-2.7.5/src/core/selection-on.js | 34 + static/vendor/d3-2.7.5/src/core/selection-order.js | 11 + .../vendor/d3-2.7.5/src/core/selection-property.js | 23 + .../vendor/d3-2.7.5/src/core/selection-remove.js | 9 + static/vendor/d3-2.7.5/src/core/selection-root.js | 18 + .../vendor/d3-2.7.5/src/core/selection-select.js | 30 + .../d3-2.7.5/src/core/selection-selectAll.js | 24 + static/vendor/d3-2.7.5/src/core/selection-sort.js | 12 + static/vendor/d3-2.7.5/src/core/selection-style.js | 26 + static/vendor/d3-2.7.5/src/core/selection-text.js | 7 + .../d3-2.7.5/src/core/selection-transition.js | 14 + static/vendor/d3-2.7.5/src/core/selection.js | 25 + static/vendor/d3-2.7.5/src/core/split.js | 21 + static/vendor/d3-2.7.5/src/core/sum.js | 14 + static/vendor/d3-2.7.5/src/core/text.js | 10 + static/vendor/d3-2.7.5/src/core/this.js | 3 + static/vendor/d3-2.7.5/src/core/timer.js | 104 + static/vendor/d3-2.7.5/src/core/transform.js | 60 + static/vendor/d3-2.7.5/src/core/transition-attr.js | 23 + .../vendor/d3-2.7.5/src/core/transition-delay.js | 6 + .../d3-2.7.5/src/core/transition-duration.js | 6 + static/vendor/d3-2.7.5/src/core/transition-each.js | 9 + .../vendor/d3-2.7.5/src/core/transition-remove.js | 6 + .../vendor/d3-2.7.5/src/core/transition-select.js | 22 + .../d3-2.7.5/src/core/transition-selectAll.js | 22 + .../vendor/d3-2.7.5/src/core/transition-style.js | 14 + static/vendor/d3-2.7.5/src/core/transition-text.js | 7 + .../d3-2.7.5/src/core/transition-transition.js | 3 + static/vendor/d3-2.7.5/src/core/transition.js | 125 + static/vendor/d3-2.7.5/src/core/transpose.js | 3 + static/vendor/d3-2.7.5/src/core/uninterpolate.js | 9 + static/vendor/d3-2.7.5/src/core/values.js | 5 + static/vendor/d3-2.7.5/src/core/xhr.js | 11 + static/vendor/d3-2.7.5/src/core/xml.js | 10 + static/vendor/d3-2.7.5/src/core/zip.js | 13 + static/vendor/d3-2.7.5/src/csv/csv.js | 5 + static/vendor/d3-2.7.5/src/csv/format.js | 13 + static/vendor/d3-2.7.5/src/csv/parse.js | 73 + static/vendor/d3-2.7.5/src/end.js | 1 + static/vendor/d3-2.7.5/src/externs.js | 6 + static/vendor/d3-2.7.5/src/geo/albers.js | 126 + static/vendor/d3-2.7.5/src/geo/azimuthal.js | 80 + static/vendor/d3-2.7.5/src/geo/bonne.js | 70 + static/vendor/d3-2.7.5/src/geo/bounds.js | 83 + static/vendor/d3-2.7.5/src/geo/circle.js | 146 + static/vendor/d3-2.7.5/src/geo/equirectangular.js | 36 + static/vendor/d3-2.7.5/src/geo/geo.js | 3 + static/vendor/d3-2.7.5/src/geo/greatArc.js | 80 + static/vendor/d3-2.7.5/src/geo/greatCircle.js | 1 + static/vendor/d3-2.7.5/src/geo/mercator.js | 36 + static/vendor/d3-2.7.5/src/geo/path.js | 271 + static/vendor/d3-2.7.5/src/geo/type.js | 5 + static/vendor/d3-2.7.5/src/geom/contour.js | 78 + static/vendor/d3-2.7.5/src/geom/delaunay.js | 31 + static/vendor/d3-2.7.5/src/geom/geom.js | 1 + static/vendor/d3-2.7.5/src/geom/hull.js | 98 + static/vendor/d3-2.7.5/src/geom/polygon.js | 88 + static/vendor/d3-2.7.5/src/geom/quadtree.js | 129 + static/vendor/d3-2.7.5/src/geom/voronoi.js | 409 ++ static/vendor/d3-2.7.5/src/layout/bundle.js | 57 + static/vendor/d3-2.7.5/src/layout/chord.js | 153 + static/vendor/d3-2.7.5/src/layout/cluster.js | 79 + static/vendor/d3-2.7.5/src/layout/force.js | 342 + static/vendor/d3-2.7.5/src/layout/hierarchy.js | 120 + static/vendor/d3-2.7.5/src/layout/histogram.js | 102 + static/vendor/d3-2.7.5/src/layout/layout.js | 1 + static/vendor/d3-2.7.5/src/layout/pack.js | 195 + static/vendor/d3-2.7.5/src/layout/partition.js | 48 + static/vendor/d3-2.7.5/src/layout/pie.js | 93 + static/vendor/d3-2.7.5/src/layout/stack.js | 237 + static/vendor/d3-2.7.5/src/layout/tree.js | 237 + static/vendor/d3-2.7.5/src/layout/treemap.js | 217 + static/vendor/d3-2.7.5/src/package.js | 21 + static/vendor/d3-2.7.5/src/scale/bilinear.js | 7 + static/vendor/d3-2.7.5/src/scale/category.js | 54 + static/vendor/d3-2.7.5/src/scale/linear.js | 110 + static/vendor/d3-2.7.5/src/scale/log.js | 85 + static/vendor/d3-2.7.5/src/scale/nice.js | 24 + static/vendor/d3-2.7.5/src/scale/ordinal.js | 81 + static/vendor/d3-2.7.5/src/scale/polylinear.js | 22 + static/vendor/d3-2.7.5/src/scale/pow.js | 54 + static/vendor/d3-2.7.5/src/scale/quantile.js | 43 + static/vendor/d3-2.7.5/src/scale/quantize.js | 36 + static/vendor/d3-2.7.5/src/scale/scale.js | 10 + static/vendor/d3-2.7.5/src/scale/sqrt.js | 3 + static/vendor/d3-2.7.5/src/start.js | 1 + static/vendor/d3-2.7.5/src/svg/arc.js | 95 + static/vendor/d3-2.7.5/src/svg/area-radial.js | 10 + static/vendor/d3-2.7.5/src/svg/area.js | 89 + static/vendor/d3-2.7.5/src/svg/axis.js | 212 + static/vendor/d3-2.7.5/src/svg/brush.js | 336 + static/vendor/d3-2.7.5/src/svg/chord.js | 99 + static/vendor/d3-2.7.5/src/svg/diagonal-radial.js | 22 + static/vendor/d3-2.7.5/src/svg/diagonal.js | 38 + static/vendor/d3-2.7.5/src/svg/line-radial.js | 22 + static/vendor/d3-2.7.5/src/svg/line.js | 415 ++ static/vendor/d3-2.7.5/src/svg/mouse.js | 29 + static/vendor/d3-2.7.5/src/svg/svg.js | 1 + static/vendor/d3-2.7.5/src/svg/symbol.js | 98 + static/vendor/d3-2.7.5/src/svg/touches.js | 9 + static/vendor/d3-2.7.5/src/time/day.js | 7 + static/vendor/d3-2.7.5/src/time/days.js | 11 + static/vendor/d3-2.7.5/src/time/format-iso.js | 13 + static/vendor/d3-2.7.5/src/time/format-utc.js | 53 + static/vendor/d3-2.7.5/src/time/format.js | 327 + static/vendor/d3-2.7.5/src/time/hour.js | 8 + static/vendor/d3-2.7.5/src/time/hours.js | 11 + static/vendor/d3-2.7.5/src/time/minute.js | 5 + static/vendor/d3-2.7.5/src/time/minutes.js | 11 + static/vendor/d3-2.7.5/src/time/month.js | 7 + static/vendor/d3-2.7.5/src/time/months.js | 11 + static/vendor/d3-2.7.5/src/time/range.js | 16 + static/vendor/d3-2.7.5/src/time/scale-utc.js | 54 + static/vendor/d3-2.7.5/src/time/scale.js | 139 + static/vendor/d3-2.7.5/src/time/second.js | 5 + static/vendor/d3-2.7.5/src/time/seconds.js | 7 + static/vendor/d3-2.7.5/src/time/time.js | 3 + static/vendor/d3-2.7.5/src/time/week.js | 9 + static/vendor/d3-2.7.5/src/time/weeks.js | 11 + static/vendor/d3-2.7.5/src/time/year.js | 7 + static/vendor/d3-2.7.5/src/time/years.js | 11 + static/vendor/d3-2.7.5/test/core/ascending-test.js | 47 + static/vendor/d3-2.7.5/test/core/bisect-test.js | 103 + .../vendor/d3-2.7.5/test/core/descending-test.js | 47 + static/vendor/d3-2.7.5/test/core/dispatch-test.js | 138 + static/vendor/d3-2.7.5/test/core/ease-test.js | 129 + static/vendor/d3-2.7.5/test/core/entries-test.js | 43 + static/vendor/d3-2.7.5/test/core/extent-test.js | 51 + static/vendor/d3-2.7.5/test/core/first-test.js | 42 + static/vendor/d3-2.7.5/test/core/format-test.js | 239 + .../vendor/d3-2.7.5/test/core/formatPrefix-test.js | 108 + static/vendor/d3-2.7.5/test/core/functor-test.js | 29 + static/vendor/d3-2.7.5/test/core/hsl-test.js | 82 + static/vendor/d3-2.7.5/test/core/html-test.js | 37 + .../vendor/d3-2.7.5/test/core/interpolate-test.js | 209 + static/vendor/d3-2.7.5/test/core/json-test.js | 37 + static/vendor/d3-2.7.5/test/core/keys-test.js | 31 + static/vendor/d3-2.7.5/test/core/last-test.js | 42 + static/vendor/d3-2.7.5/test/core/max-test.js | 51 + static/vendor/d3-2.7.5/test/core/mean-test.js | 43 + static/vendor/d3-2.7.5/test/core/median-test.js | 43 + static/vendor/d3-2.7.5/test/core/merge-test.js | 27 + static/vendor/d3-2.7.5/test/core/min-test.js | 50 + static/vendor/d3-2.7.5/test/core/nest-test.js | 236 + static/vendor/d3-2.7.5/test/core/ns-test.js | 58 + static/vendor/d3-2.7.5/test/core/permute-test.js | 53 + static/vendor/d3-2.7.5/test/core/quantile-test.js | 50 + static/vendor/d3-2.7.5/test/core/range-test.js | 103 + static/vendor/d3-2.7.5/test/core/rebind-test.js | 52 + static/vendor/d3-2.7.5/test/core/requote-test.js | 53 + static/vendor/d3-2.7.5/test/core/rgb-test.js | 89 + static/vendor/d3-2.7.5/test/core/round-test.js | 70 + static/vendor/d3-2.7.5/test/core/select-test.js | 42 + static/vendor/d3-2.7.5/test/core/selectAll-test.js | 46 + .../d3-2.7.5/test/core/selection-append-test.js | 123 + .../d3-2.7.5/test/core/selection-attr-test.js | 153 + .../d3-2.7.5/test/core/selection-call-test.js | 71 + .../d3-2.7.5/test/core/selection-classed-test.js | 219 + .../d3-2.7.5/test/core/selection-data-test.js | 168 + .../d3-2.7.5/test/core/selection-each-test.js | 83 + .../d3-2.7.5/test/core/selection-empty-test.js | 51 + .../d3-2.7.5/test/core/selection-filter-test.js | 70 + .../d3-2.7.5/test/core/selection-html-test.js | 133 + .../d3-2.7.5/test/core/selection-insert-test.js | 136 + .../d3-2.7.5/test/core/selection-map-test.js | 47 + .../d3-2.7.5/test/core/selection-node-test.js | 50 + .../vendor/d3-2.7.5/test/core/selection-on-test.js | 95 + .../d3-2.7.5/test/core/selection-order-test.js | 32 + .../d3-2.7.5/test/core/selection-property-test.js | 91 + .../d3-2.7.5/test/core/selection-remove-test.js | 39 + .../d3-2.7.5/test/core/selection-select-test.js | 125 + .../d3-2.7.5/test/core/selection-selectAll-test.js | 128 + .../d3-2.7.5/test/core/selection-sort-test.js | 59 + .../d3-2.7.5/test/core/selection-style-test.js | 100 + static/vendor/d3-2.7.5/test/core/selection-test.js | 35 + .../d3-2.7.5/test/core/selection-text-test.js | 116 + static/vendor/d3-2.7.5/test/core/split-test.js | 34 + static/vendor/d3-2.7.5/test/core/sum-test.js | 47 + static/vendor/d3-2.7.5/test/core/text-test.js | 48 + static/vendor/d3-2.7.5/test/core/timer-test.js | 62 + .../d3-2.7.5/test/core/transition-test-attr.js | 54 + .../test/core/transition-test-attrTween.js | 67 + .../d3-2.7.5/test/core/transition-test-call.js | 33 + .../d3-2.7.5/test/core/transition-test-delay.js | 41 + .../d3-2.7.5/test/core/transition-test-duration.js | 41 + .../d3-2.7.5/test/core/transition-test-each.js | 166 + .../d3-2.7.5/test/core/transition-test-id.js | 20 + .../d3-2.7.5/test/core/transition-test-remove.js | 46 + .../d3-2.7.5/test/core/transition-test-select.js | 63 + .../test/core/transition-test-selectAll.js | 59 + .../d3-2.7.5/test/core/transition-test-style.js | 49 + .../test/core/transition-test-styleTween.js | 73 + .../d3-2.7.5/test/core/transition-test-text.js | 30 + .../d3-2.7.5/test/core/transition-test-time.js | 36 + .../test/core/transition-test-transition.js | 60 + .../d3-2.7.5/test/core/transition-test-tween.js | 71 + .../vendor/d3-2.7.5/test/core/transition-test.js | 66 + static/vendor/d3-2.7.5/test/core/transpose-test.js | 32 + static/vendor/d3-2.7.5/test/core/values-test.js | 35 + static/vendor/d3-2.7.5/test/core/version-test.js | 18 + static/vendor/d3-2.7.5/test/core/xhr-test.js | 56 + static/vendor/d3-2.7.5/test/core/xml-test.js | 48 + static/vendor/d3-2.7.5/test/core/zip-test.js | 32 + static/vendor/d3-2.7.5/test/csv/csv-test.js | 38 + static/vendor/d3-2.7.5/test/csv/format-test.js | 39 + static/vendor/d3-2.7.5/test/csv/parse-test.js | 101 + static/vendor/d3-2.7.5/test/env-assert.js | 96 + static/vendor/d3-2.7.5/test/env-fragment.js | 8 + static/vendor/d3-2.7.5/test/env-xhr.js | 55 + static/vendor/d3-2.7.5/test/env.js | 13 + static/vendor/d3-2.7.5/test/geo/albers-test.js | 57 + static/vendor/d3-2.7.5/test/geo/azimuthal-test.js | 261 + static/vendor/d3-2.7.5/test/geo/bonne-test.js | 116 + .../d3-2.7.5/test/geo/equirectangular-test.js | 50 + static/vendor/d3-2.7.5/test/geo/greatArc-test.js | 41 + static/vendor/d3-2.7.5/test/geo/mercator-test.js | 57 + static/vendor/d3-2.7.5/test/geo/path-test.js | 25 + static/vendor/d3-2.7.5/test/geom/polygon-test.js | 83 + static/vendor/d3-2.7.5/test/layout/cluster-test.js | 44 + .../vendor/d3-2.7.5/test/layout/hierarchy-test.js | 30 + .../vendor/d3-2.7.5/test/layout/histogram-test.js | 91 + static/vendor/d3-2.7.5/test/layout/pack-test.js | 93 + .../vendor/d3-2.7.5/test/layout/partition-test.js | 50 + static/vendor/d3-2.7.5/test/layout/pie-test.js | 26 + static/vendor/d3-2.7.5/test/layout/tree-test.js | 46 + static/vendor/d3-2.7.5/test/layout/treemap-test.js | 172 + static/vendor/d3-2.7.5/test/scale/category-test.js | 74 + static/vendor/d3-2.7.5/test/scale/linear-test.js | 275 + static/vendor/d3-2.7.5/test/scale/log-test.js | 276 + static/vendor/d3-2.7.5/test/scale/ordinal-test.js | 209 + static/vendor/d3-2.7.5/test/scale/pow-test.js | 263 + static/vendor/d3-2.7.5/test/scale/quantile-test.js | 64 + static/vendor/d3-2.7.5/test/scale/quantize-test.js | 69 + static/vendor/d3-2.7.5/test/scale/sqrt-test.js | 256 + static/vendor/d3-2.7.5/test/svg/arc-test.js | 147 + .../vendor/d3-2.7.5/test/svg/area-radial-test.js | 200 + static/vendor/d3-2.7.5/test/svg/area-test.js | 192 + static/vendor/d3-2.7.5/test/svg/axis-test.js | 359 + .../vendor/d3-2.7.5/test/svg/line-radial-test.js | 125 + static/vendor/d3-2.7.5/test/svg/line-test.js | 189 + static/vendor/d3-2.7.5/test/svg/symbol-test.js | 96 + static/vendor/d3-2.7.5/test/time/day-test.js | 65 + static/vendor/d3-2.7.5/test/time/days-test.js | 105 + static/vendor/d3-2.7.5/test/time/format-test.js | 467 ++ static/vendor/d3-2.7.5/test/time/hour-test.js | 103 + static/vendor/d3-2.7.5/test/time/hours-test.js | 135 + static/vendor/d3-2.7.5/test/time/minute-test.js | 43 + static/vendor/d3-2.7.5/test/time/minutes-test.js | 101 + static/vendor/d3-2.7.5/test/time/month-test.js | 53 + static/vendor/d3-2.7.5/test/time/months-test.js | 105 + static/vendor/d3-2.7.5/test/time/scale-test.js | 578 ++ static/vendor/d3-2.7.5/test/time/second-test.js | 41 + static/vendor/d3-2.7.5/test/time/seconds-test.js | 101 + static/vendor/d3-2.7.5/test/time/week-test.js | 59 + static/vendor/d3-2.7.5/test/time/weeks-test.js | 105 + static/vendor/d3-2.7.5/test/time/year-test.js | 41 + static/vendor/d3-2.7.5/test/time/years-test.js | 73 + 592 files changed, 74601 insertions(+), 0 deletions(-) create mode 120000 static/vendor/d3 create mode 100644 static/vendor/d3-2.7.5/.gitignore create mode 100644 static/vendor/d3-2.7.5/.gitmodules create mode 100644 static/vendor/d3-2.7.5/.npmignore create mode 100644 static/vendor/d3-2.7.5/LICENSE create mode 100644 static/vendor/d3-2.7.5/Makefile create mode 100644 static/vendor/d3-2.7.5/README.md create mode 100644 static/vendor/d3-2.7.5/d3.chart.js create mode 100644 static/vendor/d3-2.7.5/d3.chart.min.js create mode 100644 static/vendor/d3-2.7.5/d3.csv.js create mode 100644 static/vendor/d3-2.7.5/d3.csv.min.js create mode 100644 static/vendor/d3-2.7.5/d3.geo.js create mode 100644 static/vendor/d3-2.7.5/d3.geo.min.js create mode 100644 static/vendor/d3-2.7.5/d3.geom.js create mode 100644 static/vendor/d3-2.7.5/d3.geom.min.js create mode 100644 static/vendor/d3-2.7.5/d3.js create mode 100644 static/vendor/d3-2.7.5/d3.layout.js create mode 100644 static/vendor/d3-2.7.5/d3.layout.min.js create mode 100644 static/vendor/d3-2.7.5/d3.min.js create mode 100644 static/vendor/d3-2.7.5/d3.time.js create mode 100644 static/vendor/d3-2.7.5/d3.time.min.js create mode 100644 static/vendor/d3-2.7.5/examples/albers/albers.html create mode 100644 static/vendor/d3-2.7.5/examples/area/area-radial.html create mode 100644 static/vendor/d3-2.7.5/examples/area/area.html create mode 100644 static/vendor/d3-2.7.5/examples/axis/axis-alternating.html create mode 100644 static/vendor/d3-2.7.5/examples/axis/axis-ggplot2.html create mode 100644 static/vendor/d3-2.7.5/examples/axis/axis-multiples.html create mode 100644 static/vendor/d3-2.7.5/examples/axis/axis-orientations.html create mode 100644 static/vendor/d3-2.7.5/examples/axis/axis-transition.html create mode 100644 static/vendor/d3-2.7.5/examples/azimuthal/azimuthal.css create mode 100644 static/vendor/d3-2.7.5/examples/azimuthal/azimuthal.html create mode 100644 static/vendor/d3-2.7.5/examples/azimuthal/azimuthal.js create mode 100644 static/vendor/d3-2.7.5/examples/bar/bar-hierarchy.html create mode 100644 static/vendor/d3-2.7.5/examples/bar/bar.html create mode 100644 static/vendor/d3-2.7.5/examples/bar/sample-data.csv create mode 100644 static/vendor/d3-2.7.5/examples/bonne/bonne.html create mode 100644 static/vendor/d3-2.7.5/examples/box/box.css create mode 100644 static/vendor/d3-2.7.5/examples/box/box.html create mode 100644 static/vendor/d3-2.7.5/examples/box/box.js create mode 100644 static/vendor/d3-2.7.5/examples/brush/brush-ordinal.html create mode 100644 static/vendor/d3-2.7.5/examples/brush/brush-x.html create mode 100644 static/vendor/d3-2.7.5/examples/brush/brush-y.html create mode 100644 static/vendor/d3-2.7.5/examples/brush/brush.html create mode 100644 static/vendor/d3-2.7.5/examples/bubble/bubble.css create mode 100644 static/vendor/d3-2.7.5/examples/bubble/bubble.html create mode 100644 static/vendor/d3-2.7.5/examples/bubble/bubble.js create mode 100644 static/vendor/d3-2.7.5/examples/bullet/bullet.css create mode 100644 static/vendor/d3-2.7.5/examples/bullet/bullet.html create mode 100644 static/vendor/d3-2.7.5/examples/bullet/bullet.js create mode 100644 static/vendor/d3-2.7.5/examples/bullet/bullets.json create mode 100644 static/vendor/d3-2.7.5/examples/bundle/bundle-radial.css create mode 100644 static/vendor/d3-2.7.5/examples/bundle/bundle-radial.html create mode 100644 static/vendor/d3-2.7.5/examples/bundle/bundle-radial.js create mode 100644 static/vendor/d3-2.7.5/examples/bundle/bundle-treemap.css create mode 100644 static/vendor/d3-2.7.5/examples/bundle/bundle-treemap.html create mode 100644 static/vendor/d3-2.7.5/examples/bundle/bundle-treemap.js create mode 100644 static/vendor/d3-2.7.5/examples/bundle/packages.js create mode 100644 static/vendor/d3-2.7.5/examples/button.css create mode 100644 static/vendor/d3-2.7.5/examples/calendar/calendar.css create mode 100644 static/vendor/d3-2.7.5/examples/calendar/dji-area.html create mode 100644 static/vendor/d3-2.7.5/examples/calendar/dji.csv create mode 100644 static/vendor/d3-2.7.5/examples/calendar/dji.html create mode 100644 static/vendor/d3-2.7.5/examples/calendar/dji.js create mode 100644 static/vendor/d3-2.7.5/examples/calendar/vix.csv create mode 100644 static/vendor/d3-2.7.5/examples/calendar/vix.html create mode 100644 static/vendor/d3-2.7.5/examples/calendar/vix.js create mode 100644 static/vendor/d3-2.7.5/examples/cartogram/cartogram.css create mode 100644 static/vendor/d3-2.7.5/examples/cartogram/cartogram.html create mode 100644 static/vendor/d3-2.7.5/examples/cartogram/cartogram.js create mode 100644 static/vendor/d3-2.7.5/examples/cartogram/demers.css create mode 100644 static/vendor/d3-2.7.5/examples/cartogram/demers.html create mode 100644 static/vendor/d3-2.7.5/examples/cartogram/demers.js create mode 100644 static/vendor/d3-2.7.5/examples/cartogram/dorling.css create mode 100644 static/vendor/d3-2.7.5/examples/cartogram/dorling.html create mode 100644 static/vendor/d3-2.7.5/examples/cartogram/dorling.js create mode 100644 static/vendor/d3-2.7.5/examples/chord/chord-flare.html create mode 100644 static/vendor/d3-2.7.5/examples/chord/chord.css create mode 100644 static/vendor/d3-2.7.5/examples/chord/chord.html create mode 100644 static/vendor/d3-2.7.5/examples/chord/chord.js create mode 100644 static/vendor/d3-2.7.5/examples/choropleth/choropleth-area.html create mode 100644 static/vendor/d3-2.7.5/examples/choropleth/choropleth-bounds.html create mode 100644 static/vendor/d3-2.7.5/examples/choropleth/choropleth.css create mode 100644 static/vendor/d3-2.7.5/examples/choropleth/choropleth.html create mode 100644 static/vendor/d3-2.7.5/examples/choropleth/choropleth.js create mode 100644 static/vendor/d3-2.7.5/examples/choropleth/unemployment.json create mode 100644 static/vendor/d3-2.7.5/examples/clock/clock.css create mode 100644 static/vendor/d3-2.7.5/examples/clock/clock.html create mode 100644 static/vendor/d3-2.7.5/examples/clock/clock.js create mode 100644 static/vendor/d3-2.7.5/examples/cluster/cluster-radial.html create mode 100644 static/vendor/d3-2.7.5/examples/cluster/cluster-radial.js create mode 100644 static/vendor/d3-2.7.5/examples/cluster/cluster.css create mode 100644 static/vendor/d3-2.7.5/examples/cluster/cluster.html create mode 100644 static/vendor/d3-2.7.5/examples/cluster/cluster.js create mode 100644 static/vendor/d3-2.7.5/examples/contour/contour.html create mode 100644 static/vendor/d3-2.7.5/examples/crimea/crimea-stacked-area.html create mode 100644 static/vendor/d3-2.7.5/examples/crimea/crimea-stacked-bar.html create mode 100644 static/vendor/d3-2.7.5/examples/crimea/crimea.csv create mode 100644 static/vendor/d3-2.7.5/examples/custom/custom.html create mode 100644 static/vendor/d3-2.7.5/examples/data/README.md create mode 100644 static/vendor/d3-2.7.5/examples/data/faithful.json create mode 100644 static/vendor/d3-2.7.5/examples/data/flare-imports.json create mode 100644 static/vendor/d3-2.7.5/examples/data/flare.json create mode 100644 static/vendor/d3-2.7.5/examples/data/morley.csv create mode 100644 static/vendor/d3-2.7.5/examples/data/sample.csv create mode 100644 static/vendor/d3-2.7.5/examples/data/sample.html create mode 100644 static/vendor/d3-2.7.5/examples/data/sample.json create mode 100644 static/vendor/d3-2.7.5/examples/data/sample.txt create mode 100644 static/vendor/d3-2.7.5/examples/data/sample.xml create mode 100644 static/vendor/d3-2.7.5/examples/data/stocks.csv create mode 100644 static/vendor/d3-2.7.5/examples/data/unemployment.csv create mode 100644 static/vendor/d3-2.7.5/examples/data/us-borders.json create mode 100644 static/vendor/d3-2.7.5/examples/data/us-counties.json create mode 100644 static/vendor/d3-2.7.5/examples/data/us-state-centroids.json create mode 100644 static/vendor/d3-2.7.5/examples/data/us-states.json create mode 100644 static/vendor/d3-2.7.5/examples/data/world-countries.json create mode 100644 static/vendor/d3-2.7.5/examples/delaunay/delaunay.html create mode 100644 static/vendor/d3-2.7.5/examples/donut/donut.html create mode 100644 static/vendor/d3-2.7.5/examples/dot/dot.html create mode 100644 static/vendor/d3-2.7.5/examples/drag/drag.html create mode 100644 static/vendor/d3-2.7.5/examples/force/README create mode 100644 static/vendor/d3-2.7.5/examples/force/force-bounds.html create mode 100644 static/vendor/d3-2.7.5/examples/force/force-cluster.html create mode 100644 static/vendor/d3-2.7.5/examples/force/force-collapsible.html create mode 100644 static/vendor/d3-2.7.5/examples/force/force-dynamic.html create mode 100644 static/vendor/d3-2.7.5/examples/force/force-map.html create mode 100644 static/vendor/d3-2.7.5/examples/force/force-multi-foci.html create mode 100644 static/vendor/d3-2.7.5/examples/force/force.css create mode 100644 static/vendor/d3-2.7.5/examples/force/force.html create mode 100644 static/vendor/d3-2.7.5/examples/force/force.js create mode 100644 static/vendor/d3-2.7.5/examples/force/miserables.json create mode 100644 static/vendor/d3-2.7.5/examples/great-arc/great-arc.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/hello-data-key.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/hello-data-nested-key.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/hello-data-nested.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/hello-data.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/hello-event.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/hello-node-key.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/hello-order.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/hello-sort.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/hello-transform.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/hello-transition-undefined.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/hello-transition.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/hello-webkit-transition.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/select-enter-add.html create mode 100644 static/vendor/d3-2.7.5/examples/hello-world/selectAll-enter-add.html create mode 100644 static/vendor/d3-2.7.5/examples/histogram/histogram.html create mode 100644 static/vendor/d3-2.7.5/examples/horizon/horizon.css create mode 100644 static/vendor/d3-2.7.5/examples/horizon/horizon.html create mode 100644 static/vendor/d3-2.7.5/examples/horizon/horizon.js create mode 100644 static/vendor/d3-2.7.5/examples/horizon/unemployment.json create mode 100644 static/vendor/d3-2.7.5/examples/hull/hull.html create mode 100644 static/vendor/d3-2.7.5/examples/kde/kde.css create mode 100644 static/vendor/d3-2.7.5/examples/kde/kde.html create mode 100644 static/vendor/d3-2.7.5/examples/kde/kde.js create mode 100644 static/vendor/d3-2.7.5/examples/line/line.css create mode 100644 static/vendor/d3-2.7.5/examples/line/line.html create mode 100644 static/vendor/d3-2.7.5/examples/line/line.js create mode 100644 static/vendor/d3-2.7.5/examples/marimekko/marimekko.html create mode 100644 static/vendor/d3-2.7.5/examples/marimekko/marimekko.json create mode 100644 static/vendor/d3-2.7.5/examples/marker/marker.html create mode 100644 static/vendor/d3-2.7.5/examples/mercator/mercator.html create mode 100644 static/vendor/d3-2.7.5/examples/moire/moire.html create mode 100644 static/vendor/d3-2.7.5/examples/node-canvas/us-counties.js create mode 100644 static/vendor/d3-2.7.5/examples/pack/pack.css create mode 100644 static/vendor/d3-2.7.5/examples/pack/pack.html create mode 100644 static/vendor/d3-2.7.5/examples/pack/pack.js create mode 100644 static/vendor/d3-2.7.5/examples/parallel/cars.csv create mode 100644 static/vendor/d3-2.7.5/examples/parallel/parallel.html create mode 100644 static/vendor/d3-2.7.5/examples/partition/partition-icicle-zoom.html create mode 100644 static/vendor/d3-2.7.5/examples/partition/partition-icicle.html create mode 100644 static/vendor/d3-2.7.5/examples/partition/partition-sunburst-zoom.html create mode 100644 static/vendor/d3-2.7.5/examples/partition/partition-sunburst.html create mode 100644 static/vendor/d3-2.7.5/examples/partition/partition-sunburst.js create mode 100644 static/vendor/d3-2.7.5/examples/pie/pie-transition.html create mode 100644 static/vendor/d3-2.7.5/examples/pie/pie.html create mode 100644 static/vendor/d3-2.7.5/examples/population/population.css create mode 100644 static/vendor/d3-2.7.5/examples/population/population.csv create mode 100644 static/vendor/d3-2.7.5/examples/population/population.html create mode 100644 static/vendor/d3-2.7.5/examples/population/population.js create mode 100644 static/vendor/d3-2.7.5/examples/qq/qq.css create mode 100644 static/vendor/d3-2.7.5/examples/qq/qq.html create mode 100644 static/vendor/d3-2.7.5/examples/qq/qq.js create mode 100644 static/vendor/d3-2.7.5/examples/qq/stats.js create mode 100644 static/vendor/d3-2.7.5/examples/qq/turkers.json create mode 100644 static/vendor/d3-2.7.5/examples/quadtree/quadtree.html create mode 100644 static/vendor/d3-2.7.5/examples/rollup/rollup.html create mode 100644 static/vendor/d3-2.7.5/examples/showreel/showreel.html create mode 100644 static/vendor/d3-2.7.5/examples/sizzle/sizzle.html create mode 100644 static/vendor/d3-2.7.5/examples/sort/sort.css create mode 100644 static/vendor/d3-2.7.5/examples/sort/sort.html create mode 100644 static/vendor/d3-2.7.5/examples/sort/sort.js create mode 100644 static/vendor/d3-2.7.5/examples/spline/spline.css create mode 100644 static/vendor/d3-2.7.5/examples/spline/spline.html create mode 100644 static/vendor/d3-2.7.5/examples/spline/spline.js create mode 100644 static/vendor/d3-2.7.5/examples/splom/flowers.json create mode 100644 static/vendor/d3-2.7.5/examples/splom/splom.css create mode 100644 static/vendor/d3-2.7.5/examples/splom/splom.html create mode 100644 static/vendor/d3-2.7.5/examples/splom/splom.js create mode 100644 static/vendor/d3-2.7.5/examples/stream/stack.css create mode 100644 static/vendor/d3-2.7.5/examples/stream/stack.html create mode 100644 static/vendor/d3-2.7.5/examples/stream/stack.js create mode 100644 static/vendor/d3-2.7.5/examples/stream/stream.css create mode 100644 static/vendor/d3-2.7.5/examples/stream/stream.html create mode 100644 static/vendor/d3-2.7.5/examples/stream/stream.js create mode 100644 static/vendor/d3-2.7.5/examples/stream/stream_layers.js create mode 100644 static/vendor/d3-2.7.5/examples/superformula/dot.html create mode 100644 static/vendor/d3-2.7.5/examples/superformula/explorer.html create mode 100644 static/vendor/d3-2.7.5/examples/superformula/superformula.html create mode 100644 static/vendor/d3-2.7.5/examples/superformula/superformula.js create mode 100644 static/vendor/d3-2.7.5/examples/symbol-map/symbol-map.html create mode 100644 static/vendor/d3-2.7.5/examples/touch/touch.html create mode 100644 static/vendor/d3-2.7.5/examples/transform/test.html create mode 100644 static/vendor/d3-2.7.5/examples/transform/transform.html create mode 100644 static/vendor/d3-2.7.5/examples/tree/tree-dynamic.html create mode 100644 static/vendor/d3-2.7.5/examples/tree/tree-interactive.html create mode 100644 static/vendor/d3-2.7.5/examples/tree/tree-radial.html create mode 100644 static/vendor/d3-2.7.5/examples/tree/tree-radial.js create mode 100644 static/vendor/d3-2.7.5/examples/tree/tree.css create mode 100644 static/vendor/d3-2.7.5/examples/tree/tree.html create mode 100644 static/vendor/d3-2.7.5/examples/tree/tree.js create mode 100644 static/vendor/d3-2.7.5/examples/treemap/treemap-svg.html create mode 100644 static/vendor/d3-2.7.5/examples/treemap/treemap-svg.js create mode 100644 static/vendor/d3-2.7.5/examples/treemap/treemap.css create mode 100644 static/vendor/d3-2.7.5/examples/treemap/treemap.html create mode 100644 static/vendor/d3-2.7.5/examples/treemap/treemap.js create mode 100644 static/vendor/d3-2.7.5/examples/voroboids/boid.js create mode 100644 static/vendor/d3-2.7.5/examples/voroboids/voroboids.css create mode 100644 static/vendor/d3-2.7.5/examples/voroboids/voroboids.html create mode 100644 static/vendor/d3-2.7.5/examples/voroboids/voroboids.js create mode 100644 static/vendor/d3-2.7.5/examples/voronoi/voronoi.css create mode 100644 static/vendor/d3-2.7.5/examples/voronoi/voronoi.html create mode 100644 static/vendor/d3-2.7.5/examples/voronoi/voronoi.js create mode 100644 static/vendor/d3-2.7.5/examples/zoom-pan/zoom-pan-transform.html create mode 100644 static/vendor/d3-2.7.5/examples/zoom-pan/zoom-pan.html create mode 100644 static/vendor/d3-2.7.5/examples/zoom/sp500.csv create mode 100644 static/vendor/d3-2.7.5/examples/zoom/zoom.html create mode 100644 static/vendor/d3-2.7.5/index.js create mode 100644 static/vendor/d3-2.7.5/lib/colorbrewer/LICENSE create mode 100644 static/vendor/d3-2.7.5/lib/colorbrewer/colorbrewer.css create mode 100644 static/vendor/d3-2.7.5/lib/colorbrewer/colorbrewer.js create mode 100644 static/vendor/d3-2.7.5/lib/jit/LICENSE create mode 100644 static/vendor/d3-2.7.5/lib/jquery-ui/LICENSE create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-bg_diagonals-thick_18_b81900_40x40.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-bg_diagonals-thick_20_666666_40x40.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-bg_flat_10_000000_40x100.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-bg_glass_100_f6f6f6_1x400.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-bg_glass_100_fdf5ce_1x400.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-bg_gloss-wave_35_f6a828_500x100.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-bg_highlight-soft_100_eeeeee_1x100.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-bg_highlight-soft_75_ffe45c_1x100.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-icons_222222_256x240.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-icons_228ef1_256x240.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-icons_ef8c08_256x240.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-icons_ffd27a_256x240.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/images/ui-icons_ffffff_256x240.png create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/jquery-ui.css create mode 100755 static/vendor/d3-2.7.5/lib/jquery-ui/jquery-ui.min.js create mode 100644 static/vendor/d3-2.7.5/lib/jquery/LICENSE create mode 100644 static/vendor/d3-2.7.5/lib/jquery/jquery.js create mode 100644 static/vendor/d3-2.7.5/lib/jquery/jquery.min.js create mode 100644 static/vendor/d3-2.7.5/lib/polymaps/LICENSE create mode 100644 static/vendor/d3-2.7.5/lib/protovis/LICENSE create mode 100644 static/vendor/d3-2.7.5/lib/science/LICENSE create mode 100644 static/vendor/d3-2.7.5/lib/science/science.js create mode 100644 static/vendor/d3-2.7.5/lib/science/science.lin.js create mode 100644 static/vendor/d3-2.7.5/lib/science/science.lin.min.js create mode 100644 static/vendor/d3-2.7.5/lib/science/science.min.js create mode 100644 static/vendor/d3-2.7.5/lib/science/science.stats.js create mode 100644 static/vendor/d3-2.7.5/lib/science/science.stats.min.js create mode 100644 static/vendor/d3-2.7.5/lib/sizzle/LICENSE create mode 100755 static/vendor/d3-2.7.5/lib/sizzle/sizzle.js create mode 100644 static/vendor/d3-2.7.5/lib/sizzle/sizzle.min.js create mode 100644 static/vendor/d3-2.7.5/package.json create mode 100644 static/vendor/d3-2.7.5/src/behavior/behavior.js create mode 100644 static/vendor/d3-2.7.5/src/behavior/drag.js create mode 100644 static/vendor/d3-2.7.5/src/behavior/zoom.js create mode 100644 static/vendor/d3-2.7.5/src/chart/box.js create mode 100644 static/vendor/d3-2.7.5/src/chart/bullet.js create mode 100644 static/vendor/d3-2.7.5/src/chart/chart.js create mode 100644 static/vendor/d3-2.7.5/src/chart/horizon.js create mode 100644 static/vendor/d3-2.7.5/src/chart/qq.js create mode 100644 static/vendor/d3-2.7.5/src/compat/date.js create mode 100644 static/vendor/d3-2.7.5/src/compat/style.js create mode 100644 static/vendor/d3-2.7.5/src/core/array.js create mode 100644 static/vendor/d3-2.7.5/src/core/ascending.js create mode 100644 static/vendor/d3-2.7.5/src/core/bisect.js create mode 100644 static/vendor/d3-2.7.5/src/core/collapse.js create mode 100644 static/vendor/d3-2.7.5/src/core/core.js create mode 100644 static/vendor/d3-2.7.5/src/core/descending.js create mode 100644 static/vendor/d3-2.7.5/src/core/dispatch.js create mode 100644 static/vendor/d3-2.7.5/src/core/ease.js create mode 100644 static/vendor/d3-2.7.5/src/core/entries.js create mode 100644 static/vendor/d3-2.7.5/src/core/event.js create mode 100644 static/vendor/d3-2.7.5/src/core/extent.js create mode 100644 static/vendor/d3-2.7.5/src/core/first.js create mode 100644 static/vendor/d3-2.7.5/src/core/format.js create mode 100644 static/vendor/d3-2.7.5/src/core/formatPrefix.js create mode 100644 static/vendor/d3-2.7.5/src/core/functor.js create mode 100644 static/vendor/d3-2.7.5/src/core/hsl.js create mode 100644 static/vendor/d3-2.7.5/src/core/html.js create mode 100644 static/vendor/d3-2.7.5/src/core/interpolate.js create mode 100644 static/vendor/d3-2.7.5/src/core/json.js create mode 100644 static/vendor/d3-2.7.5/src/core/keys.js create mode 100644 static/vendor/d3-2.7.5/src/core/last.js create mode 100644 static/vendor/d3-2.7.5/src/core/max.js create mode 100644 static/vendor/d3-2.7.5/src/core/mean.js create mode 100644 static/vendor/d3-2.7.5/src/core/median.js create mode 100644 static/vendor/d3-2.7.5/src/core/merge.js create mode 100644 static/vendor/d3-2.7.5/src/core/min.js create mode 100644 static/vendor/d3-2.7.5/src/core/nest.js create mode 100644 static/vendor/d3-2.7.5/src/core/noop.js create mode 100644 static/vendor/d3-2.7.5/src/core/ns.js create mode 100644 static/vendor/d3-2.7.5/src/core/number.js create mode 100644 static/vendor/d3-2.7.5/src/core/permute.js create mode 100644 static/vendor/d3-2.7.5/src/core/quantile.js create mode 100644 static/vendor/d3-2.7.5/src/core/random.js create mode 100644 static/vendor/d3-2.7.5/src/core/range.js create mode 100644 static/vendor/d3-2.7.5/src/core/rebind.js create mode 100644 static/vendor/d3-2.7.5/src/core/requote.js create mode 100644 static/vendor/d3-2.7.5/src/core/rgb.js create mode 100644 static/vendor/d3-2.7.5/src/core/round.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-append.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-attr.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-call.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-classed.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-data.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-each.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-empty.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-enter-select.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-enter.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-filter.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-html.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-insert.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-map.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-node.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-on.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-order.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-property.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-remove.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-root.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-select.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-selectAll.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-sort.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-style.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-text.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection-transition.js create mode 100644 static/vendor/d3-2.7.5/src/core/selection.js create mode 100644 static/vendor/d3-2.7.5/src/core/split.js create mode 100644 static/vendor/d3-2.7.5/src/core/sum.js create mode 100644 static/vendor/d3-2.7.5/src/core/text.js create mode 100644 static/vendor/d3-2.7.5/src/core/this.js create mode 100644 static/vendor/d3-2.7.5/src/core/timer.js create mode 100644 static/vendor/d3-2.7.5/src/core/transform.js create mode 100644 static/vendor/d3-2.7.5/src/core/transition-attr.js create mode 100644 static/vendor/d3-2.7.5/src/core/transition-delay.js create mode 100644 static/vendor/d3-2.7.5/src/core/transition-duration.js create mode 100644 static/vendor/d3-2.7.5/src/core/transition-each.js create mode 100644 static/vendor/d3-2.7.5/src/core/transition-remove.js create mode 100644 static/vendor/d3-2.7.5/src/core/transition-select.js create mode 100644 static/vendor/d3-2.7.5/src/core/transition-selectAll.js create mode 100644 static/vendor/d3-2.7.5/src/core/transition-style.js create mode 100644 static/vendor/d3-2.7.5/src/core/transition-text.js create mode 100644 static/vendor/d3-2.7.5/src/core/transition-transition.js create mode 100644 static/vendor/d3-2.7.5/src/core/transition.js create mode 100644 static/vendor/d3-2.7.5/src/core/transpose.js create mode 100644 static/vendor/d3-2.7.5/src/core/uninterpolate.js create mode 100644 static/vendor/d3-2.7.5/src/core/values.js create mode 100644 static/vendor/d3-2.7.5/src/core/xhr.js create mode 100644 static/vendor/d3-2.7.5/src/core/xml.js create mode 100644 static/vendor/d3-2.7.5/src/core/zip.js create mode 100644 static/vendor/d3-2.7.5/src/csv/csv.js create mode 100644 static/vendor/d3-2.7.5/src/csv/format.js create mode 100644 static/vendor/d3-2.7.5/src/csv/parse.js create mode 100644 static/vendor/d3-2.7.5/src/end.js create mode 100644 static/vendor/d3-2.7.5/src/externs.js create mode 100644 static/vendor/d3-2.7.5/src/geo/albers.js create mode 100644 static/vendor/d3-2.7.5/src/geo/azimuthal.js create mode 100644 static/vendor/d3-2.7.5/src/geo/bonne.js create mode 100644 static/vendor/d3-2.7.5/src/geo/bounds.js create mode 100644 static/vendor/d3-2.7.5/src/geo/circle.js create mode 100644 static/vendor/d3-2.7.5/src/geo/equirectangular.js create mode 100644 static/vendor/d3-2.7.5/src/geo/geo.js create mode 100644 static/vendor/d3-2.7.5/src/geo/greatArc.js create mode 100644 static/vendor/d3-2.7.5/src/geo/greatCircle.js create mode 100644 static/vendor/d3-2.7.5/src/geo/mercator.js create mode 100644 static/vendor/d3-2.7.5/src/geo/path.js create mode 100644 static/vendor/d3-2.7.5/src/geo/type.js create mode 100644 static/vendor/d3-2.7.5/src/geom/contour.js create mode 100644 static/vendor/d3-2.7.5/src/geom/delaunay.js create mode 100644 static/vendor/d3-2.7.5/src/geom/geom.js create mode 100644 static/vendor/d3-2.7.5/src/geom/hull.js create mode 100644 static/vendor/d3-2.7.5/src/geom/polygon.js create mode 100644 static/vendor/d3-2.7.5/src/geom/quadtree.js create mode 100644 static/vendor/d3-2.7.5/src/geom/voronoi.js create mode 100644 static/vendor/d3-2.7.5/src/layout/bundle.js create mode 100644 static/vendor/d3-2.7.5/src/layout/chord.js create mode 100644 static/vendor/d3-2.7.5/src/layout/cluster.js create mode 100644 static/vendor/d3-2.7.5/src/layout/force.js create mode 100644 static/vendor/d3-2.7.5/src/layout/hierarchy.js create mode 100644 static/vendor/d3-2.7.5/src/layout/histogram.js create mode 100644 static/vendor/d3-2.7.5/src/layout/layout.js create mode 100644 static/vendor/d3-2.7.5/src/layout/pack.js create mode 100644 static/vendor/d3-2.7.5/src/layout/partition.js create mode 100644 static/vendor/d3-2.7.5/src/layout/pie.js create mode 100644 static/vendor/d3-2.7.5/src/layout/stack.js create mode 100644 static/vendor/d3-2.7.5/src/layout/tree.js create mode 100644 static/vendor/d3-2.7.5/src/layout/treemap.js create mode 100644 static/vendor/d3-2.7.5/src/package.js create mode 100644 static/vendor/d3-2.7.5/src/scale/bilinear.js create mode 100644 static/vendor/d3-2.7.5/src/scale/category.js create mode 100644 static/vendor/d3-2.7.5/src/scale/linear.js create mode 100644 static/vendor/d3-2.7.5/src/scale/log.js create mode 100644 static/vendor/d3-2.7.5/src/scale/nice.js create mode 100644 static/vendor/d3-2.7.5/src/scale/ordinal.js create mode 100644 static/vendor/d3-2.7.5/src/scale/polylinear.js create mode 100644 static/vendor/d3-2.7.5/src/scale/pow.js create mode 100644 static/vendor/d3-2.7.5/src/scale/quantile.js create mode 100644 static/vendor/d3-2.7.5/src/scale/quantize.js create mode 100644 static/vendor/d3-2.7.5/src/scale/scale.js create mode 100644 static/vendor/d3-2.7.5/src/scale/sqrt.js create mode 100644 static/vendor/d3-2.7.5/src/start.js create mode 100644 static/vendor/d3-2.7.5/src/svg/arc.js create mode 100644 static/vendor/d3-2.7.5/src/svg/area-radial.js create mode 100644 static/vendor/d3-2.7.5/src/svg/area.js create mode 100644 static/vendor/d3-2.7.5/src/svg/axis.js create mode 100644 static/vendor/d3-2.7.5/src/svg/brush.js create mode 100644 static/vendor/d3-2.7.5/src/svg/chord.js create mode 100644 static/vendor/d3-2.7.5/src/svg/diagonal-radial.js create mode 100644 static/vendor/d3-2.7.5/src/svg/diagonal.js create mode 100644 static/vendor/d3-2.7.5/src/svg/line-radial.js create mode 100644 static/vendor/d3-2.7.5/src/svg/line.js create mode 100644 static/vendor/d3-2.7.5/src/svg/mouse.js create mode 100644 static/vendor/d3-2.7.5/src/svg/svg.js create mode 100644 static/vendor/d3-2.7.5/src/svg/symbol.js create mode 100644 static/vendor/d3-2.7.5/src/svg/touches.js create mode 100644 static/vendor/d3-2.7.5/src/time/day.js create mode 100644 static/vendor/d3-2.7.5/src/time/days.js create mode 100644 static/vendor/d3-2.7.5/src/time/format-iso.js create mode 100644 static/vendor/d3-2.7.5/src/time/format-utc.js create mode 100644 static/vendor/d3-2.7.5/src/time/format.js create mode 100644 static/vendor/d3-2.7.5/src/time/hour.js create mode 100644 static/vendor/d3-2.7.5/src/time/hours.js create mode 100644 static/vendor/d3-2.7.5/src/time/minute.js create mode 100644 static/vendor/d3-2.7.5/src/time/minutes.js create mode 100644 static/vendor/d3-2.7.5/src/time/month.js create mode 100644 static/vendor/d3-2.7.5/src/time/months.js create mode 100644 static/vendor/d3-2.7.5/src/time/range.js create mode 100644 static/vendor/d3-2.7.5/src/time/scale-utc.js create mode 100644 static/vendor/d3-2.7.5/src/time/scale.js create mode 100644 static/vendor/d3-2.7.5/src/time/second.js create mode 100644 static/vendor/d3-2.7.5/src/time/seconds.js create mode 100644 static/vendor/d3-2.7.5/src/time/time.js create mode 100644 static/vendor/d3-2.7.5/src/time/week.js create mode 100644 static/vendor/d3-2.7.5/src/time/weeks.js create mode 100644 static/vendor/d3-2.7.5/src/time/year.js create mode 100644 static/vendor/d3-2.7.5/src/time/years.js create mode 100644 static/vendor/d3-2.7.5/test/core/ascending-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/bisect-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/descending-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/dispatch-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/ease-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/entries-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/extent-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/first-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/format-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/formatPrefix-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/functor-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/hsl-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/html-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/interpolate-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/json-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/keys-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/last-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/max-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/mean-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/median-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/merge-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/min-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/nest-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/ns-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/permute-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/quantile-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/range-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/rebind-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/requote-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/rgb-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/round-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/select-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selectAll-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-append-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-attr-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-call-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-classed-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-data-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-each-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-empty-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-filter-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-html-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-insert-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-map-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-node-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-on-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-order-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-property-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-remove-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-select-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-selectAll-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-sort-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-style-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/selection-text-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/split-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/sum-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/text-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/timer-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-attr.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-attrTween.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-call.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-delay.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-duration.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-each.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-id.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-remove.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-select.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-selectAll.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-style.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-styleTween.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-text.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-time.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-transition.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test-tween.js create mode 100644 static/vendor/d3-2.7.5/test/core/transition-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/transpose-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/values-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/version-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/xhr-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/xml-test.js create mode 100644 static/vendor/d3-2.7.5/test/core/zip-test.js create mode 100644 static/vendor/d3-2.7.5/test/csv/csv-test.js create mode 100644 static/vendor/d3-2.7.5/test/csv/format-test.js create mode 100644 static/vendor/d3-2.7.5/test/csv/parse-test.js create mode 100644 static/vendor/d3-2.7.5/test/env-assert.js create mode 100644 static/vendor/d3-2.7.5/test/env-fragment.js create mode 100644 static/vendor/d3-2.7.5/test/env-xhr.js create mode 100644 static/vendor/d3-2.7.5/test/env.js create mode 100644 static/vendor/d3-2.7.5/test/geo/albers-test.js create mode 100644 static/vendor/d3-2.7.5/test/geo/azimuthal-test.js create mode 100644 static/vendor/d3-2.7.5/test/geo/bonne-test.js create mode 100644 static/vendor/d3-2.7.5/test/geo/equirectangular-test.js create mode 100644 static/vendor/d3-2.7.5/test/geo/greatArc-test.js create mode 100644 static/vendor/d3-2.7.5/test/geo/mercator-test.js create mode 100644 static/vendor/d3-2.7.5/test/geo/path-test.js create mode 100644 static/vendor/d3-2.7.5/test/geom/polygon-test.js create mode 100644 static/vendor/d3-2.7.5/test/layout/cluster-test.js create mode 100644 static/vendor/d3-2.7.5/test/layout/hierarchy-test.js create mode 100644 static/vendor/d3-2.7.5/test/layout/histogram-test.js create mode 100644 static/vendor/d3-2.7.5/test/layout/pack-test.js create mode 100644 static/vendor/d3-2.7.5/test/layout/partition-test.js create mode 100644 static/vendor/d3-2.7.5/test/layout/pie-test.js create mode 100644 static/vendor/d3-2.7.5/test/layout/tree-test.js create mode 100644 static/vendor/d3-2.7.5/test/layout/treemap-test.js create mode 100644 static/vendor/d3-2.7.5/test/scale/category-test.js create mode 100644 static/vendor/d3-2.7.5/test/scale/linear-test.js create mode 100644 static/vendor/d3-2.7.5/test/scale/log-test.js create mode 100644 static/vendor/d3-2.7.5/test/scale/ordinal-test.js create mode 100644 static/vendor/d3-2.7.5/test/scale/pow-test.js create mode 100644 static/vendor/d3-2.7.5/test/scale/quantile-test.js create mode 100644 static/vendor/d3-2.7.5/test/scale/quantize-test.js create mode 100644 static/vendor/d3-2.7.5/test/scale/sqrt-test.js create mode 100644 static/vendor/d3-2.7.5/test/svg/arc-test.js create mode 100644 static/vendor/d3-2.7.5/test/svg/area-radial-test.js create mode 100644 static/vendor/d3-2.7.5/test/svg/area-test.js create mode 100644 static/vendor/d3-2.7.5/test/svg/axis-test.js create mode 100644 static/vendor/d3-2.7.5/test/svg/line-radial-test.js create mode 100644 static/vendor/d3-2.7.5/test/svg/line-test.js create mode 100644 static/vendor/d3-2.7.5/test/svg/symbol-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/day-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/days-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/format-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/hour-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/hours-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/minute-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/minutes-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/month-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/months-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/scale-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/second-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/seconds-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/week-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/weeks-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/year-test.js create mode 100644 static/vendor/d3-2.7.5/test/time/years-test.js diff --git a/static/vendor/d3 b/static/vendor/d3 new file mode 120000 index 0000000..a92620b --- /dev/null +++ b/static/vendor/d3 @@ -0,0 +1 @@ +d3-2.7.5 \ No newline at end of file diff --git a/static/vendor/d3-2.7.5/.gitignore b/static/vendor/d3-2.7.5/.gitignore new file mode 100644 index 0000000..8cc5a84 --- /dev/null +++ b/static/vendor/d3-2.7.5/.gitignore @@ -0,0 +1,3 @@ +_site +node_modules +.DS_Store diff --git a/static/vendor/d3-2.7.5/.gitmodules b/static/vendor/d3-2.7.5/.gitmodules new file mode 100644 index 0000000..e69de29 diff --git a/static/vendor/d3-2.7.5/.npmignore b/static/vendor/d3-2.7.5/.npmignore new file mode 100644 index 0000000..146266d --- /dev/null +++ b/static/vendor/d3-2.7.5/.npmignore @@ -0,0 +1,4 @@ +examples/ +test/ +lib/ +.DS_Store diff --git a/static/vendor/d3-2.7.5/LICENSE b/static/vendor/d3-2.7.5/LICENSE new file mode 100644 index 0000000..f154b09 --- /dev/null +++ b/static/vendor/d3-2.7.5/LICENSE @@ -0,0 +1,26 @@ +Copyright (c) 2010, Michael Bostock +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* The name Michael Bostock may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/static/vendor/d3-2.7.5/Makefile b/static/vendor/d3-2.7.5/Makefile new file mode 100644 index 0000000..0667874 --- /dev/null +++ b/static/vendor/d3-2.7.5/Makefile @@ -0,0 +1,273 @@ +# See the README for installation instructions. + +NODE_PATH ?= ./node_modules +JS_COMPILER = $(NODE_PATH)/uglify-js/bin/uglifyjs +JS_TESTER = $(NODE_PATH)/vows/bin/vows + +JS_FILES = \ + d3.js \ + d3.chart.js \ + d3.layout.js \ + d3.csv.js \ + d3.geo.js \ + d3.geom.js \ + d3.time.js + +all: \ + $(JS_FILES) \ + $(JS_FILES:.js=.min.js) \ + package.json + +# Modify this rule to build your own custom release. +# Run `make d3.custom.min.js` to produce the minified version. + +d3.custom.js: \ + d3.js \ + d3.layout.js \ + d3.csv.js \ + d3.geo.js \ + d3.geom.js \ + d3.time.js + +.INTERMEDIATE d3.js: \ + src/start.js \ + d3.core.js \ + d3.scale.js \ + d3.svg.js \ + d3.behavior.js \ + src/end.js + +d3.core.js: \ + src/compat/date.js \ + src/compat/style.js \ + src/core/core.js \ + src/core/array.js \ + src/core/this.js \ + src/core/functor.js \ + src/core/rebind.js \ + src/core/ascending.js \ + src/core/descending.js \ + src/core/mean.js \ + src/core/median.js \ + src/core/min.js \ + src/core/max.js \ + src/core/extent.js \ + src/core/random.js \ + src/core/number.js \ + src/core/sum.js \ + src/core/quantile.js \ + src/core/transpose.js \ + src/core/zip.js \ + src/core/bisect.js \ + src/core/first.js \ + src/core/last.js \ + src/core/nest.js \ + src/core/keys.js \ + src/core/values.js \ + src/core/entries.js \ + src/core/permute.js \ + src/core/merge.js \ + src/core/split.js \ + src/core/collapse.js \ + src/core/range.js \ + src/core/requote.js \ + src/core/round.js \ + src/core/xhr.js \ + src/core/text.js \ + src/core/json.js \ + src/core/html.js \ + src/core/xml.js \ + src/core/ns.js \ + src/core/dispatch.js \ + src/core/format.js \ + src/core/formatPrefix.js \ + src/core/ease.js \ + src/core/event.js \ + src/core/interpolate.js \ + src/core/uninterpolate.js \ + src/core/rgb.js \ + src/core/hsl.js \ + src/core/selection.js \ + src/core/selection-select.js \ + src/core/selection-selectAll.js \ + src/core/selection-attr.js \ + src/core/selection-classed.js \ + src/core/selection-style.js \ + src/core/selection-property.js \ + src/core/selection-text.js \ + src/core/selection-html.js \ + src/core/selection-append.js \ + src/core/selection-insert.js \ + src/core/selection-remove.js \ + src/core/selection-data.js \ + src/core/selection-filter.js \ + src/core/selection-map.js \ + src/core/selection-order.js \ + src/core/selection-sort.js \ + src/core/selection-on.js \ + src/core/selection-each.js \ + src/core/selection-call.js \ + src/core/selection-empty.js \ + src/core/selection-node.js \ + src/core/selection-transition.js \ + src/core/selection-root.js \ + src/core/selection-enter.js \ + src/core/selection-enter-select.js \ + src/core/transition.js \ + src/core/transition-select.js \ + src/core/transition-selectAll.js \ + src/core/transition-attr.js \ + src/core/transition-style.js \ + src/core/transition-text.js \ + src/core/transition-remove.js \ + src/core/transition-delay.js \ + src/core/transition-duration.js \ + src/core/transition-each.js \ + src/core/transition-transition.js \ + src/core/timer.js \ + src/core/transform.js \ + src/core/noop.js + +d3.scale.js: \ + src/scale/scale.js \ + src/scale/nice.js \ + src/scale/linear.js \ + src/scale/bilinear.js \ + src/scale/polylinear.js \ + src/scale/log.js \ + src/scale/pow.js \ + src/scale/sqrt.js \ + src/scale/ordinal.js \ + src/scale/category.js \ + src/scale/quantile.js \ + src/scale/quantize.js + +d3.svg.js: \ + src/svg/svg.js \ + src/svg/arc.js \ + src/svg/line.js \ + src/svg/line-radial.js \ + src/svg/area.js \ + src/svg/area-radial.js \ + src/svg/chord.js \ + src/svg/diagonal.js \ + src/svg/diagonal-radial.js \ + src/svg/mouse.js \ + src/svg/touches.js \ + src/svg/symbol.js \ + src/svg/axis.js \ + src/svg/brush.js + +d3.behavior.js: \ + src/behavior/behavior.js \ + src/behavior/drag.js \ + src/behavior/zoom.js + +d3.chart.js: \ + src/start.js \ + src/chart/chart.js \ + src/chart/box.js \ + src/chart/bullet.js \ + src/chart/horizon.js \ + src/chart/qq.js \ + src/end.js + +d3.layout.js: \ + src/start.js \ + src/layout/layout.js \ + src/layout/bundle.js \ + src/layout/chord.js \ + src/layout/force.js \ + src/layout/partition.js \ + src/layout/pie.js \ + src/layout/stack.js \ + src/layout/histogram.js \ + src/layout/hierarchy.js \ + src/layout/pack.js \ + src/layout/cluster.js \ + src/layout/tree.js \ + src/layout/treemap.js \ + src/end.js + +d3.geo.js: \ + src/start.js \ + src/geo/geo.js \ + src/geo/azimuthal.js \ + src/geo/albers.js \ + src/geo/bonne.js \ + src/geo/equirectangular.js \ + src/geo/mercator.js \ + src/geo/type.js \ + src/geo/path.js \ + src/geo/bounds.js \ + src/geo/circle.js \ + src/geo/greatArc.js \ + src/geo/greatCircle.js \ + src/end.js + +d3.csv.js: \ + src/start.js \ + src/csv/csv.js \ + src/csv/parse.js \ + src/csv/format.js \ + src/end.js + +d3.time.js: \ + src/start.js \ + src/time/time.js \ + src/time/format.js \ + src/time/format-utc.js \ + src/time/format-iso.js \ + src/time/range.js \ + src/time/second.js \ + src/time/seconds.js \ + src/time/minute.js \ + src/time/minutes.js \ + src/time/hour.js \ + src/time/hours.js \ + src/time/day.js \ + src/time/days.js \ + src/time/week.js \ + src/time/weeks.js \ + src/time/month.js \ + src/time/months.js \ + src/time/year.js \ + src/time/years.js \ + src/time/scale.js \ + src/time/scale-utc.js \ + src/end.js + +d3.geom.js: \ + src/start.js \ + src/geom/geom.js \ + src/geom/contour.js \ + src/geom/hull.js \ + src/geom/polygon.js \ + src/geom/voronoi.js \ + src/geom/delaunay.js \ + src/geom/quadtree.js \ + src/end.js + +test: all + @$(JS_TESTER) + +%.min.js: %.js Makefile + @rm -f $@ + $(JS_COMPILER) < $< > $@ + +d3.%: Makefile + @rm -f $@ + cat $(filter %.js,$^) > $@ + @chmod a-w $@ + +install: + mkdir -p node_modules + npm install + +package.json: d3.js src/package.js + @rm -f $@ + node src/package.js > $@ + @chmod a-w $@ + +clean: + rm -f d3*.js diff --git a/static/vendor/d3-2.7.5/README.md b/static/vendor/d3-2.7.5/README.md new file mode 100644 index 0000000..94cd51a --- /dev/null +++ b/static/vendor/d3-2.7.5/README.md @@ -0,0 +1,51 @@ +# D3 + +**D3** is a small, free JavaScript library for manipulating HTML documents +based on data. D3 can help you quickly visualize your data as HTML or SVG, +handle interactivity, and incorporate smooth transitions and staged animations +into your pages. You can use D3 as a visualization framework (like Protovis), +or you can use it to build dynamic pages (like jQuery). + +### Browser Support + +D3 should work on any browser, with minimal requirements such as JavaScript +and the [W3C DOM](http://www.w3.org/DOM/) API. By default D3 requires the +[Selectors API](http://www.w3.org/TR/selectors-api/) Level 1, but you can +preload [Sizzle](http://sizzlejs.com/) for compatibility with older browsers. +Some of the included D3 examples use additional browser features, such as +[SVG](http://www.w3.org/TR/SVG/) and [CSS3 +Transitions](http://www.w3.org/TR/css3-transitions/). These features are not +required to use D3, but are useful for visualization! D3 is not a +compatibility layer. The examples should work on Firefox, Chrome (Chromium), +Safari (WebKit), Opera and IE9. + +Note: Chrome has strict permissions for reading files out of the local file +system. Some examples use AJAX which works differently via HTTP instead of local +files. For the best experience, load the D3 examples from your own machine via +HTTP. Any static file web server will work; for example you can run Python's +built-in server: + + python -m SimpleHTTPServer 8888 + +Once this is running, go to: + +### Development Setup + +This repository should work out of the box if you just want to create new +visualizations using D3. On the other hand, if you want to extend D3 with new +features, fix bugs, or run tests, you'll need to install a few more things. + +D3's test framework uses [Vows](http://vowsjs.org), which depends on +[Node.js](http://nodejs.org/) and [NPM](http://npmjs.org/). If you are +developing on Mac OS X, an easy way to install Node and NPM is using +[Homebrew](http://mxcl.github.com/homebrew/): + + brew install node + brew install npm + +Next, from the root directory of this repository, install D3's dependencies: + + make install + +You can see the list of dependencies in package.json. NPM will install the +packages in the node_modules directory. diff --git a/static/vendor/d3-2.7.5/d3.chart.js b/static/vendor/d3-2.7.5/d3.chart.js new file mode 100644 index 0000000..281d007 --- /dev/null +++ b/static/vendor/d3-2.7.5/d3.chart.js @@ -0,0 +1,984 @@ +(function(){d3.chart = {}; +// Inspired by http://informationandvisualization.de/blog/box-plot +d3.chart.box = function() { + var width = 1, + height = 1, + duration = 0, + domain = null, + value = Number, + whiskers = d3_chart_boxWhiskers, + quartiles = d3_chart_boxQuartiles, + tickFormat = null; + + // For each small multiple… + function box(g) { + g.each(function(d, i) { + d = d.map(value).sort(d3.ascending); + var g = d3.select(this), + n = d.length, + min = d[0], + max = d[n - 1]; + + // Compute quartiles. Must return exactly 3 elements. + var quartileData = d.quartiles = quartiles(d); + + // Compute whiskers. Must return exactly 2 elements, or null. + var whiskerIndices = whiskers && whiskers.call(this, d, i), + whiskerData = whiskerIndices && whiskerIndices.map(function(i) { return d[i]; }); + + // Compute outliers. If no whiskers are specified, all data are "outliers". + // We compute the outliers as indices, so that we can join across transitions! + var outlierIndices = whiskerIndices + ? d3.range(0, whiskerIndices[0]).concat(d3.range(whiskerIndices[1] + 1, n)) + : d3.range(n); + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain(domain && domain.call(this, d, i) || [min, max]) + .range([height, 0]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + // Note: the box, median, and box tick elements are fixed in number, + // so we only have to handle enter and update. In contrast, the outliers + // and other elements are variable, so we need to exit them! Variable + // elements also fade in and out. + + // Update center line: the vertical line spanning the whiskers. + var center = g.selectAll("line.center") + .data(whiskerData ? [whiskerData] : []); + + center.enter().insert("svg:line", "rect") + .attr("class", "center") + .attr("x1", width / 2) + .attr("y1", function(d) { return x0(d[0]); }) + .attr("x2", width / 2) + .attr("y2", function(d) { return x0(d[1]); }) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .style("opacity", 1) + .attr("y1", function(d) { return x1(d[0]); }) + .attr("y2", function(d) { return x1(d[1]); }); + + center.transition() + .duration(duration) + .style("opacity", 1) + .attr("y1", function(d) { return x1(d[0]); }) + .attr("y2", function(d) { return x1(d[1]); }); + + center.exit().transition() + .duration(duration) + .style("opacity", 1e-6) + .attr("y1", function(d) { return x1(d[0]); }) + .attr("y2", function(d) { return x1(d[1]); }) + .remove(); + + // Update innerquartile box. + var box = g.selectAll("rect.box") + .data([quartileData]); + + box.enter().append("svg:rect") + .attr("class", "box") + .attr("x", 0) + .attr("y", function(d) { return x0(d[2]); }) + .attr("width", width) + .attr("height", function(d) { return x0(d[0]) - x0(d[2]); }) + .transition() + .duration(duration) + .attr("y", function(d) { return x1(d[2]); }) + .attr("height", function(d) { return x1(d[0]) - x1(d[2]); }); + + box.transition() + .duration(duration) + .attr("y", function(d) { return x1(d[2]); }) + .attr("height", function(d) { return x1(d[0]) - x1(d[2]); }); + + // Update median line. + var medianLine = g.selectAll("line.median") + .data([quartileData[1]]); + + medianLine.enter().append("svg:line") + .attr("class", "median") + .attr("x1", 0) + .attr("y1", x0) + .attr("x2", width) + .attr("y2", x0) + .transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1); + + medianLine.transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1); + + // Update whiskers. + var whisker = g.selectAll("line.whisker") + .data(whiskerData || []); + + whisker.enter().insert("svg:line", "circle, text") + .attr("class", "whisker") + .attr("x1", 0) + .attr("y1", x0) + .attr("x2", width) + .attr("y2", x0) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1) + .style("opacity", 1); + + whisker.transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1) + .style("opacity", 1); + + whisker.exit().transition() + .duration(duration) + .attr("y1", x1) + .attr("y2", x1) + .style("opacity", 1e-6) + .remove(); + + // Update outliers. + var outlier = g.selectAll("circle.outlier") + .data(outlierIndices, Number); + + outlier.enter().insert("svg:circle", "text") + .attr("class", "outlier") + .attr("r", 5) + .attr("cx", width / 2) + .attr("cy", function(i) { return x0(d[i]); }) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .attr("cy", function(i) { return x1(d[i]); }) + .style("opacity", 1); + + outlier.transition() + .duration(duration) + .attr("cy", function(i) { return x1(d[i]); }) + .style("opacity", 1); + + outlier.exit().transition() + .duration(duration) + .attr("cy", function(i) { return x1(d[i]); }) + .style("opacity", 1e-6) + .remove(); + + // Compute the tick format. + var format = tickFormat || x1.tickFormat(8); + + // Update box ticks. + var boxTick = g.selectAll("text.box") + .data(quartileData); + + boxTick.enter().append("svg:text") + .attr("class", "box") + .attr("dy", ".3em") + .attr("dx", function(d, i) { return i & 1 ? 6 : -6 }) + .attr("x", function(d, i) { return i & 1 ? width : 0 }) + .attr("y", x0) + .attr("text-anchor", function(d, i) { return i & 1 ? "start" : "end"; }) + .text(format) + .transition() + .duration(duration) + .attr("y", x1); + + boxTick.transition() + .duration(duration) + .text(format) + .attr("y", x1); + + // Update whisker ticks. These are handled separately from the box + // ticks because they may or may not exist, and we want don't want + // to join box ticks pre-transition with whisker ticks post-. + var whiskerTick = g.selectAll("text.whisker") + .data(whiskerData || []); + + whiskerTick.enter().append("svg:text") + .attr("class", "whisker") + .attr("dy", ".3em") + .attr("dx", 6) + .attr("x", width) + .attr("y", x0) + .text(format) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .attr("y", x1) + .style("opacity", 1); + + whiskerTick.transition() + .duration(duration) + .text(format) + .attr("y", x1) + .style("opacity", 1); + + whiskerTick.exit().transition() + .duration(duration) + .attr("y", x1) + .style("opacity", 1e-6) + .remove(); + }); + d3.timer.flush(); + } + + box.width = function(x) { + if (!arguments.length) return width; + width = x; + return box; + }; + + box.height = function(x) { + if (!arguments.length) return height; + height = x; + return box; + }; + + box.tickFormat = function(x) { + if (!arguments.length) return tickFormat; + tickFormat = x; + return box; + }; + + box.duration = function(x) { + if (!arguments.length) return duration; + duration = x; + return box; + }; + + box.domain = function(x) { + if (!arguments.length) return domain; + domain = x == null ? x : d3.functor(x); + return box; + }; + + box.value = function(x) { + if (!arguments.length) return value; + value = x; + return box; + }; + + box.whiskers = function(x) { + if (!arguments.length) return whiskers; + whiskers = x; + return box; + }; + + box.quartiles = function(x) { + if (!arguments.length) return quartiles; + quartiles = x; + return box; + }; + + return box; +}; + +function d3_chart_boxWhiskers(d) { + return [0, d.length - 1]; +} + +function d3_chart_boxQuartiles(d) { + return [ + d3.quantile(d, .25), + d3.quantile(d, .5), + d3.quantile(d, .75) + ]; +} +// Chart design based on the recommendations of Stephen Few. Implementation +// based on the work of Clint Ivy, Jamie Love, and Jason Davies. +// http://projects.instantcognition.com/protovis/bulletchart/ +d3.chart.bullet = function() { + var orient = "left", // TODO top & bottom + reverse = false, + duration = 0, + ranges = d3_chart_bulletRanges, + markers = d3_chart_bulletMarkers, + measures = d3_chart_bulletMeasures, + width = 380, + height = 30, + tickFormat = null; + + // For each small multiple… + function bullet(g) { + g.each(function(d, i) { + var rangez = ranges.call(this, d, i).slice().sort(d3.descending), + markerz = markers.call(this, d, i).slice().sort(d3.descending), + measurez = measures.call(this, d, i).slice().sort(d3.descending), + g = d3.select(this); + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) + .range(reverse ? [width, 0] : [0, width]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + // Derive width-scales from the x-scales. + var w0 = d3_chart_bulletWidth(x0), + w1 = d3_chart_bulletWidth(x1); + + // Update the range rects. + var range = g.selectAll("rect.range") + .data(rangez); + + range.enter().append("svg:rect") + .attr("class", function(d, i) { return "range s" + i; }) + .attr("width", w0) + .attr("height", height) + .attr("x", reverse ? x0 : 0) + .transition() + .duration(duration) + .attr("width", w1) + .attr("x", reverse ? x1 : 0); + + range.transition() + .duration(duration) + .attr("x", reverse ? x1 : 0) + .attr("width", w1) + .attr("height", height); + + // Update the measure rects. + var measure = g.selectAll("rect.measure") + .data(measurez); + + measure.enter().append("svg:rect") + .attr("class", function(d, i) { return "measure s" + i; }) + .attr("width", w0) + .attr("height", height / 3) + .attr("x", reverse ? x0 : 0) + .attr("y", height / 3) + .transition() + .duration(duration) + .attr("width", w1) + .attr("x", reverse ? x1 : 0); + + measure.transition() + .duration(duration) + .attr("width", w1) + .attr("height", height / 3) + .attr("x", reverse ? x1 : 0) + .attr("y", height / 3); + + // Update the marker lines. + var marker = g.selectAll("line.marker") + .data(markerz); + + marker.enter().append("svg:line") + .attr("class", "marker") + .attr("x1", x0) + .attr("x2", x0) + .attr("y1", height / 6) + .attr("y2", height * 5 / 6) + .transition() + .duration(duration) + .attr("x1", x1) + .attr("x2", x1); + + marker.transition() + .duration(duration) + .attr("x1", x1) + .attr("x2", x1) + .attr("y1", height / 6) + .attr("y2", height * 5 / 6); + + // Compute the tick format. + var format = tickFormat || x1.tickFormat(8); + + // Update the tick groups. + var tick = g.selectAll("g.tick") + .data(x1.ticks(8), function(d) { + return this.textContent || format(d); + }); + + // Initialize the ticks with the old scale, x0. + var tickEnter = tick.enter().append("svg:g") + .attr("class", "tick") + .attr("transform", d3_chart_bulletTranslate(x0)) + .style("opacity", 1e-6); + + tickEnter.append("svg:line") + .attr("y1", height) + .attr("y2", height * 7 / 6); + + tickEnter.append("svg:text") + .attr("text-anchor", "middle") + .attr("dy", "1em") + .attr("y", height * 7 / 6) + .text(format); + + // Transition the entering ticks to the new scale, x1. + tickEnter.transition() + .duration(duration) + .attr("transform", d3_chart_bulletTranslate(x1)) + .style("opacity", 1); + + // Transition the updating ticks to the new scale, x1. + var tickUpdate = tick.transition() + .duration(duration) + .attr("transform", d3_chart_bulletTranslate(x1)) + .style("opacity", 1); + + tickUpdate.select("line") + .attr("y1", height) + .attr("y2", height * 7 / 6); + + tickUpdate.select("text") + .attr("y", height * 7 / 6); + + // Transition the exiting ticks to the new scale, x1. + tick.exit().transition() + .duration(duration) + .attr("transform", d3_chart_bulletTranslate(x1)) + .style("opacity", 1e-6) + .remove(); + }); + d3.timer.flush(); + } + + // left, right, top, bottom + bullet.orient = function(x) { + if (!arguments.length) return orient; + orient = x; + reverse = orient == "right" || orient == "bottom"; + return bullet; + }; + + // ranges (bad, satisfactory, good) + bullet.ranges = function(x) { + if (!arguments.length) return ranges; + ranges = x; + return bullet; + }; + + // markers (previous, goal) + bullet.markers = function(x) { + if (!arguments.length) return markers; + markers = x; + return bullet; + }; + + // measures (actual, forecast) + bullet.measures = function(x) { + if (!arguments.length) return measures; + measures = x; + return bullet; + }; + + bullet.width = function(x) { + if (!arguments.length) return width; + width = x; + return bullet; + }; + + bullet.height = function(x) { + if (!arguments.length) return height; + height = x; + return bullet; + }; + + bullet.tickFormat = function(x) { + if (!arguments.length) return tickFormat; + tickFormat = x; + return bullet; + }; + + bullet.duration = function(x) { + if (!arguments.length) return duration; + duration = x; + return bullet; + }; + + return bullet; +}; + +function d3_chart_bulletRanges(d) { + return d.ranges; +} + +function d3_chart_bulletMarkers(d) { + return d.markers; +} + +function d3_chart_bulletMeasures(d) { + return d.measures; +} + +function d3_chart_bulletTranslate(x) { + return function(d) { + return "translate(" + x(d) + ",0)"; + }; +} + +function d3_chart_bulletWidth(x) { + var x0 = x(0); + return function(d) { + return Math.abs(x(d) - x0); + }; +} +// Implements a horizon layout, which is a variation of a single-series +// area chart where the area is folded into multiple bands. Color is used to +// encode band, allowing the size of the chart to be reduced significantly +// without impeding readability. This layout algorithm is based on the work of +// J. Heer, N. Kong and M. Agrawala in "Sizing the Horizon: The Effects of Chart +// Size and Layering on the Graphical Perception of Time Series Visualizations", +// CHI 2009. http://hci.stanford.edu/publications/2009/heer-horizon-chi09.pdf +d3.chart.horizon = function() { + var bands = 1, // between 1 and 5, typically + mode = "offset", // or mirror + interpolate = "linear", // or basis, monotone, step-before, etc. + x = d3_chart_horizonX, + y = d3_chart_horizonY, + w = 960, + h = 40, + duration = 0; + + var color = d3.scale.linear() + .domain([-1, 0, 1]) + .range(["#d62728", "#fff", "#1f77b4"]); + + // For each small multiple… + function horizon(g) { + g.each(function(d, i) { + var g = d3.select(this), + n = 2 * bands + 1, + xMin = Infinity, + xMax = -Infinity, + yMax = -Infinity, + x0, // old x-scale + y0, // old y-scale + id; // unique id for paths + + // Compute x- and y-values along with extents. + var data = d.map(function(d, i) { + var xv = x.call(this, d, i), + yv = y.call(this, d, i); + if (xv < xMin) xMin = xv; + if (xv > xMax) xMax = xv; + if (-yv > yMax) yMax = -yv; + if (yv > yMax) yMax = yv; + return [xv, yv]; + }); + + // Compute the new x- and y-scales. + var x1 = d3.scale.linear().domain([xMin, xMax]).range([0, w]), + y1 = d3.scale.linear().domain([0, yMax]).range([0, h * bands]); + + // Retrieve the old scales, if this is an update. + if (this.__chart__) { + x0 = this.__chart__.x; + y0 = this.__chart__.y; + id = this.__chart__.id; + } else { + x0 = d3.scale.linear().domain([0, Infinity]).range(x1.range()); + y0 = d3.scale.linear().domain([0, Infinity]).range(y1.range()); + id = ++d3_chart_horizonId; + } + + // We'll use a defs to store the area path and the clip path. + var defs = g.selectAll("defs") + .data([data]); + + var defsEnter = defs.enter().append("svg:defs"); + + // The clip path is a simple rect. + defsEnter.append("svg:clipPath") + .attr("id", "d3_chart_horizon_clip" + id) + .append("svg:rect") + .attr("width", w) + .attr("height", h); + + defs.select("rect").transition() + .duration(duration) + .attr("width", w) + .attr("height", h); + + // The area path is rendered with our resuable d3.svg.area. + defsEnter.append("svg:path") + .attr("id", "d3_chart_horizon_path" + id) + .attr("d", d3_chart_horizonArea + .interpolate(interpolate) + .x(function(d) { return x0(d[0]); }) + .y0(h * bands) + .y1(function(d) { return h * bands - y0(d[1]); })) + .transition() + .duration(duration) + .attr("d", d3_chart_horizonArea + .x(function(d) { return x1(d[0]); }) + .y1(function(d) { return h * bands - y1(d[1]); })); + + defs.select("path").transition() + .duration(duration) + .attr("d", d3_chart_horizonArea); + + // We'll use a container to clip all horizon layers at once. + g.selectAll("g") + .data([null]) + .enter().append("svg:g") + .attr("clip-path", "url(#d3_chart_horizon_clip" + id + ")"); + + // Define the transform function based on the mode. + var transform = mode == "offset" + ? function(d) { return "translate(0," + (d + (d < 0) - bands) * h + ")"; } + : function(d) { return (d < 0 ? "scale(1,-1)" : "") + "translate(0," + (d - bands) * h + ")"; }; + + // Instantiate each copy of the path with different transforms. + var u = g.select("g").selectAll("use") + .data(d3.range(-1, -bands - 1, -1).concat(d3.range(1, bands + 1)), Number); + + // TODO don't fudge the enter transition + u.enter().append("svg:use") + .attr("xlink:href", "#d3_chart_horizon_path" + id) + .attr("transform", function(d) { return transform(d + (d > 0 ? 1 : -1)); }) + .style("fill", color) + .transition() + .duration(duration) + .attr("transform", transform); + + u.transition() + .duration(duration) + .attr("transform", transform) + .style("fill", color); + + u.exit().transition() + .duration(duration) + .attr("transform", transform) + .remove(); + + // Stash the new scales. + this.__chart__ = {x: x1, y: y1, id: id}; + }); + d3.timer.flush(); + } + + horizon.duration = function(x) { + if (!arguments.length) return duration; + duration = +x; + return horizon; + }; + + horizon.bands = function(x) { + if (!arguments.length) return bands; + bands = +x; + color.domain([-bands, 0, bands]); + return horizon; + }; + + horizon.mode = function(x) { + if (!arguments.length) return mode; + mode = x + ""; + return horizon; + }; + + horizon.colors = function(x) { + if (!arguments.length) return color.range(); + color.range(x); + return horizon; + }; + + horizon.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x + ""; + return horizon; + }; + + horizon.x = function(z) { + if (!arguments.length) return x; + x = z; + return horizon; + }; + + horizon.y = function(z) { + if (!arguments.length) return y; + y = z; + return horizon; + }; + + horizon.width = function(x) { + if (!arguments.length) return w; + w = +x; + return horizon; + }; + + horizon.height = function(x) { + if (!arguments.length) return h; + h = +x; + return horizon; + }; + + return horizon; +}; + +var d3_chart_horizonArea = d3.svg.area(), + d3_chart_horizonId = 0; + +function d3_chart_horizonX(d) { + return d[0]; +} + +function d3_chart_horizonY(d) { + return d[1]; +} +// Based on http://vis.stanford.edu/protovis/ex/qqplot.html +d3.chart.qq = function() { + var width = 1, + height = 1, + duration = 0, + domain = null, + tickFormat = null, + n = 100, + x = d3_chart_qqX, + y = d3_chart_qqY; + + // For each small multiple… + function qq(g) { + g.each(function(d, i) { + var g = d3.select(this), + qx = d3_chart_qqQuantiles(n, x.call(this, d, i)), + qy = d3_chart_qqQuantiles(n, y.call(this, d, i)), + xd = domain && domain.call(this, d, i) || [d3.min(qx), d3.max(qx)], // new x-domain + yd = domain && domain.call(this, d, i) || [d3.min(qy), d3.max(qy)], // new y-domain + x0, // old x-scale + y0; // old y-scale + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain(xd) + .range([0, width]); + + // Compute the new y-scale. + var y1 = d3.scale.linear() + .domain(yd) + .range([height, 0]); + + // Retrieve the old scales, if this is an update. + if (this.__chart__) { + x0 = this.__chart__.x; + y0 = this.__chart__.y; + } else { + x0 = d3.scale.linear().domain([0, Infinity]).range(x1.range()); + y0 = d3.scale.linear().domain([0, Infinity]).range(y1.range()); + } + + // Stash the new scales. + this.__chart__ = {x: x1, y: y1}; + + // Update diagonal line. + var diagonal = g.selectAll("line.diagonal") + .data([null]); + + diagonal.enter().append("svg:line") + .attr("class", "diagonal") + .attr("x1", x1(yd[0])) + .attr("y1", y1(xd[0])) + .attr("x2", x1(yd[1])) + .attr("y2", y1(xd[1])); + + diagonal.transition() + .duration(duration) + .attr("x1", x1(yd[0])) + .attr("y1", y1(xd[0])) + .attr("x2", x1(yd[1])) + .attr("y2", y1(xd[1])); + + // Update quantile plots. + var circle = g.selectAll("circle") + .data(d3.range(n).map(function(i) { + return {x: qx[i], y: qy[i]}; + })); + + circle.enter().append("svg:circle") + .attr("class", "quantile") + .attr("r", 4.5) + .attr("cx", function(d) { return x0(d.x); }) + .attr("cy", function(d) { return y0(d.y); }) + .style("opacity", 1e-6) + .transition() + .duration(duration) + .attr("cx", function(d) { return x1(d.x); }) + .attr("cy", function(d) { return y1(d.y); }) + .style("opacity", 1); + + circle.transition() + .duration(duration) + .attr("cx", function(d) { return x1(d.x); }) + .attr("cy", function(d) { return y1(d.y); }) + .style("opacity", 1); + + circle.exit().transition() + .duration(duration) + .attr("cx", function(d) { return x1(d.x); }) + .attr("cy", function(d) { return y1(d.y); }) + .style("opacity", 1e-6) + .remove(); + + var xformat = tickFormat || x1.tickFormat(4), + yformat = tickFormat || y1.tickFormat(4), + tx = function(d) { return "translate(" + x1(d) + "," + height + ")"; }, + ty = function(d) { return "translate(0," + y1(d) + ")"; }; + + // Update x-ticks. + var xtick = g.selectAll("g.x.tick") + .data(x1.ticks(4), function(d) { + return this.textContent || xformat(d); + }); + + var xtickEnter = xtick.enter().append("svg:g") + .attr("class", "x tick") + .attr("transform", function(d) { return "translate(" + x0(d) + "," + height + ")"; }) + .style("opacity", 1e-6); + + xtickEnter.append("svg:line") + .attr("y1", 0) + .attr("y2", -6); + + xtickEnter.append("svg:text") + .attr("text-anchor", "middle") + .attr("dy", "1em") + .text(xformat); + + // Transition the entering ticks to the new scale, x1. + xtickEnter.transition() + .duration(duration) + .attr("transform", tx) + .style("opacity", 1); + + // Transition the updating ticks to the new scale, x1. + xtick.transition() + .duration(duration) + .attr("transform", tx) + .style("opacity", 1); + + // Transition the exiting ticks to the new scale, x1. + xtick.exit().transition() + .duration(duration) + .attr("transform", tx) + .style("opacity", 1e-6) + .remove(); + + // Update ticks. + var ytick = g.selectAll("g.y.tick") + .data(y1.ticks(4), function(d) { + return this.textContent || yformat(d); + }); + + var ytickEnter = ytick.enter().append("svg:g") + .attr("class", "y tick") + .attr("transform", function(d) { return "translate(0," + y0(d) + ")"; }) + .style("opacity", 1e-6); + + ytickEnter.append("svg:line") + .attr("x1", 0) + .attr("x2", 6); + + ytickEnter.append("svg:text") + .attr("text-anchor", "end") + .attr("dx", "-.5em") + .attr("dy", ".3em") + .text(yformat); + + // Transition the entering ticks to the new scale, y1. + ytickEnter.transition() + .duration(duration) + .attr("transform", ty) + .style("opacity", 1); + + // Transition the updating ticks to the new scale, y1. + ytick.transition() + .duration(duration) + .attr("transform", ty) + .style("opacity", 1); + + // Transition the exiting ticks to the new scale, y1. + ytick.exit().transition() + .duration(duration) + .attr("transform", ty) + .style("opacity", 1e-6) + .remove(); + }); + } + + qq.width = function(x) { + if (!arguments.length) return width; + width = x; + return qq; + }; + + qq.height = function(x) { + if (!arguments.length) return height; + height = x; + return qq; + }; + + qq.duration = function(x) { + if (!arguments.length) return duration; + duration = x; + return qq; + }; + + qq.domain = function(x) { + if (!arguments.length) return domain; + domain = x == null ? x : d3.functor(x); + return qq; + }; + + qq.count = function(z) { + if (!arguments.length) return n; + n = z; + return qq; + }; + + qq.x = function(z) { + if (!arguments.length) return x; + x = z; + return qq; + }; + + qq.y = function(z) { + if (!arguments.length) return y; + y = z; + return qq; + }; + + qq.tickFormat = function(x) { + if (!arguments.length) return tickFormat; + tickFormat = x; + return qq; + }; + + return qq; +}; + +function d3_chart_qqQuantiles(n, values) { + var m = values.length - 1; + values = values.slice().sort(d3.ascending); + return d3.range(n).map(function(i) { + return values[~~(i * m / n)]; + }); +} + +function d3_chart_qqX(d) { + return d.x; +} + +function d3_chart_qqY(d) { + return d.y; +} +})(); diff --git a/static/vendor/d3-2.7.5/d3.chart.min.js b/static/vendor/d3-2.7.5/d3.chart.min.js new file mode 100644 index 0000000..464690d --- /dev/null +++ b/static/vendor/d3-2.7.5/d3.chart.min.js @@ -0,0 +1 @@ +(function(){function a(a){return[0,a.length-1]}function b(a){return[d3.quantile(a,.25),d3.quantile(a,.5),d3.quantile(a,.75)]}function c(a){return a.ranges}function d(a){return a.markers}function e(a){return a.measures}function f(a){return function(b){return"translate("+a(b)+",0)"}}function g(a){var b=a(0);return function(c){return Math.abs(a(c)-b)}}function j(a){return a[0]}function k(a){return a[1]}function l(a,b){var c=b.length-1;return b=b.slice().sort(d3.ascending),d3.range(a).map(function(d){return b[~~(d*c/a)]})}function m(a){return a.x}function n(a){return a.y}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;return k.width=function(a){return arguments.length?(c=a,k):c},k.height=function(a){return arguments.length?(d=a,k):d},k.tickFormat=function(a){return arguments.length?(j=a,k):j},k.duration=function(a){return arguments.length?(e=a,k):e},k.domain=function(a){return arguments.length?(f=a==null?a:d3.functor(a),k):f},k.value=function(a){return arguments.length?(g=a,k):g},k.whiskers=function(a){return arguments.length?(h=a,k):h},k.quartiles=function(a){return arguments.length?(i=a,k):i},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;return o.orient=function(c){return arguments.length?(a=c,b=a=="right"||a=="bottom",o):a},o.ranges=function(a){return arguments.length?(i=a,o):i},o.markers=function(a){return arguments.length?(j=a,o):j},o.measures=function(a){return arguments.length?(k=a,o):k},o.width=function(a){return arguments.length?(l=a,o):l},o.height=function(a){return arguments.length?(m=a,o):m},o.tickFormat=function(a){return arguments.length?(n=a,o):n},o.duration=function(a){return arguments.length?(h=a,o):h},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);return cq&&(q=c),-f>r&&(r=-f),f>r&&(r=f),[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"]);return n.duration=function(a){return arguments.length?(l=+a,n):l},n.bands=function(b){return arguments.length?(a=+b,m.domain([-a,0,a]),n):a},n.mode=function(a){return arguments.length?(b=a+"",n):b},n.colors=function(a){return arguments.length?(m.range(a),n):m.range()},n.interpolate=function(a){return arguments.length?(c=a+"",n):c},n.x=function(a){return arguments.length?(d=a,n):d},n.y=function(a){return arguments.length?(e=a,n):e},n.width=function(a){return arguments.length?(f=+a,n):f},n.height=function(a){return arguments.length?(g=+a,n):g},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;return i.width=function(b){return arguments.length?(a=b,i):a},i.height=function(a){return arguments.length?(b=a,i):b},i.duration=function(a){return arguments.length?(c=a,i):c},i.domain=function(a){return arguments.length?(d=a==null?a:d3.functor(a),i):d},i.count=function(a){return arguments.length?(f=a,i):f},i.x=function(a){return arguments.length?(g=a,i):g},i.y=function(a){return arguments.length?(h=a,i):h},i.tickFormat=function(a){return arguments.length?(e=a,i):e},i}})(); \ No newline at end of file diff --git a/static/vendor/d3-2.7.5/d3.csv.js b/static/vendor/d3-2.7.5/d3.csv.js new file mode 100644 index 0000000..7565b83 --- /dev/null +++ b/static/vendor/d3-2.7.5/d3.csv.js @@ -0,0 +1,92 @@ +(function(){d3.csv = function(url, callback) { + d3.text(url, "text/csv", function(text) { + callback(text && d3.csv.parse(text)); + }); +}; +d3.csv.parse = function(text) { + var header; + return d3.csv.parseRows(text, function(row, i) { + if (i) { + var o = {}, j = -1, m = header.length; + while (++j < m) o[header[j]] = row[j]; + return o; + } else { + header = row; + return null; + } + }); +}; + +d3.csv.parseRows = function(text, f) { + var EOL = {}, // sentinel value for end-of-line + EOF = {}, // sentinel value for end-of-file + rows = [], // output rows + re = /\r\n|[,\r\n]/g, // field separator regex + n = 0, // the current line number + t, // the current token + eol; // is the current token followed by EOL? + + re.lastIndex = 0; // work-around bug in FF 3.6 + + /** @private Returns the next token. */ + function token() { + if (re.lastIndex >= text.length) return EOF; // special case: end of file + if (eol) { eol = false; return EOL; } // special case: end of line + + // special case: quotes + var j = re.lastIndex; + if (text.charCodeAt(j) === 34) { + var i = j; + while (i++ < text.length) { + if (text.charCodeAt(i) === 34) { + if (text.charCodeAt(i + 1) !== 34) break; + i++; + } + } + re.lastIndex = i + 2; + var c = text.charCodeAt(i + 1); + if (c === 13) { + eol = true; + if (text.charCodeAt(i + 2) === 10) re.lastIndex++; + } else if (c === 10) { + eol = true; + } + return text.substring(j + 1, i).replace(/""/g, "\""); + } + + // common case + var m = re.exec(text); + if (m) { + eol = m[0].charCodeAt(0) !== 44; + return text.substring(j, m.index); + } + re.lastIndex = text.length; + return text.substring(j); + } + + while ((t = token()) !== EOF) { + var a = []; + while ((t !== EOL) && (t !== EOF)) { + a.push(t); + t = token(); + } + if (f && !(a = f(a, n++))) continue; + rows.push(a); + } + + return rows; +}; +d3.csv.format = function(rows) { + return rows.map(d3_csv_formatRow).join("\n"); +}; + +function d3_csv_formatRow(row) { + return row.map(d3_csv_formatValue).join(","); +} + +function d3_csv_formatValue(text) { + return /[",\n]/.test(text) + ? "\"" + text.replace(/\"/g, "\"\"") + "\"" + : text; +} +})(); diff --git a/static/vendor/d3-2.7.5/d3.csv.min.js b/static/vendor/d3-2.7.5/d3.csv.min.js new file mode 100644 index 0000000..3a384ea --- /dev/null +++ b/static/vendor/d3-2.7.5/d3.csv.min.js @@ -0,0 +1 @@ +(function(){function a(a){return a.map(b).join(",")}function b(a){return/[",\n]/.test(a)?'"'+a.replace(/\"/g,'""')+'"':a}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=a.length)return d;if(i)return i=!1,c;var b=f.lastIndex;if(a.charCodeAt(b)===34){var e=b;while(e++ 50 ? alaska + : lon < -140 ? hawaii + : lat < 21 ? puertoRico + : lower48)(coordinates); + } + + albersUsa.scale = function(x) { + if (!arguments.length) return lower48.scale(); + lower48.scale(x); + alaska.scale(x * .6); + hawaii.scale(x); + puertoRico.scale(x * 1.5); + return albersUsa.translate(lower48.translate()); + }; + + albersUsa.translate = function(x) { + if (!arguments.length) return lower48.translate(); + var dz = lower48.scale() / 1000, + dx = x[0], + dy = x[1]; + lower48.translate(x); + alaska.translate([dx - 400 * dz, dy + 170 * dz]); + hawaii.translate([dx - 190 * dz, dy + 200 * dz]); + puertoRico.translate([dx + 580 * dz, dy + 430 * dz]); + return albersUsa; + }; + + return albersUsa.scale(lower48.scale()); +}; +d3.geo.bonne = function() { + var scale = 200, + translate = [480, 250], + x0, // origin longitude in radians + y0, // origin latitude in radians + y1, // parallel latitude in radians + c1; // cot(y1) + + function bonne(coordinates) { + var x = coordinates[0] * d3_geo_radians - x0, + y = coordinates[1] * d3_geo_radians - y0; + if (y1) { + var p = c1 + y1 - y, E = x * Math.cos(y) / p; + x = p * Math.sin(E); + y = p * Math.cos(E) - c1; + } else { + x *= Math.cos(y); + y *= -1; + } + return [ + scale * x + translate[0], + scale * y + translate[1] + ]; + } + + bonne.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, + y = (coordinates[1] - translate[1]) / scale; + if (y1) { + var c = c1 + y, p = Math.sqrt(x * x + c * c); + y = c1 + y1 - p; + x = x0 + p * Math.atan2(x, c) / Math.cos(y); + } else { + y *= -1; + x /= Math.cos(y); + } + return [ + x / d3_geo_radians, + y / d3_geo_radians + ]; + }; + + // 90° for Werner, 0° for Sinusoidal + bonne.parallel = function(x) { + if (!arguments.length) return y1 / d3_geo_radians; + c1 = 1 / Math.tan(y1 = x * d3_geo_radians); + return bonne; + }; + + bonne.origin = function(x) { + if (!arguments.length) return [x0 / d3_geo_radians, y0 / d3_geo_radians]; + x0 = x[0] * d3_geo_radians; + y0 = x[1] * d3_geo_radians; + return bonne; + }; + + bonne.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return bonne; + }; + + bonne.translate = function(x) { + if (!arguments.length) return translate; + translate = [+x[0], +x[1]]; + return bonne; + }; + + return bonne.origin([0, 0]).parallel(45); +}; +d3.geo.equirectangular = function() { + var scale = 500, + translate = [480, 250]; + + function equirectangular(coordinates) { + var x = coordinates[0] / 360, + y = -coordinates[1] / 360; + return [ + scale * x + translate[0], + scale * y + translate[1] + ]; + } + + equirectangular.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, + y = (coordinates[1] - translate[1]) / scale; + return [ + 360 * x, + -360 * y + ]; + }; + + equirectangular.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return equirectangular; + }; + + equirectangular.translate = function(x) { + if (!arguments.length) return translate; + translate = [+x[0], +x[1]]; + return equirectangular; + }; + + return equirectangular; +}; +d3.geo.mercator = function() { + var scale = 500, + translate = [480, 250]; + + function mercator(coordinates) { + var x = coordinates[0] / 360, + y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360; + return [ + scale * x + translate[0], + scale * Math.max(-.5, Math.min(.5, y)) + translate[1] + ]; + } + + mercator.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, + y = (coordinates[1] - translate[1]) / scale; + return [ + 360 * x, + 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90 + ]; + }; + + mercator.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return mercator; + }; + + mercator.translate = function(x) { + if (!arguments.length) return translate; + translate = [+x[0], +x[1]]; + return mercator; + }; + + return mercator; +}; +function d3_geo_type(types, defaultValue) { + return function(object) { + return object && object.type in types ? types[object.type](object) : defaultValue; + }; +} +/** + * Returns a function that, given a GeoJSON object (e.g., a feature), returns + * the corresponding SVG path. The function can be customized by overriding the + * projection. Point features are mapped to circles with a default radius of + * 4.5px; the radius can be specified either as a constant or a function that + * is evaluated per object. + */ +d3.geo.path = function() { + var pointRadius = 4.5, + pointCircle = d3_path_circle(pointRadius), + projection = d3.geo.albersUsa(); + + function path(d, i) { + if (typeof pointRadius === "function") { + pointCircle = d3_path_circle(pointRadius.apply(this, arguments)); + } + return pathType(d) || null; + } + + function project(coordinates) { + return projection(coordinates).join(","); + } + + var pathType = d3_geo_type({ + + FeatureCollection: function(o) { + var path = [], + features = o.features, + i = -1, // features.index + n = features.length; + while (++i < n) path.push(pathType(features[i].geometry)); + return path.join(""); + }, + + Feature: function(o) { + return pathType(o.geometry); + }, + + Point: function(o) { + return "M" + project(o.coordinates) + pointCircle; + }, + + MultiPoint: function(o) { + var path = [], + coordinates = o.coordinates, + i = -1, // coordinates.index + n = coordinates.length; + while (++i < n) path.push("M", project(coordinates[i]), pointCircle); + return path.join(""); + }, + + LineString: function(o) { + var path = ["M"], + coordinates = o.coordinates, + i = -1, // coordinates.index + n = coordinates.length; + while (++i < n) path.push(project(coordinates[i]), "L"); + path.pop(); + return path.join(""); + }, + + MultiLineString: function(o) { + var path = [], + coordinates = o.coordinates, + i = -1, // coordinates.index + n = coordinates.length, + subcoordinates, // coordinates[i] + j, // subcoordinates.index + m; // subcoordinates.length + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + m = subcoordinates.length; + path.push("M"); + while (++j < m) path.push(project(subcoordinates[j]), "L"); + path.pop(); + } + return path.join(""); + }, + + Polygon: function(o) { + var path = [], + coordinates = o.coordinates, + i = -1, // coordinates.index + n = coordinates.length, + subcoordinates, // coordinates[i] + j, // subcoordinates.index + m; // subcoordinates.length + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + if ((m = subcoordinates.length - 1) > 0) { + path.push("M"); + while (++j < m) path.push(project(subcoordinates[j]), "L"); + path[path.length - 1] = "Z"; + } + } + return path.join(""); + }, + + MultiPolygon: function(o) { + var path = [], + coordinates = o.coordinates, + i = -1, // coordinates index + n = coordinates.length, + subcoordinates, // coordinates[i] + j, // subcoordinates index + m, // subcoordinates.length + subsubcoordinates, // subcoordinates[j] + k, // subsubcoordinates index + p; // subsubcoordinates.length + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + m = subcoordinates.length; + while (++j < m) { + subsubcoordinates = subcoordinates[j]; + k = -1; + if ((p = subsubcoordinates.length - 1) > 0) { + path.push("M"); + while (++k < p) path.push(project(subsubcoordinates[k]), "L"); + path[path.length - 1] = "Z"; + } + } + } + return path.join(""); + }, + + GeometryCollection: function(o) { + var path = [], + geometries = o.geometries, + i = -1, // geometries index + n = geometries.length; + while (++i < n) path.push(pathType(geometries[i])); + return path.join(""); + } + + }); + + var areaType = path.area = d3_geo_type({ + + FeatureCollection: function(o) { + var area = 0, + features = o.features, + i = -1, // features.index + n = features.length; + while (++i < n) area += areaType(features[i]); + return area; + }, + + Feature: function(o) { + return areaType(o.geometry); + }, + + Polygon: function(o) { + return polygonArea(o.coordinates); + }, + + MultiPolygon: function(o) { + var sum = 0, + coordinates = o.coordinates, + i = -1, // coordinates index + n = coordinates.length; + while (++i < n) sum += polygonArea(coordinates[i]); + return sum; + }, + + GeometryCollection: function(o) { + var sum = 0, + geometries = o.geometries, + i = -1, // geometries index + n = geometries.length; + while (++i < n) sum += areaType(geometries[i]); + return sum; + } + + }, 0); + + function polygonArea(coordinates) { + var sum = area(coordinates[0]), // exterior ring + i = 0, // coordinates.index + n = coordinates.length; + while (++i < n) sum -= area(coordinates[i]); // holes + return sum; + } + + function polygonCentroid(coordinates) { + var polygon = d3.geom.polygon(coordinates[0].map(projection)), // exterior ring + area = polygon.area(), + centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1), + x = centroid[0], + y = centroid[1], + z = area, + i = 0, // coordinates index + n = coordinates.length; + while (++i < n) { + polygon = d3.geom.polygon(coordinates[i].map(projection)); // holes + area = polygon.area(); + centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1); + x -= centroid[0]; + y -= centroid[1]; + z -= area; + } + return [x, y, 6 * z]; // weighted centroid + } + + var centroidType = path.centroid = d3_geo_type({ + + // TODO FeatureCollection + // TODO Point + // TODO MultiPoint + // TODO LineString + // TODO MultiLineString + // TODO GeometryCollection + + Feature: function(o) { + return centroidType(o.geometry); + }, + + Polygon: function(o) { + var centroid = polygonCentroid(o.coordinates); + return [centroid[0] / centroid[2], centroid[1] / centroid[2]]; + }, + + MultiPolygon: function(o) { + var area = 0, + coordinates = o.coordinates, + centroid, + x = 0, + y = 0, + z = 0, + i = -1, // coordinates index + n = coordinates.length; + while (++i < n) { + centroid = polygonCentroid(coordinates[i]); + x += centroid[0]; + y += centroid[1]; + z += centroid[2]; + } + return [x / z, y / z]; + } + + }); + + function area(coordinates) { + return Math.abs(d3.geom.polygon(coordinates.map(projection)).area()); + } + + path.projection = function(x) { + projection = x; + return path; + }; + + path.pointRadius = function(x) { + if (typeof x === "function") pointRadius = x; + else { + pointRadius = +x; + pointCircle = d3_path_circle(pointRadius); + } + return path; + }; + + return path; +}; + +function d3_path_circle(radius) { + return "m0," + radius + + "a" + radius + "," + radius + " 0 1,1 0," + (-2 * radius) + + "a" + radius + "," + radius + " 0 1,1 0," + (+2 * radius) + + "z"; +} +/** + * Given a GeoJSON object, returns the corresponding bounding box. The bounding + * box is represented by a two-dimensional array: [[left, bottom], [right, + * top]], where left is the minimum longitude, bottom is the minimum latitude, + * right is maximum longitude, and top is the maximum latitude. + */ +d3.geo.bounds = function(feature) { + var left = Infinity, + bottom = Infinity, + right = -Infinity, + top = -Infinity; + d3_geo_bounds(feature, function(x, y) { + if (x < left) left = x; + if (x > right) right = x; + if (y < bottom) bottom = y; + if (y > top) top = y; + }); + return [[left, bottom], [right, top]]; +}; + +function d3_geo_bounds(o, f) { + if (o.type in d3_geo_boundsTypes) d3_geo_boundsTypes[o.type](o, f); +} + +var d3_geo_boundsTypes = { + Feature: d3_geo_boundsFeature, + FeatureCollection: d3_geo_boundsFeatureCollection, + GeometryCollection: d3_geo_boundsGeometryCollection, + LineString: d3_geo_boundsLineString, + MultiLineString: d3_geo_boundsMultiLineString, + MultiPoint: d3_geo_boundsLineString, + MultiPolygon: d3_geo_boundsMultiPolygon, + Point: d3_geo_boundsPoint, + Polygon: d3_geo_boundsPolygon +}; + +function d3_geo_boundsFeature(o, f) { + d3_geo_bounds(o.geometry, f); +} + +function d3_geo_boundsFeatureCollection(o, f) { + for (var a = o.features, i = 0, n = a.length; i < n; i++) { + d3_geo_bounds(a[i].geometry, f); + } +} + +function d3_geo_boundsGeometryCollection(o, f) { + for (var a = o.geometries, i = 0, n = a.length; i < n; i++) { + d3_geo_bounds(a[i], f); + } +} + +function d3_geo_boundsLineString(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + f.apply(null, a[i]); + } +} + +function d3_geo_boundsMultiLineString(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + for (var b = a[i], j = 0, m = b.length; j < m; j++) { + f.apply(null, b[j]); + } + } +} + +function d3_geo_boundsMultiPolygon(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + for (var b = a[i][0], j = 0, m = b.length; j < m; j++) { + f.apply(null, b[j]); + } + } +} + +function d3_geo_boundsPoint(o, f) { + f.apply(null, o.coordinates); +} + +function d3_geo_boundsPolygon(o, f) { + for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) { + f.apply(null, a[i]); + } +} +// TODO breakAtDateLine? + +d3.geo.circle = function() { + var origin = [0, 0], + degrees = 90 - 1e-2, + radians = degrees * d3_geo_radians, + arc = d3.geo.greatArc().target(Object); + + function circle() { + // TODO render a circle as a Polygon + } + + function visible(point) { + return arc.distance(point) < radians; + } + + circle.clip = function(d) { + arc.source(typeof origin === "function" ? origin.apply(this, arguments) : origin); + return clipType(d); + }; + + var clipType = d3_geo_type({ + + FeatureCollection: function(o) { + var features = o.features.map(clipType).filter(Object); + return features && (o = Object.create(o), o.features = features, o); + }, + + Feature: function(o) { + var geometry = clipType(o.geometry); + return geometry && (o = Object.create(o), o.geometry = geometry, o); + }, + + Point: function(o) { + return visible(o.coordinates) && o; + }, + + MultiPoint: function(o) { + var coordinates = o.coordinates.filter(visible); + return coordinates.length && { + type: o.type, + coordinates: coordinates + }; + }, + + LineString: function(o) { + var coordinates = clip(o.coordinates); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + + MultiLineString: function(o) { + var coordinates = o.coordinates.map(clip).filter(function(d) { return d.length; }); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + + Polygon: function(o) { + var coordinates = o.coordinates.map(clip); + return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + + MultiPolygon: function(o) { + var coordinates = o.coordinates.map(function(d) { return d.map(clip); }).filter(function(d) { return d[0].length; }); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + + GeometryCollection: function(o) { + var geometries = o.geometries.map(clipType).filter(Object); + return geometries.length && (o = Object.create(o), o.geometries = geometries, o); + } + + }); + + function clip(coordinates) { + var i = -1, + n = coordinates.length, + clipped = [], + p0, + p1, + p2, + d0, + d1; + + while (++i < n) { + d1 = arc.distance(p2 = coordinates[i]); + if (d1 < radians) { + if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1))); + clipped.push(p2); + p0 = p1 = null; + } else { + p1 = p2; + if (!p0 && clipped.length) { + clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0))); + p0 = p1; + } + } + d0 = d1; + } + + if (p1 && clipped.length) { + d1 = arc.distance(p2 = clipped[0]); + clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1))); + } + + return resample(clipped); + } + + // Resample coordinates, creating great arcs between each. + function resample(coordinates) { + var i = 0, + n = coordinates.length, + j, + m, + resampled = n ? [coordinates[0]] : coordinates, + resamples, + origin = arc.source(); + + while (++i < n) { + resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates; + for (j = 0, m = resamples.length; ++j < m;) resampled.push(resamples[j]); + } + + arc.source(origin); + return resampled; + } + + circle.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return circle; + }; + + circle.angle = function(x) { + if (!arguments.length) return degrees; + radians = (degrees = +x) * d3_geo_radians; + return circle; + }; + + // Precision is specified in degrees. + circle.precision = function(x) { + if (!arguments.length) return arc.precision(); + arc.precision(x); + return circle; + }; + + return circle; +} +d3.geo.greatArc = function() { + var source = d3_geo_greatArcSource, + target = d3_geo_greatArcTarget, + precision = 6 * d3_geo_radians; + + function greatArc() { + var a = typeof source === "function" ? source.apply(this, arguments) : source, + b = typeof target === "function" ? target.apply(this, arguments) : target, + i = d3_geo_greatArcInterpolate(a, b), + dt = precision / i.d, + t = 0, + coordinates = [a]; + while ((t += dt) < 1) coordinates.push(i(t)); + coordinates.push(b); + return { + type: "LineString", + coordinates: coordinates + }; + } + + // Length returned in radians; multiply by radius for distance. + greatArc.distance = function() { + var a = typeof source === "function" ? source.apply(this, arguments) : source, + b = typeof target === "function" ? target.apply(this, arguments) : target; + return d3_geo_greatArcInterpolate(a, b).d; + }; + + greatArc.source = function(x) { + if (!arguments.length) return source; + source = x; + return greatArc; + }; + + greatArc.target = function(x) { + if (!arguments.length) return target; + target = x; + return greatArc; + }; + + // Precision is specified in degrees. + greatArc.precision = function(x) { + if (!arguments.length) return precision / d3_geo_radians; + precision = x * d3_geo_radians; + return greatArc; + }; + + return greatArc; +}; + +function d3_geo_greatArcSource(d) { + return d.source; +} + +function d3_geo_greatArcTarget(d) { + return d.target; +} + +function d3_geo_greatArcInterpolate(a, b) { + var x0 = a[0] * d3_geo_radians, cx0 = Math.cos(x0), sx0 = Math.sin(x0), + y0 = a[1] * d3_geo_radians, cy0 = Math.cos(y0), sy0 = Math.sin(y0), + x1 = b[0] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1), + y1 = b[1] * d3_geo_radians, cy1 = Math.cos(y1), sy1 = Math.sin(y1), + d = interpolate.d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))), + sd = Math.sin(d); + + // From http://williams.best.vwh.net/avform.htm#Intermediate + function interpolate(t) { + var A = Math.sin(d - (t *= d)) / sd, + B = Math.sin(t) / sd, + x = A * cy0 * cx0 + B * cy1 * cx1, + y = A * cy0 * sx0 + B * cy1 * sx1, + z = A * sy0 + B * sy1; + return [ + Math.atan2(y, x) / d3_geo_radians, + Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians + ]; + } + + return interpolate; +} +d3.geo.greatCircle = d3.geo.circle; +})(); diff --git a/static/vendor/d3-2.7.5/d3.geo.min.js b/static/vendor/d3-2.7.5/d3.geo.min.js new file mode 100644 index 0000000..a4fcd24 --- /dev/null +++ b/static/vendor/d3-2.7.5/d3.geo.min.js @@ -0,0 +1 @@ +(function(){function b(a,b){return function(c){return c&&c.type in a?a[c.type](c):b}}function c(a){return"m0,"+a+"a"+a+","+a+" 0 1,1 0,"+ -2*a+"a"+a+","+a+" 0 1,1 0,"+2*a+"z"}function d(a,b){a.type in e&&e[a.type](a,b)}function f(a,b){d(a.geometry,b)}function g(a,b){for(var c=a.features,e=0,f=c.length;e50?b:f<-140?c:g<21?d:a)(e)}var a=d3.geo.albers(),b=d3.geo.albers().origin([-160,60]).parallels([55,65]),c=d3.geo.albers().origin([-160,20]).parallels([8,18]),d=d3.geo.albers().origin([-60,10]).parallels([8,18]);return e.scale=function(f){return arguments.length?(a.scale(f),b.scale(f*.6),c.scale(f),d.scale(f*1.5),e.translate(a.translate())):a.scale()},e.translate=function(f){if(!arguments.length)return a.translate();var g=a.scale()/1e3,h=f[0],i=f[1];return a.translate(f),b.translate([h-400*g,i+170*g]),c.translate([h-190*g,i+200*g]),d.translate([h+580*g,i+430*g]),e},e.scale(a.scale())},d3.geo.bonne=function(){function h(h){var i=h[0]*a-d,j=h[1]*a-e;if(f){var k=g+f-j,l=i*Math.cos(j)/k;i=k*Math.sin(l),j=k*Math.cos(l)-g}else i*=Math.cos(j),j*=-1;return[b*i+c[0],b*j+c[1]]}var b=200,c=[480,250],d,e,f,g;return h.invert=function(e){var h=(e[0]-c[0])/b,i=(e[1]-c[1])/b;if(f){var j=g+i,k=Math.sqrt(h*h+j*j);i=g+f-k,h=d+k*Math.atan2(h,j)/Math.cos(i)}else i*=-1,h/=Math.cos(i);return[h/a,i/a]},h.parallel=function(b){return arguments.length?(g=1/Math.tan(f=b*a),h):f/a},h.origin=function(b){return arguments.length?(d=b[0]*a,e=b[1]*a,h):[d/a,e/a]},h.scale=function(a){return arguments.length?(b=+a,h):b},h.translate=function(a){return arguments.length?(c=[+a[0],+a[1]],h):c},h.origin([0,0]).parallel(45)},d3.geo.equirectangular=function(){function c(c){var d=c[0]/360,e=-c[1]/360;return[a*d+b[0],a*e+b[1]]}var a=500,b=[480,250];return c.invert=function(c){var d=(c[0]-b[0])/a,e=(c[1]-b[1])/a;return[360*d,-360*e]},c.scale=function(b){return arguments.length?(a=+b,c):a},c.translate=function(a){return arguments.length?(b=[+a[0],+a[1]],c):b},c},d3.geo.mercator=function(){function d(d){var e=d[0]/360,f=-(Math.log(Math.tan(Math.PI/4+d[1]*a/2))/a)/360;return[b*e+c[0],b*Math.max(-0.5,Math.min(.5,f))+c[1]]}var b=500,c=[480,250];return d.invert=function(d){var e=(d[0]-c[0])/b,f=(d[1]-c[1])/b;return[360*e,2*Math.atan(Math.exp(-360*f*a))/a-90]},d.scale=function(a){return arguments.length?(b=+a,d):b},d.translate=function(a){return arguments.length?(c=[+a[0],+a[1]],d):c},d},d3.geo.path=function(){function f(b,e){return typeof a=="function"&&(d=c(a.apply(this,arguments))),h(b)||null}function g(a){return e(a).join(",")}function j(a){var b=m(a[0]),c=0,d=a.length;while(++c0){b.push("M");while(++h0){b.push("M");while(++ke&&(e=a),df&&(f=d)}),[[b,c],[e,f]]};var e={Feature:f,FeatureCollection:g,GeometryCollection:h,LineString:i,MultiLineString:j,MultiPoint:i,MultiPolygon:k,Point:l,Polygon:m};d3.geo.circle=function(){function g(){}function h(a){return f.distance(a)marching + * squares algorithm. Returns the contour polygon as an array of points. + * + * @param grid a two-input function(x, y) that returns true for values + * inside the contour and false for values outside the contour. + * @param start an optional starting point [x, y] on the grid. + * @returns polygon [[x1, y1], [x2, y2], …] + */ +d3.geom.contour = function(grid, start) { + var s = start || d3_geom_contourStart(grid), // starting point + c = [], // contour polygon + x = s[0], // current x position + y = s[1], // current y position + dx = 0, // next x direction + dy = 0, // next y direction + pdx = NaN, // previous x direction + pdy = NaN, // previous y direction + i = 0; + + do { + // determine marching squares index + i = 0; + if (grid(x-1, y-1)) i += 1; + if (grid(x, y-1)) i += 2; + if (grid(x-1, y )) i += 4; + if (grid(x, y )) i += 8; + + // determine next direction + if (i === 6) { + dx = pdy === -1 ? -1 : 1; + dy = 0; + } else if (i === 9) { + dx = 0; + dy = pdx === 1 ? -1 : 1; + } else { + dx = d3_geom_contourDx[i]; + dy = d3_geom_contourDy[i]; + } + + // update contour polygon + if (dx != pdx && dy != pdy) { + c.push([x, y]); + pdx = dx; + pdy = dy; + } + + x += dx; + y += dy; + } while (s[0] != x || s[1] != y); + + return c; +}; + +// lookup tables for marching directions +var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN], + d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN]; + +function d3_geom_contourStart(grid) { + var x = 0, + y = 0; + + // search for a starting point; begin at origin + // and proceed along outward-expanding diagonals + while (true) { + if (grid(x,y)) { + return [x,y]; + } + if (x === 0) { + x = y + 1; + y = 0; + } else { + x = x - 1; + y = y + 1; + } + } +} +/** + * Computes the 2D convex hull of a set of points using Graham's scanning + * algorithm. The algorithm has been implemented as described in Cormen, + * Leiserson, and Rivest's Introduction to Algorithms. The running time of + * this algorithm is O(n log n), where n is the number of input points. + * + * @param vertices [[x1, y1], [x2, y2], …] + * @returns polygon [[x1, y1], [x2, y2], …] + */ +d3.geom.hull = function(vertices) { + if (vertices.length < 3) return []; + + var len = vertices.length, + plen = len - 1, + points = [], + stack = [], + i, j, h = 0, x1, y1, x2, y2, u, v, a, sp; + + // find the starting ref point: leftmost point with the minimum y coord + for (i=1; i= (x2*x2 + y2*y2)) { + points[i].index = -1; + } else { + points[u].index = -1; + a = points[i].angle; + u = i; + v = j; + } + } else { + a = points[i].angle; + u = i; + v = j; + } + } + + // initialize the stack + stack.push(h); + for (i=0, j=0; i<2; ++j) { + if (points[j].index !== -1) { + stack.push(points[j].index); + i++; + } + } + sp = stack.length; + + // do graham's scan + for (; j 0; +} +// Note: requires coordinates to be counterclockwise and convex! +d3.geom.polygon = function(coordinates) { + + coordinates.area = function() { + var i = 0, + n = coordinates.length, + a = coordinates[n - 1][0] * coordinates[0][1], + b = coordinates[n - 1][1] * coordinates[0][0]; + while (++i < n) { + a += coordinates[i - 1][0] * coordinates[i][1]; + b += coordinates[i - 1][1] * coordinates[i][0]; + } + return (b - a) * .5; + }; + + coordinates.centroid = function(k) { + var i = -1, + n = coordinates.length, + x = 0, + y = 0, + a, + b = coordinates[n - 1], + c; + if (!arguments.length) k = -1 / (6 * coordinates.area()); + while (++i < n) { + a = b; + b = coordinates[i]; + c = a[0] * b[1] - b[0] * a[1]; + x += (a[0] + b[0]) * c; + y += (a[1] + b[1]) * c; + } + return [x * k, y * k]; + }; + + // The Sutherland-Hodgman clipping algorithm. + coordinates.clip = function(subject) { + var input, + i = -1, + n = coordinates.length, + j, + m, + a = coordinates[n - 1], + b, + c, + d; + while (++i < n) { + input = subject.slice(); + subject.length = 0; + b = coordinates[i]; + c = input[(m = input.length) - 1]; + j = -1; + while (++j < m) { + d = input[j]; + if (d3_geom_polygonInside(d, a, b)) { + if (!d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + subject.push(d); + } else if (d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + c = d; + } + a = b; + } + return subject; + }; + + return coordinates; +}; + +function d3_geom_polygonInside(p, a, b) { + return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); +} + +// Intersect two infinite lines cd and ab. +function d3_geom_polygonIntersect(c, d, a, b) { + var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], + y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], + x13 = x1 - x3, + x21 = x2 - x1, + x43 = x4 - x3, + y13 = y1 - y3, + y21 = y2 - y1, + y43 = y4 - y3, + ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21); + return [x1 + ua * x21, y1 + ua * y21]; +} +// Adapted from Nicolas Garcia Belmonte's JIT implementation: +// http://blog.thejit.org/2010/02/12/voronoi-tessellation/ +// http://blog.thejit.org/assets/voronoijs/voronoi.js +// See lib/jit/LICENSE for details. + +// Notes: +// +// This implementation does not clip the returned polygons, so if you want to +// clip them to a particular shape you will need to do that either in SVG or by +// post-processing with d3.geom.polygon's clip method. +// +// If any vertices are coincident or have NaN positions, the behavior of this +// method is undefined. Most likely invalid polygons will be returned. You +// should filter invalid points, and consolidate coincident points, before +// computing the tessellation. + +/** + * @param vertices [[x1, y1], [x2, y2], …] + * @returns polygons [[[x1, y1], [x2, y2], …], …] + */ +d3.geom.voronoi = function(vertices) { + var polygons = vertices.map(function() { return []; }); + + d3_voronoi_tessellate(vertices, function(e) { + var s1, + s2, + x1, + x2, + y1, + y2; + if (e.a === 1 && e.b >= 0) { + s1 = e.ep.r; + s2 = e.ep.l; + } else { + s1 = e.ep.l; + s2 = e.ep.r; + } + if (e.a === 1) { + y1 = s1 ? s1.y : -1e6; + x1 = e.c - e.b * y1; + y2 = s2 ? s2.y : 1e6; + x2 = e.c - e.b * y2; + } else { + x1 = s1 ? s1.x : -1e6; + y1 = e.c - e.a * x1; + x2 = s2 ? s2.x : 1e6; + y2 = e.c - e.a * x2; + } + var v1 = [x1, y1], + v2 = [x2, y2]; + polygons[e.region.l.index].push(v1, v2); + polygons[e.region.r.index].push(v1, v2); + }); + + // Reconnect the polygon segments into counterclockwise loops. + return polygons.map(function(polygon, i) { + var cx = vertices[i][0], + cy = vertices[i][1]; + polygon.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + return polygon.sort(function(a, b) { + return a.angle - b.angle; + }).filter(function(d, i) { + return !i || (d.angle - polygon[i - 1].angle > 1e-10); + }); + }); +}; + +var d3_voronoi_opposite = {"l": "r", "r": "l"}; + +function d3_voronoi_tessellate(vertices, callback) { + + var Sites = { + list: vertices + .map(function(v, i) { + return { + index: i, + x: v[0], + y: v[1] + }; + }) + .sort(function(a, b) { + return a.y < b.y ? -1 + : a.y > b.y ? 1 + : a.x < b.x ? -1 + : a.x > b.x ? 1 + : 0; + }), + bottomSite: null + }; + + var EdgeList = { + list: [], + leftEnd: null, + rightEnd: null, + + init: function() { + EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.leftEnd.r = EdgeList.rightEnd; + EdgeList.rightEnd.l = EdgeList.leftEnd; + EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd); + }, + + createHalfEdge: function(edge, side) { + return { + edge: edge, + side: side, + vertex: null, + "l": null, + "r": null + }; + }, + + insert: function(lb, he) { + he.l = lb; + he.r = lb.r; + lb.r.l = he; + lb.r = he; + }, + + leftBound: function(p) { + var he = EdgeList.leftEnd; + do { + he = he.r; + } while (he != EdgeList.rightEnd && Geom.rightOf(he, p)); + he = he.l; + return he; + }, + + del: function(he) { + he.l.r = he.r; + he.r.l = he.l; + he.edge = null; + }, + + right: function(he) { + return he.r; + }, + + left: function(he) { + return he.l; + }, + + leftRegion: function(he) { + return he.edge == null + ? Sites.bottomSite + : he.edge.region[he.side]; + }, + + rightRegion: function(he) { + return he.edge == null + ? Sites.bottomSite + : he.edge.region[d3_voronoi_opposite[he.side]]; + } + }; + + var Geom = { + + bisect: function(s1, s2) { + var newEdge = { + region: {"l": s1, "r": s2}, + ep: {"l": null, "r": null} + }; + + var dx = s2.x - s1.x, + dy = s2.y - s1.y, + adx = dx > 0 ? dx : -dx, + ady = dy > 0 ? dy : -dy; + + newEdge.c = s1.x * dx + s1.y * dy + + (dx * dx + dy * dy) * .5; + + if (adx > ady) { + newEdge.a = 1; + newEdge.b = dy / dx; + newEdge.c /= dx; + } else { + newEdge.b = 1; + newEdge.a = dx / dy; + newEdge.c /= dy; + } + + return newEdge; + }, + + intersect: function(el1, el2) { + var e1 = el1.edge, + e2 = el2.edge; + if (!e1 || !e2 || (e1.region.r == e2.region.r)) { + return null; + } + var d = (e1.a * e2.b) - (e1.b * e2.a); + if (Math.abs(d) < 1e-10) { + return null; + } + var xint = (e1.c * e2.b - e2.c * e1.b) / d, + yint = (e2.c * e1.a - e1.c * e2.a) / d, + e1r = e1.region.r, + e2r = e2.region.r, + el, + e; + if ((e1r.y < e2r.y) || + (e1r.y == e2r.y && e1r.x < e2r.x)) { + el = el1; + e = e1; + } else { + el = el2; + e = e2; + } + var rightOfSite = (xint >= e.region.r.x); + if ((rightOfSite && (el.side === "l")) || + (!rightOfSite && (el.side === "r"))) { + return null; + } + return { + x: xint, + y: yint + }; + }, + + rightOf: function(he, p) { + var e = he.edge, + topsite = e.region.r, + rightOfSite = (p.x > topsite.x); + + if (rightOfSite && (he.side === "l")) { + return 1; + } + if (!rightOfSite && (he.side === "r")) { + return 0; + } + if (e.a === 1) { + var dyp = p.y - topsite.y, + dxp = p.x - topsite.x, + fast = 0, + above = 0; + + if ((!rightOfSite && (e.b < 0)) || + (rightOfSite && (e.b >= 0))) { + above = fast = (dyp >= e.b * dxp); + } else { + above = ((p.x + p.y * e.b) > e.c); + if (e.b < 0) { + above = !above; + } + if (!above) { + fast = 1; + } + } + if (!fast) { + var dxs = topsite.x - e.region.l.x; + above = (e.b * (dxp * dxp - dyp * dyp)) < + (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b)); + + if (e.b < 0) { + above = !above; + } + } + } else /* e.b == 1 */ { + var yl = e.c - e.a * p.x, + t1 = p.y - yl, + t2 = p.x - topsite.x, + t3 = yl - topsite.y; + + above = (t1 * t1) > (t2 * t2 + t3 * t3); + } + return he.side === "l" ? above : !above; + }, + + endPoint: function(edge, side, site) { + edge.ep[side] = site; + if (!edge.ep[d3_voronoi_opposite[side]]) return; + callback(edge); + }, + + distance: function(s, t) { + var dx = s.x - t.x, + dy = s.y - t.y; + return Math.sqrt(dx * dx + dy * dy); + } + }; + + var EventQueue = { + list: [], + + insert: function(he, site, offset) { + he.vertex = site; + he.ystar = site.y + offset; + for (var i=0, list=EventQueue.list, l=list.length; i next.ystar || + (he.ystar == next.ystar && + site.x > next.vertex.x)) { + continue; + } else { + break; + } + } + list.splice(i, 0, he); + }, + + del: function(he) { + for (var i=0, ls=EventQueue.list, l=ls.length; i top.y) { + temp = bot; + bot = top; + top = temp; + pm = "r"; + } + e = Geom.bisect(bot, top); + bisector = EdgeList.createHalfEdge(e, pm); + EdgeList.insert(llbnd, bisector); + Geom.endPoint(e, d3_voronoi_opposite[pm], v); + p = Geom.intersect(llbnd, bisector); + if (p) { + EventQueue.del(llbnd); + EventQueue.insert(llbnd, p, Geom.distance(p, bot)); + } + p = Geom.intersect(bisector, rrbnd); + if (p) { + EventQueue.insert(bisector, p, Geom.distance(p, bot)); + } + } else { + break; + } + }//end while + + for (lbnd = EdgeList.right(EdgeList.leftEnd); + lbnd != EdgeList.rightEnd; + lbnd = EdgeList.right(lbnd)) { + callback(lbnd.edge); + } +} +/** +* @param vertices [[x1, y1], [x2, y2], …] +* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …] + */ +d3.geom.delaunay = function(vertices) { + var edges = vertices.map(function() { return []; }), + triangles = []; + + // Use the Voronoi tessellation to determine Delaunay edges. + d3_voronoi_tessellate(vertices, function(e) { + edges[e.region.l.index].push(vertices[e.region.r.index]); + }); + + // Reconnect the edges into counterclockwise triangles. + edges.forEach(function(edge, i) { + var v = vertices[i], + cx = v[0], + cy = v[1]; + edge.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + edge.sort(function(a, b) { + return a.angle - b.angle; + }); + for (var j = 0, m = edge.length - 1; j < m; j++) { + triangles.push([v, edge[j], edge[j + 1]]); + } + }); + + return triangles; +}; +// Constructs a new quadtree for the specified array of points. A quadtree is a +// two-dimensional recursive spatial subdivision. This implementation uses +// square partitions, dividing each square into four equally-sized squares. Each +// point exists in a unique node; if multiple points are in the same position, +// some points may be stored on internal nodes rather than leaf nodes. Quadtrees +// can be used to accelerate various spatial operations, such as the Barnes-Hut +// approximation for computing n-body forces, or collision detection. +d3.geom.quadtree = function(points, x1, y1, x2, y2) { + var p, + i = -1, + n = points.length; + + // Type conversion for deprecated API. + if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint); + + // Allow bounds to be specified explicitly. + if (arguments.length < 5) { + if (arguments.length === 3) { + y2 = x2 = y1; + y1 = x1; + } else { + x1 = y1 = Infinity; + x2 = y2 = -Infinity; + + // Compute bounds. + while (++i < n) { + p = points[i]; + if (p.x < x1) x1 = p.x; + if (p.y < y1) y1 = p.y; + if (p.x > x2) x2 = p.x; + if (p.y > y2) y2 = p.y; + } + + // Squarify the bounds. + var dx = x2 - x1, + dy = y2 - y1; + if (dx > dy) y2 = y1 + dx; + else x2 = x1 + dy; + } + } + + // Recursively inserts the specified point p at the node n or one of its + // descendants. The bounds are defined by [x1, x2] and [y1, y2]. + function insert(n, p, x1, y1, x2, y2) { + if (isNaN(p.x) || isNaN(p.y)) return; // ignore invalid points + if (n.leaf) { + var v = n.point; + if (v) { + // If the point at this leaf node is at the same position as the new + // point we are adding, we leave the point associated with the + // internal node while adding the new point to a child node. This + // avoids infinite recursion. + if ((Math.abs(v.x - p.x) + Math.abs(v.y - p.y)) < .01) { + insertChild(n, p, x1, y1, x2, y2); + } else { + n.point = null; + insertChild(n, v, x1, y1, x2, y2); + insertChild(n, p, x1, y1, x2, y2); + } + } else { + n.point = p; + } + } else { + insertChild(n, p, x1, y1, x2, y2); + } + } + + // Recursively inserts the specified point p into a descendant of node n. The + // bounds are defined by [x1, x2] and [y1, y2]. + function insertChild(n, p, x1, y1, x2, y2) { + // Compute the split point, and the quadrant in which to insert p. + var sx = (x1 + x2) * .5, + sy = (y1 + y2) * .5, + right = p.x >= sx, + bottom = p.y >= sy, + i = (bottom << 1) + right; + + // Recursively insert into the child node. + n.leaf = false; + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); + + // Update the bounds as we recurse. + if (right) x1 = sx; else x2 = sx; + if (bottom) y1 = sy; else y2 = sy; + insert(n, p, x1, y1, x2, y2); + } + + // Create the root node. + var root = d3_geom_quadtreeNode(); + + root.add = function(p) { + insert(root, p, x1, y1, x2, y2); + }; + + root.visit = function(f) { + d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2); + }; + + // Insert all points. + points.forEach(root.add); + return root; +}; + +function d3_geom_quadtreeNode() { + return { + leaf: true, + nodes: [], + point: null + }; +} + +function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { + if (!f(node, x1, y1, x2, y2)) { + var sx = (x1 + x2) * .5, + sy = (y1 + y2) * .5, + children = node.nodes; + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); + } +} + +function d3_geom_quadtreePoint(p) { + return { + x: p[0], + y: p[1] + }; +} +})(); diff --git a/static/vendor/d3-2.7.5/d3.geom.min.js b/static/vendor/d3-2.7.5/d3.geom.min.js new file mode 100644 index 0000000..fdd1a15 --- /dev/null +++ b/static/vendor/d3-2.7.5/d3.geom.min.js @@ -0,0 +1 @@ +(function(){function c(a){var b=0,c=0;for(;;){if(a(b,c))return[b,c];b===0?(b=c+1,c=0):(b-=1,c+=1)}}function d(a,b,c,d){var e,f,g,h,i,j,k;return e=d[a],f=e[0],g=e[1],e=d[b],h=e[0],i=e[1],e=d[c],j=e[0],k=e[1],(k-g)*(h-f)-(i-g)*(j-f)>0}function e(a,b,c){return(c[0]-b[0])*(a[1]-b[1])<(c[1]-b[1])*(a[0]-b[0])}function f(a,b,c,d){var e=a[0],f=b[0],g=c[0],h=d[0],i=a[1],j=b[1],k=c[1],l=d[1],m=e-g,n=f-e,o=h-g,p=i-k,q=j-i,r=l-k,s=(o*p-r*m)/(r*n-o*q);return[e+s*n,i+s*q]}function h(a,b){var c={list:a.map(function(a,b){return{index:b,x:a[0],y:a[1]}}).sort(function(a,b){return a.yb.y?1:a.xb.x?1:0}),bottomSite:null},d={list:[],leftEnd:null,rightEnd:null,init:function(){d.leftEnd=d.createHalfEdge(null,"l"),d.rightEnd=d.createHalfEdge(null,"l"),d.leftEnd.r=d.rightEnd,d.rightEnd.l=d.leftEnd,d.list.unshift(d.leftEnd,d.rightEnd)},createHalfEdge:function(a,b){return{edge:a,side:b,vertex:null,l:null,r:null}},insert:function(a,b){b.l=a,b.r=a.r,a.r.l=b,a.r=b},leftBound:function(a){var b=d.leftEnd;do b=b.r;while(b!=d.rightEnd&&e.rightOf(b,a));return b=b.l,b},del:function(a){a.l.r=a.r,a.r.l=a.l,a.edge=null},right:function(a){return a.r},left:function(a){return a.l},leftRegion:function(a){return a.edge==null?c.bottomSite:a.edge.region[a.side]},rightRegion:function(a){return a.edge==null?c.bottomSite:a.edge.region[g[a.side]]}},e={bisect:function(a,b){var c={region:{l:a,r:b},ep:{l:null,r:null}},d=b.x-a.x,e=b.y-a.y,f=d>0?d:-d,g=e>0?e:-e;return c.c=a.x*d+a.y*e+(d*d+e*e)*.5,f>g?(c.a=1,c.b=e/d,c.c/=d):(c.b=1,c.a=d/e,c.c/=e),c},intersect:function(a,b){var c=a.edge,d=b.edge;if(!c||!d||c.region.r==d.region.r)return null;var e=c.a*d.b-c.b*d.a;if(Math.abs(e)<1e-10)return null;var f=(c.c*d.b-d.c*c.b)/e,g=(d.c*c.a-c.c*d.a)/e,h=c.region.r,i=d.region.r,j,k;h.y=k.region.r.x;return l&&j.side==="l"||!l&&j.side==="r"?null:{x:f,y:g}},rightOf:function(a,b){var c=a.edge,d=c.region.r,e=b.x>d.x;if(e&&a.side==="l")return 1;if(!e&&a.side==="r")return 0;if(c.a===1){var f=b.y-d.y,g=b.x-d.x,h=0,i=0;!e&&c.b<0||e&&c.b>=0?i=h=f>=c.b*g:(i=b.x+b.y*c.b>c.c,c.b<0&&(i=!i),i||(h=1));if(!h){var j=d.x-c.region.l.x;i=c.b*(g*g-f*f)m*m+n*n}return a.side==="l"?i:!i},endPoint:function(a,c,d){a.ep[c]=d;if(!a.ep[g[c]])return;b(a)},distance:function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)}},f={list:[],insert:function(a,b,c){a.vertex=b,a.ystar=b.y+c;for(var d=0,e=f.list,g=e.length;dh.ystar||a.ystar==h.ystar&&b.x>h.vertex.x)continue;break}e.splice(d,0,a)},del:function(a){for(var b=0,c=f.list,d=c.length;bp.y&&(q=o,o=p,p=q,u="r"),t=e.bisect(o,p),n=d.createHalfEdge(t,u),d.insert(l,n),e.endPoint(t,g[u],s),r=e.intersect(l,n),r&&(f.del(l),f.insert(l,r,e.distance(r,o))),r=e.intersect(n,m),r&&f.insert(n,r,e.distance(r,o));else break}for(j=d.right(d.leftEnd);j!=d.rightEnd;j=d.right(j))b(j.edge)}function i(){return{leaf:!0,nodes:[],point:null}}function j(a,b,c,d,e,f){if(!a(b,c,d,e,f)){var g=(c+e)*.5,h=(d+f)*.5,i=b.nodes;i[0]&&j(a,i[0],c,d,g,h),i[1]&&j(a,i[1],g,d,e,h),i[2]&&j(a,i[2],c,h,g,f),i[3]&&j(a,i[3],g,h,e,f)}}function k(a){return{x:a[0],y:a[1]}}d3.geom={},d3.geom.contour=function(d,e){var f=e||c(d),g=[],h=f[0],i=f[1],j=0,k=0,l=NaN,m=NaN,n=0;do n=0,d(h-1,i-1)&&(n+=1),d(h,i-1)&&(n+=2),d(h-1,i)&&(n+=4),d(h,i)&&(n+=8),n===6?(j=m===-1?-1:1,k=0):n===9?(j=0,k=l===1?-1:1):(j=a[n],k=b[n]),j!=l&&k!=m&&(g.push([h,i]),l=j,m=k),h+=j,i+=k;while(f[0]!=h||f[1]!=i);return g};var a=[1,0,1,1,-1,0,-1,1,0,0,0,0,-1,0,-1,NaN],b=[0,-1,0,0,0,-1,0,0,1,-1,1,1,0,-1,0,NaN];d3.geom.hull=function(a){if(a.length<3)return[];var b=a.length,c=b-1,e=[],f=[],g,h,i=0,j,k,l,m,n,o,p,q;for(g=1;g=l*l+m*m?e[g].index=-1:(e[n].index=-1,p=e[g].angle,n=g,o=h)):(p=e[g].angle,n=g,o=h);f.push(i);for(g=0,h=0;g<2;++h)e[h].index!==-1&&(f.push(e[h].index),g++);q=f.length;for(;h=0?(c=a.ep.r,d=a.ep.l):(c=a.ep.l,d=a.ep.r),a.a===1?(g=c?c.y:-1e6,e=a.c-a.b*g,h=d?d.y:1e6,f=a.c-a.b*h):(e=c?c.x:-1e6,g=a.c-a.a*e,f=d?d.x:1e6,h=a.c-a.a*f);var i=[e,g],j=[f,h];b[a.region.l.index].push(i,j),b[a.region.r.index].push(i,j)}),b.map(function(b,c){var d=a[c][0],e=a[c][1];return b.forEach(function(a){a.angle=Math.atan2(a[0]-d,a[1]-e)}),b.sort(function(a,b){return a.angle-b.angle}).filter(function(a,c){return!c||a.angle-b[c-1].angle>1e-10})})};var g={l:"r",r:"l"};d3.geom.delaunay=function(a){var b=a.map(function(){return[]}),c=[];return h(a,function(c){b[c.region.l.index].push(a[c.region.r.index])}),b.forEach(function(b,d){var e=a[d],f=e[0],g=e[1];b.forEach(function(a){a.angle=Math.atan2(a[0]-f,a[1]-g)}),b.sort(function(a,b){return a.angle-b.angle});for(var h=0,i=b.length-1;h=g,k=b.y>=h,l=(k<<1)+j;a.leaf=!1,a=a.nodes[l]||(a.nodes[l]=i()),j?c=g:e=g,k?d=h:f=h,n(a,b,c,d,e,f)}var f,g=-1,h=a.length;h&&isNaN(a[0].x)&&(a=a.map(k));if(arguments.length<5)if(arguments.length===3)e=d=c,c=b;else{b=c=Infinity,d=e=-Infinity;while(++gd&&(d=f.x),f.y>e&&(e=f.y);var l=d-b,m=e-c;l>m?e=c+l:d=b+m}var p=i();return p.add=function(a){n(p,a,b,c,d,e)},p.visit=function(a){j(a,p,b,c,d,e)},a.forEach(p.add),p}})(); \ No newline at end of file diff --git a/static/vendor/d3-2.7.5/d3.js b/static/vendor/d3-2.7.5/d3.js new file mode 100644 index 0000000..65b951e --- /dev/null +++ b/static/vendor/d3-2.7.5/d3.js @@ -0,0 +1,4765 @@ +(function(){if (!Date.now) Date.now = function() { + return +new Date; +}; +try { + document.createElement("div").style.setProperty("opacity", 0, ""); +} catch (error) { + var d3_style_prototype = CSSStyleDeclaration.prototype, + d3_style_setProperty = d3_style_prototype.setProperty; + d3_style_prototype.setProperty = function(name, value, priority) { + d3_style_setProperty.call(this, name, value + "", priority); + }; +} +d3 = {version: "2.7.5"}; // semver +var d3_array = d3_arraySlice; // conversion for NodeLists + +function d3_arrayCopy(pseudoarray) { + var i = -1, n = pseudoarray.length, array = []; + while (++i < n) array.push(pseudoarray[i]); + return array; +} + +function d3_arraySlice(pseudoarray) { + return Array.prototype.slice.call(pseudoarray); +} + +try { + d3_array(document.documentElement.childNodes)[0].nodeType; +} catch(e) { + d3_array = d3_arrayCopy; +} + +var d3_arraySubclass = [].__proto__? + +// Until ECMAScript supports array subclassing, prototype injection works well. +function(array, prototype) { + array.__proto__ = prototype; +}: + +// And if your browser doesn't support __proto__, we'll use direct extension. +function(array, prototype) { + for (var property in prototype) array[property] = prototype[property]; +}; +function d3_this() { + return this; +} +d3.functor = function(v) { + return typeof v === "function" ? v : function() { return v; }; +}; +// Copies a variable number of methods from source to target. +d3.rebind = function(target, source) { + var i = 1, n = arguments.length, method; + while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); + return target; +}; + +// Method is assumed to be a standard D3 getter-setter: +// If passed with no arguments, gets the value. +// If passed with arguments, sets the value and returns the target. +function d3_rebind(target, source, method) { + return function() { + var value = method.apply(source, arguments); + return arguments.length ? target : value; + }; +} +d3.ascending = function(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; +}; +d3.descending = function(a, b) { + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; +}; +d3.mean = function(array, f) { + var n = array.length, + a, + m = 0, + i = -1, + j = 0; + if (arguments.length === 1) { + while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j; + } else { + while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j; + } + return j ? m : undefined; +}; +d3.median = function(array, f) { + if (arguments.length > 1) array = array.map(f); + array = array.filter(d3_number); + return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined; +}; +d3.min = function(array, f) { + var i = -1, + n = array.length, + a, + b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && a > b) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; + } + return a; +}; +d3.max = function(array, f) { + var i = -1, + n = array.length, + a, + b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && b > a) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; + } + return a; +}; +d3.extent = function(array, f) { + var i = -1, + n = array.length, + a, + b, + c; + if (arguments.length === 1) { + while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined; + while (++i < n) if ((b = array[i]) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } else { + while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } + return [a, c]; +}; +d3.random = { + normal: function(mean, deviation) { + if (arguments.length < 2) deviation = 1; + if (arguments.length < 1) mean = 0; + return function() { + var x, y, r; + do { + x = Math.random() * 2 - 1; + y = Math.random() * 2 - 1; + r = x * x + y * y; + } while (!r || r > 1); + return mean + deviation * x * Math.sqrt(-2 * Math.log(r) / r); + }; + } +}; +function d3_number(x) { + return x != null && !isNaN(x); +} +d3.sum = function(array, f) { + var s = 0, + n = array.length, + a, + i = -1; + + if (arguments.length === 1) { + while (++i < n) if (!isNaN(a = +array[i])) s += a; + } else { + while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a; + } + + return s; +}; +// R-7 per +d3.quantile = function(values, p) { + var H = (values.length - 1) * p + 1, + h = Math.floor(H), + v = values[h - 1], + e = H - h; + return e ? v + e * (values[h] - v) : v; +}; +d3.transpose = function(matrix) { + return d3.zip.apply(d3, matrix); +}; +d3.zip = function() { + if (!(n = arguments.length)) return []; + for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m;) { + for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n;) { + zip[j] = arguments[j][i]; + } + } + return zips; +}; + +function d3_zipLength(d) { + return d.length; +} +// Locate the insertion point for x in a to maintain sorted order. The +// arguments lo and hi may be used to specify a subset of the array which should +// be considered; by default the entire array is used. If x is already present +// in a, the insertion point will be before (to the left of) any existing +// entries. The return value is suitable for use as the first argument to +// `array.splice` assuming that a is already sorted. +// +// The returned insertion point i partitions the array a into two halves so that +// all v < x for v in a[lo:i] for the left side and all v >= x for v in a[i:hi] +// for the right side. +d3.bisectLeft = function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = (lo + hi) >> 1; + if (a[mid] < x) lo = mid + 1; + else hi = mid; + } + return lo; +}; + +// Similar to bisectLeft, but returns an insertion point which comes after (to +// the right of) any existing entries of x in a. +// +// The returned insertion point i partitions the array into two halves so that +// all v <= x for v in a[lo:i] for the left side and all v > x for v in a[i:hi] +// for the right side. +d3.bisect = +d3.bisectRight = function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = (lo + hi) >> 1; + if (x < a[mid]) hi = mid; + else lo = mid + 1; + } + return lo; +}; +d3.first = function(array, f) { + var i = 0, + n = array.length, + a = array[0], + b; + if (arguments.length === 1) f = d3.ascending; + while (++i < n) { + if (f.call(array, a, b = array[i]) > 0) { + a = b; + } + } + return a; +}; +d3.last = function(array, f) { + var i = 0, + n = array.length, + a = array[0], + b; + if (arguments.length === 1) f = d3.ascending; + while (++i < n) { + if (f.call(array, a, b = array[i]) <= 0) { + a = b; + } + } + return a; +}; +d3.nest = function() { + var nest = {}, + keys = [], + sortKeys = [], + sortValues, + rollup; + + function map(array, depth) { + if (depth >= keys.length) return rollup + ? rollup.call(nest, array) : (sortValues + ? array.sort(sortValues) + : array); + + var i = -1, + n = array.length, + key = keys[depth++], + keyValue, + object, + o = {}; + + while (++i < n) { + if ((keyValue = key(object = array[i])) in o) { + o[keyValue].push(object); + } else { + o[keyValue] = [object]; + } + } + + for (keyValue in o) { + o[keyValue] = map(o[keyValue], depth); + } + + return o; + } + + function entries(map, depth) { + if (depth >= keys.length) return map; + + var a = [], + sortKey = sortKeys[depth++], + key; + + for (key in map) { + a.push({key: key, values: entries(map[key], depth)}); + } + + if (sortKey) a.sort(function(a, b) { + return sortKey(a.key, b.key); + }); + + return a; + } + + nest.map = function(array) { + return map(array, 0); + }; + + nest.entries = function(array) { + return entries(map(array, 0), 0); + }; + + nest.key = function(d) { + keys.push(d); + return nest; + }; + + // Specifies the order for the most-recently specified key. + // Note: only applies to entries. Map keys are unordered! + nest.sortKeys = function(order) { + sortKeys[keys.length - 1] = order; + return nest; + }; + + // Specifies the order for leaf values. + // Applies to both maps and entries array. + nest.sortValues = function(order) { + sortValues = order; + return nest; + }; + + nest.rollup = function(f) { + rollup = f; + return nest; + }; + + return nest; +}; +d3.keys = function(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; +}; +d3.values = function(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; +}; +d3.entries = function(map) { + var entries = []; + for (var key in map) entries.push({key: key, value: map[key]}); + return entries; +}; +d3.permute = function(array, indexes) { + var permutes = [], + i = -1, + n = indexes.length; + while (++i < n) permutes[i] = array[indexes[i]]; + return permutes; +}; +d3.merge = function(arrays) { + return Array.prototype.concat.apply([], arrays); +}; +d3.split = function(array, f) { + var arrays = [], + values = [], + value, + i = -1, + n = array.length; + if (arguments.length < 2) f = d3_splitter; + while (++i < n) { + if (f.call(values, value = array[i], i)) { + values = []; + } else { + if (!values.length) arrays.push(values); + values.push(value); + } + } + return arrays; +}; + +function d3_splitter(d) { + return d == null; +} +function d3_collapse(s) { + return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " "); +} +d3.range = function(start, stop, step) { + if (arguments.length < 3) { + step = 1; + if (arguments.length < 2) { + stop = start; + start = 0; + } + } + if ((stop - start) / step === Infinity) throw new Error("infinite range"); + var range = [], + k = d3_range_integerScale(Math.abs(step)), + i = -1, + j; + start *= k, stop *= k, step *= k; + if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); + else while ((j = start + step * ++i) < stop) range.push(j / k); + return range; +}; + +function d3_range_integerScale(x) { + var k = 1; + while (x * k % 1) k *= 10; + return k; +} +d3.requote = function(s) { + return s.replace(d3_requote_re, "\\$&"); +}; + +var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; +d3.round = function(x, n) { + return n + ? Math.round(x * (n = Math.pow(10, n))) / n + : Math.round(x); +}; +d3.xhr = function(url, mime, callback) { + var req = new XMLHttpRequest; + if (arguments.length < 3) callback = mime, mime = null; + else if (mime && req.overrideMimeType) req.overrideMimeType(mime); + req.open("GET", url, true); + if (mime) req.setRequestHeader("Accept", mime); + req.onreadystatechange = function() { + if (req.readyState === 4) callback(req.status < 300 ? req : null); + }; + req.send(null); +}; +d3.text = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseText); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); +}; +d3.json = function(url, callback) { + d3.text(url, "application/json", function(text) { + callback(text ? JSON.parse(text) : null); + }); +}; +d3.html = function(url, callback) { + d3.text(url, "text/html", function(text) { + if (text != null) { // Treat empty string as valid HTML. + var range = document.createRange(); + range.selectNode(document.body); + text = range.createContextualFragment(text); + } + callback(text); + }); +}; +d3.xml = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseXML); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); +}; +var d3_nsPrefix = { + svg: "http://www.w3.org/2000/svg", + xhtml: "http://www.w3.org/1999/xhtml", + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" +}; + +d3.ns = { + prefix: d3_nsPrefix, + qualify: function(name) { + var i = name.indexOf(":"); + return i < 0 ? (name in d3_nsPrefix + ? {space: d3_nsPrefix[name], local: name} : name) + : {space: d3_nsPrefix[name.substring(0, i)], local: name.substring(i + 1)}; + } +}; +d3.dispatch = function() { + var dispatch = new d3_dispatch(), + i = -1, + n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + return dispatch; +}; + +function d3_dispatch() {} + +d3_dispatch.prototype.on = function(type, listener) { + var i = type.indexOf("."), + name = ""; + + // Extract optional namespace, e.g., "click.foo" + if (i > 0) { + name = type.substring(i + 1); + type = type.substring(0, i); + } + + return arguments.length < 2 + ? this[type].on(name) + : this[type].on(name, listener); +}; + +function d3_dispatch_event(dispatch) { + var listeners = [], + listenerByName = {}; + + function event() { + var z = listeners, // defensive reference + i = -1, + n = z.length, + l; + while (++i < n) if (l = z[i].on) l.apply(this, arguments); + return dispatch; + } + + event.on = function(name, listener) { + var l, i; + + // return the current listener, if any + if (arguments.length < 2) return (l = listenerByName[name]) && l.on; + + // remove the old listener, if any (with copy-on-write) + if (l = listenerByName[name]) { + l.on = null; + listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); + delete listenerByName[name]; + } + + // add the new listener, if any + if (listener) { + listeners.push(listenerByName[name] = {on: listener}); + } + + return dispatch; + }; + + return event; +} +// TODO align +d3.format = function(specifier) { + var match = d3_format_re.exec(specifier), + fill = match[1] || " ", + sign = match[3] || "", + zfill = match[5], + width = +match[6], + comma = match[7], + precision = match[8], + type = match[9], + scale = 1, + suffix = "", + integer = false; + + if (precision) precision = +precision.substring(1); + + if (zfill) { + fill = "0"; // TODO align = "="; + if (comma) width -= Math.floor((width - 1) / 4); + } + + switch (type) { + case "n": comma = true; type = "g"; break; + case "%": scale = 100; suffix = "%"; type = "f"; break; + case "p": scale = 100; suffix = "%"; type = "r"; break; + case "d": integer = true; precision = 0; break; + case "s": scale = -1; type = "r"; break; + } + + // If no precision is specified for r, fallback to general notation. + if (type == "r" && !precision) type = "g"; + + type = d3_format_types[type] || d3_format_typeDefault; + + return function(value) { + + // Return the empty string for floats formatted as ints. + if (integer && (value % 1)) return ""; + + // Convert negative to positive, and record the sign prefix. + var negative = (value < 0) && (value = -value) ? "\u2212" : sign; + + // Apply the scale, computing it from the value's exponent for si format. + if (scale < 0) { + var prefix = d3.formatPrefix(value, precision); + value *= prefix.scale; + suffix = prefix.symbol; + } else { + value *= scale; + } + + // Convert to the desired precision. + value = type(value, precision); + + // If the fill character is 0, the sign and group is applied after the fill. + if (zfill) { + var length = value.length + negative.length; + if (length < width) value = new Array(width - length + 1).join(fill) + value; + if (comma) value = d3_format_group(value); + value = negative + value; + } + + // Otherwise (e.g., space-filling), the sign and group is applied before. + else { + if (comma) value = d3_format_group(value); + value = negative + value; + var length = value.length; + if (length < width) value = new Array(width - length + 1).join(fill) + value; + } + + return value + suffix; + }; +}; + +// [[fill]align][sign][#][0][width][,][.precision][type] +var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/; + +var d3_format_types = { + g: function(x, p) { return x.toPrecision(p); }, + e: function(x, p) { return x.toExponential(p); }, + f: function(x, p) { return x.toFixed(p); }, + r: function(x, p) { return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p))); } +}; + +function d3_format_precision(x, p) { + return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1); +} + +function d3_format_typeDefault(x) { + return x + ""; +} + +// Apply comma grouping for thousands. +function d3_format_group(value) { + var i = value.lastIndexOf("."), + f = i >= 0 ? value.substring(i) : (i = value.length, ""), + t = []; + while (i > 0) t.push(value.substring(i -= 3, i + 3)); + return t.reverse().join(",") + f; +} +var d3_formatPrefixes = ["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix); + +d3.formatPrefix = function(value, precision) { + var i = 0; + if (value) { + if (value < 0) value *= -1; + if (precision) value = d3.round(value, d3_format_precision(value, precision)); + i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); + i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3)); + } + return d3_formatPrefixes[8 + i / 3]; +}; + +function d3_formatPrefix(d, i) { + return { + scale: Math.pow(10, (8 - i) * 3), + symbol: d + }; +} + +/* + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright 2001 Robert Penner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * - Neither the name of the author nor the names of contributors may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +var d3_ease_quad = d3_ease_poly(2), + d3_ease_cubic = d3_ease_poly(3); + +var d3_ease = { + linear: function() { return d3_ease_linear; }, + poly: d3_ease_poly, + quad: function() { return d3_ease_quad; }, + cubic: function() { return d3_ease_cubic; }, + sin: function() { return d3_ease_sin; }, + exp: function() { return d3_ease_exp; }, + circle: function() { return d3_ease_circle; }, + elastic: d3_ease_elastic, + back: d3_ease_back, + bounce: function() { return d3_ease_bounce; } +}; + +var d3_ease_mode = { + "in": function(f) { return f; }, + "out": d3_ease_reverse, + "in-out": d3_ease_reflect, + "out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); } +}; + +d3.ease = function(name) { + var i = name.indexOf("-"), + t = i >= 0 ? name.substring(0, i) : name, + m = i >= 0 ? name.substring(i + 1) : "in"; + return d3_ease_clamp(d3_ease_mode[m](d3_ease[t].apply(null, Array.prototype.slice.call(arguments, 1)))); +}; + +function d3_ease_clamp(f) { + return function(t) { + return t <= 0 ? 0 : t >= 1 ? 1 : f(t); + }; +} + +function d3_ease_reverse(f) { + return function(t) { + return 1 - f(1 - t); + }; +} + +function d3_ease_reflect(f) { + return function(t) { + return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t))); + }; +} + +function d3_ease_linear(t) { + return t; +} + +function d3_ease_poly(e) { + return function(t) { + return Math.pow(t, e); + } +} + +function d3_ease_sin(t) { + return 1 - Math.cos(t * Math.PI / 2); +} + +function d3_ease_exp(t) { + return Math.pow(2, 10 * (t - 1)); +} + +function d3_ease_circle(t) { + return 1 - Math.sqrt(1 - t * t); +} + +function d3_ease_elastic(a, p) { + var s; + if (arguments.length < 2) p = 0.45; + if (arguments.length < 1) { a = 1; s = p / 4; } + else s = p / (2 * Math.PI) * Math.asin(1 / a); + return function(t) { + return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p); + }; +} + +function d3_ease_back(s) { + if (!s) s = 1.70158; + return function(t) { + return t * t * ((s + 1) * t - s); + }; +} + +function d3_ease_bounce(t) { + return t < 1 / 2.75 ? 7.5625 * t * t + : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 + : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 + : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; +} +d3.event = null; + +function d3_eventCancel() { + d3.event.stopPropagation(); + d3.event.preventDefault(); +} +d3.interpolate = function(a, b) { + var i = d3.interpolators.length, f; + while (--i >= 0 && !(f = d3.interpolators[i](a, b))); + return f; +}; + +d3.interpolateNumber = function(a, b) { + b -= a; + return function(t) { return a + b * t; }; +}; + +d3.interpolateRound = function(a, b) { + b -= a; + return function(t) { return Math.round(a + b * t); }; +}; + +d3.interpolateString = function(a, b) { + var m, // current match + i, // current index + j, // current index (for coallescing) + s0 = 0, // start index of current string prefix + s1 = 0, // end index of current string prefix + s = [], // string constants and placeholders + q = [], // number interpolators + n, // q.length + o; + + // Reset our regular expression! + d3_interpolate_number.lastIndex = 0; + + // Find all numbers in b. + for (i = 0; m = d3_interpolate_number.exec(b); ++i) { + if (m.index) s.push(b.substring(s0, s1 = m.index)); + q.push({i: s.length, x: m[0]}); + s.push(null); + s0 = d3_interpolate_number.lastIndex; + } + if (s0 < b.length) s.push(b.substring(s0)); + + // Find all numbers in a. + for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) { + o = q[i]; + if (o.x == m[0]) { // The numbers match, so coallesce. + if (o.i) { + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i - 1] += o.x; + s.splice(o.i, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } else { // This match is followed by a string, so coallesce twice. + s[o.i - 1] += o.x + s[o.i + 1]; + s.splice(o.i, 2); + for (j = i + 1; j < n; ++j) q[j].i -= 2; + } + } else { + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i] = o.x; + } else { // This match is followed by a string, so coallesce twice. + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } + } + q.splice(i, 1); + n--; + i--; + } else { + o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x)); + } + } + + // Remove any numbers in b not found in a. + while (i < n) { + o = q.pop(); + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i] = o.x; + } else { // This match is followed by a string, so coallesce twice. + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + } + n--; + } + + // Special optimization for only a single match. + if (s.length === 1) { + return s[0] == null ? q[0].x : function() { return b; }; + } + + // Otherwise, interpolate each of the numbers and rejoin the string. + return function(t) { + for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; +}; + +d3.interpolateTransform = function(a, b) { + var s = [], // string constants and placeholders + q = [], // number interpolators + n, + A = d3.transform(a), + B = d3.transform(b), + ta = A.translate, + tb = B.translate, + ra = A.rotate, + rb = B.rotate, + wa = A.skew, + wb = B.skew, + ka = A.scale, + kb = B.scale; + + if (ta[0] != tb[0] || ta[1] != tb[1]) { + s.push("translate(", null, ",", null, ")"); + q.push({i: 1, x: d3.interpolateNumber(ta[0], tb[0])}, {i: 3, x: d3.interpolateNumber(ta[1], tb[1])}); + } else if (tb[0] || tb[1]) { + s.push("translate(" + tb + ")"); + } else { + s.push(""); + } + + if (ra != rb) { + q.push({i: s.push(s.pop() + "rotate(", null, ")") - 2, x: d3.interpolateNumber(ra, rb)}); + } else if (rb) { + s.push(s.pop() + "rotate(" + rb + ")"); + } + + if (wa != wb) { + q.push({i: s.push(s.pop() + "skewX(", null, ")") - 2, x: d3.interpolateNumber(wa, wb)}); + } else if (wb) { + s.push(s.pop() + "skewX(" + wb + ")"); + } + + if (ka[0] != kb[0] || ka[1] != kb[1]) { + n = s.push(s.pop() + "scale(", null, ",", null, ")"); + q.push({i: n - 4, x: d3.interpolateNumber(ka[0], kb[0])}, {i: n - 2, x: d3.interpolateNumber(ka[1], kb[1])}); + } else if (kb[0] != 1 || kb[1] != 1) { + s.push(s.pop() + "scale(" + kb + ")"); + } + + n = q.length; + return function(t) { + var i = -1, o; + while (++i < n) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; +}; + +d3.interpolateRgb = function(a, b) { + a = d3.rgb(a); + b = d3.rgb(b); + var ar = a.r, + ag = a.g, + ab = a.b, + br = b.r - ar, + bg = b.g - ag, + bb = b.b - ab; + return function(t) { + return "#" + + d3_rgb_hex(Math.round(ar + br * t)) + + d3_rgb_hex(Math.round(ag + bg * t)) + + d3_rgb_hex(Math.round(ab + bb * t)); + }; +}; + +// interpolates HSL space, but outputs RGB string (for compatibility) +d3.interpolateHsl = function(a, b) { + a = d3.hsl(a); + b = d3.hsl(b); + var h0 = a.h, + s0 = a.s, + l0 = a.l, + h1 = b.h - h0, + s1 = b.s - s0, + l1 = b.l - l0; + return function(t) { + return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t).toString(); + }; +}; + +d3.interpolateArray = function(a, b) { + var x = [], + c = [], + na = a.length, + nb = b.length, + n0 = Math.min(a.length, b.length), + i; + for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i])); + for (; i < na; ++i) c[i] = a[i]; + for (; i < nb; ++i) c[i] = b[i]; + return function(t) { + for (i = 0; i < n0; ++i) c[i] = x[i](t); + return c; + }; +}; + +d3.interpolateObject = function(a, b) { + var i = {}, + c = {}, + k; + for (k in a) { + if (k in b) { + i[k] = d3_interpolateByName(k)(a[k], b[k]); + } else { + c[k] = a[k]; + } + } + for (k in b) { + if (!(k in a)) { + c[k] = b[k]; + } + } + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; +} + +var d3_interpolate_number = /[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g; + +function d3_interpolateByName(n) { + return n == "transform" + ? d3.interpolateTransform + : d3.interpolate; +} + +d3.interpolators = [ + d3.interpolateObject, + function(a, b) { return (b instanceof Array) && d3.interpolateArray(a, b); }, + function(a, b) { return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); }, + function(a, b) { return (typeof b === "string" ? b in d3_rgb_names || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b); }, + function(a, b) { return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); } +]; +function d3_uninterpolateNumber(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { return (x - a) * b; }; +} + +function d3_uninterpolateClamp(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { return Math.max(0, Math.min(1, (x - a) * b)); }; +} +d3.rgb = function(r, g, b) { + return arguments.length === 1 + ? (r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) + : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb)) + : d3_rgb(~~r, ~~g, ~~b); +}; + +function d3_rgb(r, g, b) { + return new d3_Rgb(r, g, b); +} + +function d3_Rgb(r, g, b) { + this.r = r; + this.g = g; + this.b = b; +} + +d3_Rgb.prototype.brighter = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + var r = this.r, + g = this.g, + b = this.b, + i = 30; + if (!r && !g && !b) return d3_rgb(i, i, i); + if (r && r < i) r = i; + if (g && g < i) g = i; + if (b && b < i) b = i; + return d3_rgb( + Math.min(255, Math.floor(r / k)), + Math.min(255, Math.floor(g / k)), + Math.min(255, Math.floor(b / k))); +}; + +d3_Rgb.prototype.darker = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + return d3_rgb( + Math.floor(k * this.r), + Math.floor(k * this.g), + Math.floor(k * this.b)); +}; + +d3_Rgb.prototype.hsl = function() { + return d3_rgb_hsl(this.r, this.g, this.b); +}; + +d3_Rgb.prototype.toString = function() { + return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); +}; + +function d3_rgb_hex(v) { + return v < 0x10 + ? "0" + Math.max(0, v).toString(16) + : Math.min(255, v).toString(16); +} + +function d3_rgb_parse(format, rgb, hsl) { + var r = 0, // red channel; int in [0, 255] + g = 0, // green channel; int in [0, 255] + b = 0, // blue channel; int in [0, 255] + m1, // CSS color specification match + m2, // CSS color specification type (e.g., rgb) + name; + + /* Handle hsl, rgb. */ + m1 = /([a-z]+)\((.*)\)/i.exec(format); + if (m1) { + m2 = m1[2].split(","); + switch (m1[1]) { + case "hsl": { + return hsl( + parseFloat(m2[0]), // degrees + parseFloat(m2[1]) / 100, // percentage + parseFloat(m2[2]) / 100 // percentage + ); + } + case "rgb": { + return rgb( + d3_rgb_parseNumber(m2[0]), + d3_rgb_parseNumber(m2[1]), + d3_rgb_parseNumber(m2[2]) + ); + } + } + } + + /* Named colors. */ + if (name = d3_rgb_names[format]) return rgb(name.r, name.g, name.b); + + /* Hexadecimal colors: #rgb and #rrggbb. */ + if (format != null && format.charAt(0) === "#") { + if (format.length === 4) { + r = format.charAt(1); r += r; + g = format.charAt(2); g += g; + b = format.charAt(3); b += b; + } else if (format.length === 7) { + r = format.substring(1, 3); + g = format.substring(3, 5); + b = format.substring(5, 7); + } + r = parseInt(r, 16); + g = parseInt(g, 16); + b = parseInt(b, 16); + } + + return rgb(r, g, b); +} + +function d3_rgb_hsl(r, g, b) { + var min = Math.min(r /= 255, g /= 255, b /= 255), + max = Math.max(r, g, b), + d = max - min, + h, + s, + l = (max + min) / 2; + if (d) { + s = l < .5 ? d / (max + min) : d / (2 - max - min); + if (r == max) h = (g - b) / d + (g < b ? 6 : 0); + else if (g == max) h = (b - r) / d + 2; + else h = (r - g) / d + 4; + h *= 60; + } else { + s = h = 0; + } + return d3_hsl(h, s, l); +} + +function d3_rgb_parseNumber(c) { // either integer or percentage + var f = parseFloat(c); + return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; +} + +var d3_rgb_names = { + aliceblue: "#f0f8ff", + antiquewhite: "#faebd7", + aqua: "#00ffff", + aquamarine: "#7fffd4", + azure: "#f0ffff", + beige: "#f5f5dc", + bisque: "#ffe4c4", + black: "#000000", + blanchedalmond: "#ffebcd", + blue: "#0000ff", + blueviolet: "#8a2be2", + brown: "#a52a2a", + burlywood: "#deb887", + cadetblue: "#5f9ea0", + chartreuse: "#7fff00", + chocolate: "#d2691e", + coral: "#ff7f50", + cornflowerblue: "#6495ed", + cornsilk: "#fff8dc", + crimson: "#dc143c", + cyan: "#00ffff", + darkblue: "#00008b", + darkcyan: "#008b8b", + darkgoldenrod: "#b8860b", + darkgray: "#a9a9a9", + darkgreen: "#006400", + darkgrey: "#a9a9a9", + darkkhaki: "#bdb76b", + darkmagenta: "#8b008b", + darkolivegreen: "#556b2f", + darkorange: "#ff8c00", + darkorchid: "#9932cc", + darkred: "#8b0000", + darksalmon: "#e9967a", + darkseagreen: "#8fbc8f", + darkslateblue: "#483d8b", + darkslategray: "#2f4f4f", + darkslategrey: "#2f4f4f", + darkturquoise: "#00ced1", + darkviolet: "#9400d3", + deeppink: "#ff1493", + deepskyblue: "#00bfff", + dimgray: "#696969", + dimgrey: "#696969", + dodgerblue: "#1e90ff", + firebrick: "#b22222", + floralwhite: "#fffaf0", + forestgreen: "#228b22", + fuchsia: "#ff00ff", + gainsboro: "#dcdcdc", + ghostwhite: "#f8f8ff", + gold: "#ffd700", + goldenrod: "#daa520", + gray: "#808080", + green: "#008000", + greenyellow: "#adff2f", + grey: "#808080", + honeydew: "#f0fff0", + hotpink: "#ff69b4", + indianred: "#cd5c5c", + indigo: "#4b0082", + ivory: "#fffff0", + khaki: "#f0e68c", + lavender: "#e6e6fa", + lavenderblush: "#fff0f5", + lawngreen: "#7cfc00", + lemonchiffon: "#fffacd", + lightblue: "#add8e6", + lightcoral: "#f08080", + lightcyan: "#e0ffff", + lightgoldenrodyellow: "#fafad2", + lightgray: "#d3d3d3", + lightgreen: "#90ee90", + lightgrey: "#d3d3d3", + lightpink: "#ffb6c1", + lightsalmon: "#ffa07a", + lightseagreen: "#20b2aa", + lightskyblue: "#87cefa", + lightslategray: "#778899", + lightslategrey: "#778899", + lightsteelblue: "#b0c4de", + lightyellow: "#ffffe0", + lime: "#00ff00", + limegreen: "#32cd32", + linen: "#faf0e6", + magenta: "#ff00ff", + maroon: "#800000", + mediumaquamarine: "#66cdaa", + mediumblue: "#0000cd", + mediumorchid: "#ba55d3", + mediumpurple: "#9370db", + mediumseagreen: "#3cb371", + mediumslateblue: "#7b68ee", + mediumspringgreen: "#00fa9a", + mediumturquoise: "#48d1cc", + mediumvioletred: "#c71585", + midnightblue: "#191970", + mintcream: "#f5fffa", + mistyrose: "#ffe4e1", + moccasin: "#ffe4b5", + navajowhite: "#ffdead", + navy: "#000080", + oldlace: "#fdf5e6", + olive: "#808000", + olivedrab: "#6b8e23", + orange: "#ffa500", + orangered: "#ff4500", + orchid: "#da70d6", + palegoldenrod: "#eee8aa", + palegreen: "#98fb98", + paleturquoise: "#afeeee", + palevioletred: "#db7093", + papayawhip: "#ffefd5", + peachpuff: "#ffdab9", + peru: "#cd853f", + pink: "#ffc0cb", + plum: "#dda0dd", + powderblue: "#b0e0e6", + purple: "#800080", + red: "#ff0000", + rosybrown: "#bc8f8f", + royalblue: "#4169e1", + saddlebrown: "#8b4513", + salmon: "#fa8072", + sandybrown: "#f4a460", + seagreen: "#2e8b57", + seashell: "#fff5ee", + sienna: "#a0522d", + silver: "#c0c0c0", + skyblue: "#87ceeb", + slateblue: "#6a5acd", + slategray: "#708090", + slategrey: "#708090", + snow: "#fffafa", + springgreen: "#00ff7f", + steelblue: "#4682b4", + tan: "#d2b48c", + teal: "#008080", + thistle: "#d8bfd8", + tomato: "#ff6347", + turquoise: "#40e0d0", + violet: "#ee82ee", + wheat: "#f5deb3", + white: "#ffffff", + whitesmoke: "#f5f5f5", + yellow: "#ffff00", + yellowgreen: "#9acd32" +}; + +for (var d3_rgb_name in d3_rgb_names) { + d3_rgb_names[d3_rgb_name] = d3_rgb_parse( + d3_rgb_names[d3_rgb_name], + d3_rgb, + d3_hsl_rgb); +} +d3.hsl = function(h, s, l) { + return arguments.length === 1 + ? (h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) + : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl)) + : d3_hsl(+h, +s, +l); +}; + +function d3_hsl(h, s, l) { + return new d3_Hsl(h, s, l); +} + +function d3_Hsl(h, s, l) { + this.h = h; + this.s = s; + this.l = l; +} + +d3_Hsl.prototype.brighter = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, this.l / k); +}; + +d3_Hsl.prototype.darker = function(k) { + k = Math.pow(0.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, k * this.l); +}; + +d3_Hsl.prototype.rgb = function() { + return d3_hsl_rgb(this.h, this.s, this.l); +}; + +d3_Hsl.prototype.toString = function() { + return this.rgb().toString(); +}; + +function d3_hsl_rgb(h, s, l) { + var m1, + m2; + + /* Some simple corrections for h, s and l. */ + h = h % 360; if (h < 0) h += 360; + s = s < 0 ? 0 : s > 1 ? 1 : s; + l = l < 0 ? 0 : l > 1 ? 1 : l; + + /* From FvD 13.37, CSS Color Module Level 3 */ + m2 = l <= .5 ? l * (1 + s) : l + s - l * s; + m1 = 2 * l - m2; + + function v(h) { + if (h > 360) h -= 360; + else if (h < 0) h += 360; + if (h < 60) return m1 + (m2 - m1) * h / 60; + if (h < 180) return m2; + if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; + return m1; + } + + function vv(h) { + return Math.round(v(h) * 255); + } + + return d3_rgb(vv(h + 120), vv(h), vv(h - 120)); +} +function d3_selection(groups) { + d3_arraySubclass(groups, d3_selectionPrototype); + return groups; +} + +var d3_select = function(s, n) { return n.querySelector(s); }, + d3_selectAll = function(s, n) { return n.querySelectorAll(s); }, + d3_selectRoot = document.documentElement, + d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, + d3_selectMatches = function(n, s) { return d3_selectMatcher.call(n, s); }; + +// Prefer Sizzle, if available. +if (typeof Sizzle === "function") { + d3_select = function(s, n) { return Sizzle(s, n)[0]; }; + d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); }; + d3_selectMatches = Sizzle.matchesSelector; +} + +var d3_selectionPrototype = []; + +d3.selection = function() { + return d3_selectionRoot; +}; + +d3.selection.prototype = d3_selectionPrototype; +d3_selectionPrototype.select = function(selector) { + var subgroups = [], + subgroup, + subnode, + group, + node; + + if (typeof selector !== "function") selector = d3_selection_selector(selector); + + for (var j = -1, m = this.length; ++j < m;) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subgroup.push(subnode = selector.call(node, node.__data__, i)); + if (subnode && "__data__" in node) subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + + return d3_selection(subgroups); +}; + +function d3_selection_selector(selector) { + return function() { + return d3_select(selector, this); + }; +} +d3_selectionPrototype.selectAll = function(selector) { + var subgroups = [], + subgroup, + node; + + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i))); + subgroup.parentNode = node; + } + } + } + + return d3_selection(subgroups); +}; + +function d3_selection_selectorAll(selector) { + return function() { + return d3_selectAll(selector, this); + }; +} +d3_selectionPrototype.attr = function(name, value) { + name = d3.ns.qualify(name); + + // If no value is specified, return the first value. + if (arguments.length < 2) { + var node = this.node(); + return name.local + ? node.getAttributeNS(name.space, name.local) + : node.getAttribute(name); + } + + function attrNull() { + this.removeAttribute(name); + } + + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); + } + + function attrConstant() { + this.setAttribute(name, value); + } + + function attrConstantNS() { + this.setAttributeNS(name.space, name.local, value); + } + + function attrFunction() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttribute(name); + else this.setAttribute(name, x); + } + + function attrFunctionNS() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttributeNS(name.space, name.local); + else this.setAttributeNS(name.space, name.local, x); + } + + return this.each(value == null + ? (name.local ? attrNullNS : attrNull) : (typeof value === "function" + ? (name.local ? attrFunctionNS : attrFunction) + : (name.local ? attrConstantNS : attrConstant))); +}; +d3_selectionPrototype.classed = function(name, value) { + var names = name.split(d3_selection_classedWhitespace), + n = names.length, + i = -1; + if (arguments.length > 1) { + while (++i < n) d3_selection_classed.call(this, names[i], value); + return this; + } else { + while (++i < n) if (!d3_selection_classed.call(this, names[i])) return false; + return true; + } +}; + +var d3_selection_classedWhitespace = /\s+/g; + +function d3_selection_classed(name, value) { + var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g"); + + // If no value is specified, return the first value. + if (arguments.length < 2) { + var node = this.node(); + if (c = node.classList) return c.contains(name); + var c = node.className; + re.lastIndex = 0; + return re.test(c.baseVal != null ? c.baseVal : c); + } + + function classedAdd() { + if (c = this.classList) return c.add(name); + var c = this.className, + cb = c.baseVal != null, + cv = cb ? c.baseVal : c; + re.lastIndex = 0; + if (!re.test(cv)) { + cv = d3_collapse(cv + " " + name); + if (cb) c.baseVal = cv; + else this.className = cv; + } + } + + function classedRemove() { + if (c = this.classList) return c.remove(name); + var c = this.className, + cb = c.baseVal != null, + cv = cb ? c.baseVal : c; + cv = d3_collapse(cv.replace(re, " ")); + if (cb) c.baseVal = cv; + else this.className = cv; + } + + function classedFunction() { + (value.apply(this, arguments) + ? classedAdd + : classedRemove).call(this); + } + + return this.each(typeof value === "function" + ? classedFunction : value + ? classedAdd + : classedRemove); +} +d3_selectionPrototype.style = function(name, value, priority) { + if (arguments.length < 3) priority = ""; + + // If no value is specified, return the first value. + if (arguments.length < 2) return window + .getComputedStyle(this.node(), null) + .getPropertyValue(name); + + function styleNull() { + this.style.removeProperty(name); + } + + function styleConstant() { + this.style.setProperty(name, value, priority); + } + + function styleFunction() { + var x = value.apply(this, arguments); + if (x == null) this.style.removeProperty(name); + else this.style.setProperty(name, x, priority); + } + + return this.each(value == null + ? styleNull : (typeof value === "function" + ? styleFunction : styleConstant)); +}; +d3_selectionPrototype.property = function(name, value) { + + // If no value is specified, return the first value. + if (arguments.length < 2) return this.node()[name]; + + function propertyNull() { + delete this[name]; + } + + function propertyConstant() { + this[name] = value; + } + + function propertyFunction() { + var x = value.apply(this, arguments); + if (x == null) delete this[name]; + else this[name] = x; + } + + return this.each(value == null + ? propertyNull : (typeof value === "function" + ? propertyFunction : propertyConstant)); +}; +d3_selectionPrototype.text = function(value) { + return arguments.length < 1 + ? this.node().textContent : this.each(typeof value === "function" + ? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null + ? function() { this.textContent = ""; } + : function() { this.textContent = value; }); +}; +d3_selectionPrototype.html = function(value) { + return arguments.length < 1 + ? this.node().innerHTML : this.each(typeof value === "function" + ? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null + ? function() { this.innerHTML = ""; } + : function() { this.innerHTML = value; }); +}; +// TODO append(node)? +// TODO append(function)? +d3_selectionPrototype.append = function(name) { + name = d3.ns.qualify(name); + + function append() { + return this.appendChild(document.createElementNS(this.namespaceURI, name)); + } + + function appendNS() { + return this.appendChild(document.createElementNS(name.space, name.local)); + } + + return this.select(name.local ? appendNS : append); +}; +// TODO insert(node, function)? +// TODO insert(function, string)? +// TODO insert(function, function)? +d3_selectionPrototype.insert = function(name, before) { + name = d3.ns.qualify(name); + + function insert() { + return this.insertBefore( + document.createElementNS(this.namespaceURI, name), + d3_select(before, this)); + } + + function insertNS() { + return this.insertBefore( + document.createElementNS(name.space, name.local), + d3_select(before, this)); + } + + return this.select(name.local ? insertNS : insert); +}; +// TODO remove(selector)? +// TODO remove(node)? +// TODO remove(function)? +d3_selectionPrototype.remove = function() { + return this.each(function() { + var parent = this.parentNode; + if (parent) parent.removeChild(this); + }); +}; +// TODO data(null) for clearing data? +d3_selectionPrototype.data = function(data, join) { + var enter = [], + update = [], + exit = []; + + function bind(group, groupData) { + var i, + n = group.length, + m = groupData.length, + n0 = Math.min(n, m), + n1 = Math.max(n, m), + updateNodes = [], + enterNodes = [], + exitNodes = [], + node, + nodeData; + + if (join) { + var nodeByKey = {}, + keys = [], + key, + j = groupData.length; + + for (i = -1; ++i < n;) { + key = join.call(node = group[i], node.__data__, i); + if (key in nodeByKey) { + exitNodes[j++] = node; // duplicate key + } else { + nodeByKey[key] = node; + } + keys.push(key); + } + + for (i = -1; ++i < m;) { + node = nodeByKey[key = join.call(groupData, nodeData = groupData[i], i)]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + updateNodes[i] = exitNodes[i] = null; + } + delete nodeByKey[key]; + } + + for (i = -1; ++i < n;) { + if (keys[i] in nodeByKey) { + exitNodes[i] = group[i]; + } + } + } else { + for (i = -1; ++i < n0;) { + node = group[i]; + nodeData = groupData[i]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + updateNodes[i] = exitNodes[i] = null; + } + } + for (; i < m; ++i) { + enterNodes[i] = d3_selection_dataNode(groupData[i]); + updateNodes[i] = exitNodes[i] = null; + } + for (; i < n1; ++i) { + exitNodes[i] = group[i]; + enterNodes[i] = updateNodes[i] = null; + } + } + + enterNodes.update + = updateNodes; + + enterNodes.parentNode + = updateNodes.parentNode + = exitNodes.parentNode + = group.parentNode; + + enter.push(enterNodes); + update.push(updateNodes); + exit.push(exitNodes); + } + + var i = -1, + n = this.length, + group; + if (typeof data === "function") { + while (++i < n) { + bind(group = this[i], data.call(group, group.parentNode.__data__, i)); + } + } else { + while (++i < n) { + bind(group = this[i], data); + } + } + + var selection = d3_selection(update); + selection.enter = function() { return d3_selection_enter(enter); }; + selection.exit = function() { return d3_selection(exit); }; + return selection; +}; + +function d3_selection_dataNode(data) { + return {__data__: data}; +} +d3_selectionPrototype.filter = function(filter) { + var subgroups = [], + subgroup, + group, + node; + + if (typeof filter !== "function") filter = d3_selection_filter(filter); + + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i)) { + subgroup.push(node); + } + } + } + + return d3_selection(subgroups); +}; + +function d3_selection_filter(selector) { + return function() { + return d3_selectMatches(this, selector); + }; +} +d3_selectionPrototype.map = function(map) { + return this.each(function() { + this.__data__ = map.apply(this, arguments); + }); +}; +d3_selectionPrototype.order = function() { + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) { + if (node = group[i]) { + if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); + next = node; + } + } + } + return this; +}; +d3_selectionPrototype.sort = function(comparator) { + comparator = d3_selection_sortComparator.apply(this, arguments); + for (var j = -1, m = this.length; ++j < m;) this[j].sort(comparator); + return this.order(); +}; + +function d3_selection_sortComparator(comparator) { + if (!arguments.length) comparator = d3.ascending; + return function(a, b) { + return comparator(a && a.__data__, b && b.__data__); + }; +} +// type can be namespaced, e.g., "click.foo" +// listener can be null for removal +d3_selectionPrototype.on = function(type, listener, capture) { + if (arguments.length < 3) capture = false; + + // parse the type specifier + var name = "__on" + type, i = type.indexOf("."); + if (i > 0) type = type.substring(0, i); + + // if called with only one argument, return the current listener + if (arguments.length < 2) return (i = this.node()[name]) && i._; + + // remove the old event listener, and add the new event listener + return this.each(function(d, i) { + var node = this; + + if (node[name]) node.removeEventListener(type, node[name], capture); + if (listener) node.addEventListener(type, node[name] = l, capture); + + // wrapped event listener that preserves i + function l(e) { + var o = d3.event; // Events can be reentrant (e.g., focus). + d3.event = e; + try { + listener.call(node, node.__data__, i); + } finally { + d3.event = o; + } + } + + // stash the unwrapped listener for retrieval + l._ = listener; + }); +}; +d3_selectionPrototype.each = function(callback) { + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + var node = group[i]; + if (node) callback.call(node, node.__data__, i, j); + } + } + return this; +}; +// +// Note: assigning to the arguments array simultaneously changes the value of +// the corresponding argument! +// +// TODO The `this` argument probably shouldn't be the first argument to the +// callback, anyway, since it's redundant. However, that will require a major +// version bump due to backwards compatibility, so I'm not changing it right +// away. +// +d3_selectionPrototype.call = function(callback) { + callback.apply(this, (arguments[0] = this, arguments)); + return this; +}; +d3_selectionPrototype.empty = function() { + return !this.node(); +}; +d3_selectionPrototype.node = function(callback) { + for (var j = 0, m = this.length; j < m; j++) { + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) return node; + } + } + return null; +}; +d3_selectionPrototype.transition = function() { + var subgroups = [], + subgroup, + node; + + for (var j = -1, m = this.length; ++j < m;) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + subgroup.push((node = group[i]) ? {node: node, delay: 0, duration: 250} : null); + } + } + + return d3_transition(subgroups, d3_transitionInheritId || ++d3_transitionId, Date.now()); +}; +var d3_selectionRoot = d3_selection([[document]]); + +d3_selectionRoot[0].parentNode = d3_selectRoot; + +// TODO fast singleton implementation! +// TODO select(function) +d3.select = function(selector) { + return typeof selector === "string" + ? d3_selectionRoot.select(selector) + : d3_selection([[selector]]); // assume node +}; + +// TODO selectAll(function) +d3.selectAll = function(selector) { + return typeof selector === "string" + ? d3_selectionRoot.selectAll(selector) + : d3_selection([d3_array(selector)]); // assume node[] +}; +function d3_selection_enter(selection) { + d3_arraySubclass(selection, d3_selection_enterPrototype); + return selection; +} + +var d3_selection_enterPrototype = []; + +d3_selection_enterPrototype.append = d3_selectionPrototype.append; +d3_selection_enterPrototype.insert = d3_selectionPrototype.insert; +d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; +d3_selection_enterPrototype.node = d3_selectionPrototype.node; +d3_selection_enterPrototype.select = function(selector) { + var subgroups = [], + subgroup, + subnode, + upgroup, + group, + node; + + for (var j = -1, m = this.length; ++j < m;) { + upgroup = (group = this[j]).update; + subgroups.push(subgroup = []); + subgroup.parentNode = group.parentNode; + for (var i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i)); + subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + + return d3_selection(subgroups); +}; +function d3_transition(groups, id, time) { + d3_arraySubclass(groups, d3_transitionPrototype); + + var tweens = {}, + event = d3.dispatch("start", "end"), + ease = d3_transitionEase; + + groups.id = id; + + groups.time = time; + + groups.tween = function(name, tween) { + if (arguments.length < 2) return tweens[name]; + if (tween == null) delete tweens[name]; + else tweens[name] = tween; + return groups; + }; + + groups.ease = function(value) { + if (!arguments.length) return ease; + ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments); + return groups; + }; + + groups.each = function(type, listener) { + if (arguments.length < 2) return d3_transition_each.call(groups, type); + event.on(type, listener); + return groups; + }; + + d3.timer(function(elapsed) { + groups.each(function(d, i, j) { + var tweened = [], + node = this, + delay = groups[j][i].delay, + duration = groups[j][i].duration, + lock = node.__transition__ || (node.__transition__ = {active: 0, count: 0}); + + ++lock.count; + + delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time); + + function start(elapsed) { + if (lock.active > id) return stop(); + lock.active = id; + + for (var tween in tweens) { + if (tween = tweens[tween].call(node, d, i)) { + tweened.push(tween); + } + } + + event.start.call(node, d, i); + if (!tick(elapsed)) d3.timer(tick, 0, time); + return 1; + } + + function tick(elapsed) { + if (lock.active !== id) return stop(); + + var t = (elapsed - delay) / duration, + e = ease(t), + n = tweened.length; + + while (n > 0) { + tweened[--n].call(node, e); + } + + if (t >= 1) { + stop(); + d3_transitionInheritId = id; + event.end.call(node, d, i); + d3_transitionInheritId = 0; + return 1; + } + } + + function stop() { + if (!--lock.count) delete node.__transition__; + return 1; + } + }); + return 1; + }, 0, time); + + return groups; +} + +var d3_transitionRemove = {}; + +function d3_transitionNull(d, i, a) { + return a != "" && d3_transitionRemove; +} + +function d3_transitionTween(name, b) { + var interpolate = d3_interpolateByName(name); + + function transitionFunction(d, i, a) { + var v = b.call(this, d, i); + return v == null + ? a != "" && d3_transitionRemove + : a != v && interpolate(a, v); + } + + function transitionString(d, i, a) { + return a != b && interpolate(a, b); + } + + return typeof b === "function" ? transitionFunction + : b == null ? d3_transitionNull + : (b += "", transitionString); +} + +var d3_transitionPrototype = [], + d3_transitionId = 0, + d3_transitionInheritId = 0, + d3_transitionEase = d3.ease("cubic-in-out"); + +d3_transitionPrototype.call = d3_selectionPrototype.call; + +d3.transition = function() { + return d3_selectionRoot.transition(); +}; + +d3.transition.prototype = d3_transitionPrototype; +d3_transitionPrototype.select = function(selector) { + var subgroups = [], + subgroup, + subnode, + node; + + if (typeof selector !== "function") selector = d3_selection_selector(selector); + + for (var j = -1, m = this.length; ++j < m;) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) { + if ("__data__" in node.node) subnode.__data__ = node.node.__data__; + subgroup.push({node: subnode, delay: node.delay, duration: node.duration}); + } else { + subgroup.push(null); + } + } + } + + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); +}; +d3_transitionPrototype.selectAll = function(selector) { + var subgroups = [], + subgroup, + subnodes, + node; + + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + + for (var j = -1, m = this.length; ++j < m;) { + for (var group = this[j], i = -1, n = group.length; ++i < n;) { + if (node = group[i]) { + subnodes = selector.call(node.node, node.node.__data__, i); + subgroups.push(subgroup = []); + for (var k = -1, o = subnodes.length; ++k < o;) { + subgroup.push({node: subnodes[k], delay: node.delay, duration: node.duration}); + } + } + } + } + + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); +}; +d3_transitionPrototype.attr = function(name, value) { + return this.attrTween(name, d3_transitionTween(name, value)); +}; + +d3_transitionPrototype.attrTween = function(nameNS, tween) { + var name = d3.ns.qualify(nameNS); + + function attrTween(d, i) { + var f = tween.call(this, d, i, this.getAttribute(name)); + return f === d3_transitionRemove + ? (this.removeAttribute(name), null) + : f && function(t) { this.setAttribute(name, f(t)); }; + } + + function attrTweenNS(d, i) { + var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); + return f === d3_transitionRemove + ? (this.removeAttributeNS(name.space, name.local), null) + : f && function(t) { this.setAttributeNS(name.space, name.local, f(t)); }; + } + + return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); +}; +d3_transitionPrototype.style = function(name, value, priority) { + if (arguments.length < 3) priority = ""; + return this.styleTween(name, d3_transitionTween(name, value), priority); +}; + +d3_transitionPrototype.styleTween = function(name, tween, priority) { + if (arguments.length < 3) priority = ""; + return this.tween("style." + name, function(d, i) { + var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name)); + return f === d3_transitionRemove + ? (this.style.removeProperty(name), null) + : f && function(t) { this.style.setProperty(name, f(t), priority); }; + }); +}; +d3_transitionPrototype.text = function(value) { + return this.tween("text", function(d, i) { + this.textContent = typeof value === "function" + ? value.call(this, d, i) + : value; + }); +}; +d3_transitionPrototype.remove = function() { + return this.each("end.transition", function() { + var p; + if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this); + }); +}; +d3_transitionPrototype.delay = function(value) { + var groups = this; + return groups.each(typeof value === "function" + ? function(d, i, j) { groups[j][i].delay = +value.apply(this, arguments); } + : (value = +value, function(d, i, j) { groups[j][i].delay = value; })); +}; +d3_transitionPrototype.duration = function(value) { + var groups = this; + return groups.each(typeof value === "function" + ? function(d, i, j) { groups[j][i].duration = +value.apply(this, arguments); } + : (value = +value, function(d, i, j) { groups[j][i].duration = value; })); +}; +function d3_transition_each(callback) { + for (var j = 0, m = this.length; j < m; j++) { + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) callback.call(node = node.node, node.__data__, i, j); + } + } + return this; +} +d3_transitionPrototype.transition = function() { + return this.select(d3_this); +}; +var d3_timer_queue = null, + d3_timer_interval, // is an interval (or frame) active? + d3_timer_timeout; // is a timeout active? + +// The timer will continue to fire until callback returns true. +d3.timer = function(callback, delay, then) { + var found = false, + t0, + t1 = d3_timer_queue; + + if (arguments.length < 3) { + if (arguments.length < 2) delay = 0; + else if (!isFinite(delay)) return; + then = Date.now(); + } + + // See if the callback's already in the queue. + while (t1) { + if (t1.callback === callback) { + t1.then = then; + t1.delay = delay; + found = true; + break; + } + t0 = t1; + t1 = t1.next; + } + + // Otherwise, add the callback to the queue. + if (!found) d3_timer_queue = { + callback: callback, + then: then, + delay: delay, + next: d3_timer_queue + }; + + // Start animatin'! + if (!d3_timer_interval) { + d3_timer_timeout = clearTimeout(d3_timer_timeout); + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } +} + +function d3_timer_step() { + var elapsed, + now = Date.now(), + t1 = d3_timer_queue; + + while (t1) { + elapsed = now - t1.then; + if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + + var delay = d3_timer_flush() - now; + if (delay > 24) { + if (isFinite(delay)) { + clearTimeout(d3_timer_timeout); + d3_timer_timeout = setTimeout(d3_timer_step, delay); + } + d3_timer_interval = 0; + } else { + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } +} + +d3.timer.flush = function() { + var elapsed, + now = Date.now(), + t1 = d3_timer_queue; + + while (t1) { + elapsed = now - t1.then; + if (!t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + + d3_timer_flush(); +}; + +// Flush after callbacks, to avoid concurrent queue modification. +function d3_timer_flush() { + var t0 = null, + t1 = d3_timer_queue, + then = Infinity; + while (t1) { + if (t1.flush) { + t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next; + } else { + then = Math.min(then, t1.then + t1.delay); + t1 = (t0 = t1).next; + } + } + return then; +} + +var d3_timer_frame = window.requestAnimationFrame + || window.webkitRequestAnimationFrame + || window.mozRequestAnimationFrame + || window.oRequestAnimationFrame + || window.msRequestAnimationFrame + || function(callback) { setTimeout(callback, 17); }; +d3.transform = function(string) { + var g = document.createElementNS(d3.ns.prefix.svg, "g"), + identity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0}; + return (d3.transform = function(string) { + g.setAttribute("transform", string); + var t = g.transform.baseVal.consolidate(); + return new d3_transform(t ? t.matrix : identity); + })(string); +}; + +// Compute x-scale and normalize the first row. +// Compute shear and make second row orthogonal to first. +// Compute y-scale and normalize the second row. +// Finally, compute the rotation. +function d3_transform(m) { + var r0 = [m.a, m.b], + r1 = [m.c, m.d], + kx = d3_transformNormalize(r0), + kz = d3_transformDot(r0, r1), + ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; + if (r0[0] * r1[1] < r1[0] * r0[1]) { + r0[0] *= -1; + r0[1] *= -1; + kx *= -1; + kz *= -1; + } + this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees; + this.translate = [m.e, m.f]; + this.scale = [kx, ky]; + this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0; +}; + +d3_transform.prototype.toString = function() { + return "translate(" + this.translate + + ")rotate(" + this.rotate + + ")skewX(" + this.skew + + ")scale(" + this.scale + + ")"; +}; + +function d3_transformDot(a, b) { + return a[0] * b[0] + a[1] * b[1]; +} + +function d3_transformNormalize(a) { + var k = Math.sqrt(d3_transformDot(a, a)); + if (k) { + a[0] /= k; + a[1] /= k; + } + return k; +} + +function d3_transformCombine(a, b, k) { + a[0] += k * b[0]; + a[1] += k * b[1]; + return a; +} + +var d3_transformDegrees = 180 / Math.PI; +function d3_noop() {} +d3.scale = {}; + +function d3_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [start, stop] : [stop, start]; +} + +function d3_scaleRange(scale) { + return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); +} +function d3_scale_nice(domain, nice) { + var i0 = 0, + i1 = domain.length - 1, + x0 = domain[i0], + x1 = domain[i1], + dx; + + if (x1 < x0) { + dx = i0; i0 = i1; i1 = dx; + dx = x0; x0 = x1; x1 = dx; + } + + if (dx = x1 - x0) { + nice = nice(dx); + domain[i0] = nice.floor(x0); + domain[i1] = nice.ceil(x1); + } + + return domain; +} + +function d3_scale_niceDefault() { + return Math; +} +d3.scale.linear = function() { + return d3_scale_linear([0, 1], [0, 1], d3.interpolate, false); +}; + +function d3_scale_linear(domain, range, interpolate, clamp) { + var output, + input; + + function rescale() { + var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, + uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; + output = linear(domain, range, uninterpolate, interpolate); + input = linear(range, domain, uninterpolate, d3.interpolate); + return scale; + } + + function scale(x) { + return output(x); + } + + // Note: requires range is coercible to number! + scale.invert = function(y) { + return input(y); + }; + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.map(Number); + return rescale(); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + + scale.rangeRound = function(x) { + return scale.range(x).interpolate(d3.interpolateRound); + }; + + scale.clamp = function(x) { + if (!arguments.length) return clamp; + clamp = x; + return rescale(); + }; + + scale.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x; + return rescale(); + }; + + scale.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + + scale.tickFormat = function(m) { + return d3_scale_linearTickFormat(domain, m); + }; + + scale.nice = function() { + d3_scale_nice(domain, d3_scale_linearNice); + return rescale(); + }; + + scale.copy = function() { + return d3_scale_linear(domain, range, interpolate, clamp); + }; + + return rescale(); +} + +function d3_scale_linearRebind(scale, linear) { + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); +} + +function d3_scale_linearNice(dx) { + dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1); + return { + floor: function(x) { return Math.floor(x / dx) * dx; }, + ceil: function(x) { return Math.ceil(x / dx) * dx; } + }; +} + +function d3_scale_linearTickRange(domain, m) { + var extent = d3_scaleExtent(domain), + span = extent[1] - extent[0], + step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), + err = m / span * step; + + // Filter ticks to get closer to the desired count. + if (err <= .15) step *= 10; + else if (err <= .35) step *= 5; + else if (err <= .75) step *= 2; + + // Round start and stop values to step interval. + extent[0] = Math.ceil(extent[0] / step) * step; + extent[1] = Math.floor(extent[1] / step) * step + step * .5; // inclusive + extent[2] = step; + return extent; +} + +function d3_scale_linearTicks(domain, m) { + return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); +} + +function d3_scale_linearTickFormat(domain, m) { + return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f"); +} +function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { + var u = uninterpolate(domain[0], domain[1]), + i = interpolate(range[0], range[1]); + return function(x) { + return i(u(x)); + }; +} +function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { + var u = [], + i = [], + j = 0, + k = Math.min(domain.length, range.length) - 1; + + // Handle descending domains. + if (domain[k] < domain[0]) { + domain = domain.slice().reverse(); + range = range.slice().reverse(); + } + + while (++j <= k) { + u.push(uninterpolate(domain[j - 1], domain[j])); + i.push(interpolate(range[j - 1], range[j])); + } + + return function(x) { + var j = d3.bisect(domain, x, 1, k) - 1; + return i[j](u[j](x)); + }; +} +d3.scale.log = function() { + return d3_scale_log(d3.scale.linear(), d3_scale_logp); +}; + +function d3_scale_log(linear, log) { + var pow = log.pow; + + function scale(x) { + return linear(log(x)); + } + + scale.invert = function(x) { + return pow(linear.invert(x)); + }; + + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(pow); + log = x[0] < 0 ? d3_scale_logn : d3_scale_logp; + pow = log.pow; + linear.domain(x.map(log)); + return scale; + }; + + scale.nice = function() { + linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault)); + return scale; + }; + + scale.ticks = function() { + var extent = d3_scaleExtent(linear.domain()), + ticks = []; + if (extent.every(isFinite)) { + var i = Math.floor(extent[0]), + j = Math.ceil(extent[1]), + u = pow(extent[0]), + v = pow(extent[1]); + if (log === d3_scale_logn) { + ticks.push(pow(i)); + for (; i++ < j;) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k); + } else { + for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k); + ticks.push(pow(i)); + } + for (i = 0; ticks[i] < u; i++) {} // strip small values + for (j = ticks.length; ticks[j - 1] > v; j--) {} // strip big values + ticks = ticks.slice(i, j); + } + return ticks; + }; + + scale.tickFormat = function(n, format) { + if (arguments.length < 2) format = d3_scale_logFormat; + if (arguments.length < 1) return format; + var k = n / scale.ticks().length, + f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), + e; + return function(d) { + return d / pow(f(log(d) + e)) < k ? format(d) : ""; + }; + }; + + scale.copy = function() { + return d3_scale_log(linear.copy(), log); + }; + + return d3_scale_linearRebind(scale, linear); +} + +var d3_scale_logFormat = d3.format(".0e"); + +function d3_scale_logp(x) { + return Math.log(x < 0 ? 0 : x) / Math.LN10; +} + +function d3_scale_logn(x) { + return -Math.log(x > 0 ? 0 : -x) / Math.LN10; +} + +d3_scale_logp.pow = function(x) { + return Math.pow(10, x); +}; + +d3_scale_logn.pow = function(x) { + return -Math.pow(10, -x); +}; +d3.scale.pow = function() { + return d3_scale_pow(d3.scale.linear(), 1); +}; + +function d3_scale_pow(linear, exponent) { + var powp = d3_scale_powPow(exponent), + powb = d3_scale_powPow(1 / exponent); + + function scale(x) { + return linear(powp(x)); + } + + scale.invert = function(x) { + return powb(linear.invert(x)); + }; + + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(powb); + linear.domain(x.map(powp)); + return scale; + }; + + scale.ticks = function(m) { + return d3_scale_linearTicks(scale.domain(), m); + }; + + scale.tickFormat = function(m) { + return d3_scale_linearTickFormat(scale.domain(), m); + }; + + scale.nice = function() { + return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice)); + }; + + scale.exponent = function(x) { + if (!arguments.length) return exponent; + var domain = scale.domain(); + powp = d3_scale_powPow(exponent = x); + powb = d3_scale_powPow(1 / exponent); + return scale.domain(domain); + }; + + scale.copy = function() { + return d3_scale_pow(linear.copy(), exponent); + }; + + return d3_scale_linearRebind(scale, linear); +} + +function d3_scale_powPow(e) { + return function(x) { + return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); + }; +} +d3.scale.sqrt = function() { + return d3.scale.pow().exponent(.5); +}; +d3.scale.ordinal = function() { + return d3_scale_ordinal([], {t: "range", x: []}); +}; + +function d3_scale_ordinal(domain, ranger) { + var index, + range, + rangeBand; + + function scale(x) { + return range[((index[x] || (index[x] = domain.push(x))) - 1) % range.length]; + } + + function steps(start, step) { + return d3.range(domain.length).map(function(i) { return start + step * i; }); + } + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = []; + index = {}; + var i = -1, n = x.length, xi; + while (++i < n) if (!index[xi = x[i]]) index[xi] = domain.push(xi); + return scale[ranger.t](ranger.x, ranger.p); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + rangeBand = 0; + ranger = {t: "range", x: x}; + return scale; + }; + + scale.rangePoints = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], + stop = x[1], + step = (stop - start) / (domain.length - 1 + padding); + range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step); + rangeBand = 0; + ranger = {t: "rangePoints", x: x, p: padding}; + return scale; + }; + + scale.rangeBands = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], + stop = x[1], + step = (stop - start) / (domain.length + padding); + range = steps(start + step * padding, step); + rangeBand = step * (1 - padding); + ranger = {t: "rangeBands", x: x, p: padding}; + return scale; + }; + + scale.rangeRoundBands = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], + stop = x[1], + step = Math.floor((stop - start) / (domain.length + padding)); + range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step); + rangeBand = Math.round(step * (1 - padding)); + ranger = {t: "rangeRoundBands", x: x, p: padding}; + return scale; + }; + + scale.rangeBand = function() { + return rangeBand; + }; + + scale.rangeExtent = function() { + return ranger.t === "range" ? d3_scaleExtent(ranger.x) : ranger.x; + }; + + scale.copy = function() { + return d3_scale_ordinal(domain, ranger); + }; + + return scale.domain(domain); +} +/* + * This product includes color specifications and designs developed by Cynthia + * Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information. + */ + +d3.scale.category10 = function() { + return d3.scale.ordinal().range(d3_category10); +}; + +d3.scale.category20 = function() { + return d3.scale.ordinal().range(d3_category20); +}; + +d3.scale.category20b = function() { + return d3.scale.ordinal().range(d3_category20b); +}; + +d3.scale.category20c = function() { + return d3.scale.ordinal().range(d3_category20c); +}; + +var d3_category10 = [ + "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", + "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" +]; + +var d3_category20 = [ + "#1f77b4", "#aec7e8", + "#ff7f0e", "#ffbb78", + "#2ca02c", "#98df8a", + "#d62728", "#ff9896", + "#9467bd", "#c5b0d5", + "#8c564b", "#c49c94", + "#e377c2", "#f7b6d2", + "#7f7f7f", "#c7c7c7", + "#bcbd22", "#dbdb8d", + "#17becf", "#9edae5" +]; + +var d3_category20b = [ + "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", + "#637939", "#8ca252", "#b5cf6b", "#cedb9c", + "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", + "#843c39", "#ad494a", "#d6616b", "#e7969c", + "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" +]; + +var d3_category20c = [ + "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", + "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", + "#31a354", "#74c476", "#a1d99b", "#c7e9c0", + "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", + "#636363", "#969696", "#bdbdbd", "#d9d9d9" +]; +d3.scale.quantile = function() { + return d3_scale_quantile([], []); +}; + +function d3_scale_quantile(domain, range) { + var thresholds; + + function rescale() { + var k = 0, + n = domain.length, + q = range.length; + thresholds = []; + while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); + return scale; + } + + function scale(x) { + if (isNaN(x = +x)) return NaN; + return range[d3.bisect(thresholds, x)]; + } + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending); + return rescale(); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + + scale.quantiles = function() { + return thresholds; + }; + + scale.copy = function() { + return d3_scale_quantile(domain, range); // copy on write! + }; + + return rescale(); +} +d3.scale.quantize = function() { + return d3_scale_quantize(0, 1, [0, 1]); +}; + +function d3_scale_quantize(x0, x1, range) { + var kx, i; + + function scale(x) { + return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; + } + + function rescale() { + kx = range.length / (x1 - x0); + i = range.length - 1; + return scale; + } + + scale.domain = function(x) { + if (!arguments.length) return [x0, x1]; + x0 = +x[0]; + x1 = +x[x.length - 1]; + return rescale(); + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + + scale.copy = function() { + return d3_scale_quantize(x0, x1, range); // copy on write + }; + + return rescale(); +} +d3.svg = {}; +d3.svg.arc = function() { + var innerRadius = d3_svg_arcInnerRadius, + outerRadius = d3_svg_arcOuterRadius, + startAngle = d3_svg_arcStartAngle, + endAngle = d3_svg_arcEndAngle; + + function arc() { + var r0 = innerRadius.apply(this, arguments), + r1 = outerRadius.apply(this, arguments), + a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, + a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, + da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), + df = da < Math.PI ? "0" : "1", + c0 = Math.cos(a0), + s0 = Math.sin(a0), + c1 = Math.cos(a1), + s1 = Math.sin(a1); + return da >= d3_svg_arcMax + ? (r0 + ? "M0," + r1 + + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) + + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + + "M0," + r0 + + "A" + r0 + "," + r0 + " 0 1,0 0," + (-r0) + + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + + "Z" + : "M0," + r1 + + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) + + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + + "Z") + : (r0 + ? "M" + r1 * c0 + "," + r1 * s0 + + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + + "L" + r0 * c1 + "," + r0 * s1 + + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + + "Z" + : "M" + r1 * c0 + "," + r1 * s0 + + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + + "L0,0" + + "Z"); + } + + arc.innerRadius = function(v) { + if (!arguments.length) return innerRadius; + innerRadius = d3.functor(v); + return arc; + }; + + arc.outerRadius = function(v) { + if (!arguments.length) return outerRadius; + outerRadius = d3.functor(v); + return arc; + }; + + arc.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3.functor(v); + return arc; + }; + + arc.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3.functor(v); + return arc; + }; + + arc.centroid = function() { + var r = (innerRadius.apply(this, arguments) + + outerRadius.apply(this, arguments)) / 2, + a = (startAngle.apply(this, arguments) + + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset; + return [Math.cos(a) * r, Math.sin(a) * r]; + }; + + return arc; +}; + +var d3_svg_arcOffset = -Math.PI / 2, + d3_svg_arcMax = 2 * Math.PI - 1e-6; + +function d3_svg_arcInnerRadius(d) { + return d.innerRadius; +} + +function d3_svg_arcOuterRadius(d) { + return d.outerRadius; +} + +function d3_svg_arcStartAngle(d) { + return d.startAngle; +} + +function d3_svg_arcEndAngle(d) { + return d.endAngle; +} +function d3_svg_line(projection) { + var x = d3_svg_lineX, + y = d3_svg_lineY, + interpolate = "linear", + interpolator = d3_svg_lineInterpolators[interpolate], + tension = .7; + + function line(d) { + return d.length < 1 ? null : "M" + interpolator(projection(d3_svg_linePoints(this, d, x, y)), tension); + } + + line.x = function(v) { + if (!arguments.length) return x; + x = v; + return line; + }; + + line.y = function(v) { + if (!arguments.length) return y; + y = v; + return line; + }; + + line.interpolate = function(v) { + if (!arguments.length) return interpolate; + interpolator = d3_svg_lineInterpolators[interpolate = v]; + return line; + }; + + line.tension = function(v) { + if (!arguments.length) return tension; + tension = v; + return line; + }; + + return line; +} + +d3.svg.line = function() { + return d3_svg_line(Object); +}; + +// Converts the specified array of data into an array of points +// (x-y tuples), by evaluating the specified `x` and `y` functions on each +// data point. The `this` context of the evaluated functions is the specified +// "self" object; each function is passed the current datum and index. +function d3_svg_linePoints(self, d, x, y) { + var points = [], + i = -1, + n = d.length, + fx = typeof x === "function", + fy = typeof y === "function", + value; + if (fx && fy) { + while (++i < n) points.push([ + x.call(self, value = d[i], i), + y.call(self, value, i) + ]); + } else if (fx) { + while (++i < n) points.push([x.call(self, d[i], i), y]); + } else if (fy) { + while (++i < n) points.push([x, y.call(self, d[i], i)]); + } else { + while (++i < n) points.push([x, y]); + } + return points; +} + +// The default `x` property, which references d[0]. +function d3_svg_lineX(d) { + return d[0]; +} + +// The default `y` property, which references d[1]. +function d3_svg_lineY(d) { + return d[1]; +} + +// The various interpolators supported by the `line` class. +var d3_svg_lineInterpolators = { + "linear": d3_svg_lineLinear, + "step-before": d3_svg_lineStepBefore, + "step-after": d3_svg_lineStepAfter, + "basis": d3_svg_lineBasis, + "basis-open": d3_svg_lineBasisOpen, + "basis-closed": d3_svg_lineBasisClosed, + "bundle": d3_svg_lineBundle, + "cardinal": d3_svg_lineCardinal, + "cardinal-open": d3_svg_lineCardinalOpen, + "cardinal-closed": d3_svg_lineCardinalClosed, + "monotone": d3_svg_lineMonotone +}; + +// Linear interpolation; generates "L" commands. +function d3_svg_lineLinear(points) { + var i = 0, + n = points.length, + p = points[0], + path = [p[0], ",", p[1]]; + while (++i < n) path.push("L", (p = points[i])[0], ",", p[1]); + return path.join(""); +} + +// Step interpolation; generates "H" and "V" commands. +function d3_svg_lineStepBefore(points) { + var i = 0, + n = points.length, + p = points[0], + path = [p[0], ",", p[1]]; + while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); + return path.join(""); +} + +// Step interpolation; generates "H" and "V" commands. +function d3_svg_lineStepAfter(points) { + var i = 0, + n = points.length, + p = points[0], + path = [p[0], ",", p[1]]; + while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); + return path.join(""); +} + +// Open cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinalOpen(points, tension) { + return points.length < 4 + ? d3_svg_lineLinear(points) + : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), + d3_svg_lineCardinalTangents(points, tension)); +} + +// Closed cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinalClosed(points, tension) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + d3_svg_lineHermite((points.push(points[0]), points), + d3_svg_lineCardinalTangents([points[points.length - 2]] + .concat(points, [points[1]]), tension)); +} + +// Cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinal(points, tension, closed) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + d3_svg_lineHermite(points, + d3_svg_lineCardinalTangents(points, tension)); +} + +// Hermite spline construction; generates "C" commands. +function d3_svg_lineHermite(points, tangents) { + if (tangents.length < 1 + || (points.length != tangents.length + && points.length != tangents.length + 2)) { + return d3_svg_lineLinear(points); + } + + var quad = points.length != tangents.length, + path = "", + p0 = points[0], + p = points[1], + t0 = tangents[0], + t = t0, + pi = 1; + + if (quad) { + path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + + "," + p[0] + "," + p[1]; + p0 = points[1]; + pi = 2; + } + + if (tangents.length > 1) { + t = tangents[1]; + p = points[pi]; + pi++; + path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + + "," + p[0] + "," + p[1]; + for (var i = 2; i < tangents.length; i++, pi++) { + p = points[pi]; + t = tangents[i]; + path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + + "," + p[0] + "," + p[1]; + } + } + + if (quad) { + var lp = points[pi]; + path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + + "," + lp[0] + "," + lp[1]; + } + + return path; +} + +// Generates tangents for a cardinal spline. +function d3_svg_lineCardinalTangents(points, tension) { + var tangents = [], + a = (1 - tension) / 2, + p0, + p1 = points[0], + p2 = points[1], + i = 1, + n = points.length; + while (++i < n) { + p0 = p1; + p1 = p2; + p2 = points[i]; + tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]); + } + return tangents; +} + +// B-spline interpolation; generates "C" commands. +function d3_svg_lineBasis(points) { + if (points.length < 3) return d3_svg_lineLinear(points); + var i = 1, + n = points.length, + pi = points[0], + x0 = pi[0], + y0 = pi[1], + px = [x0, x0, x0, (pi = points[1])[0]], + py = [y0, y0, y0, pi[1]], + path = [x0, ",", y0]; + d3_svg_lineBasisBezier(path, px, py); + while (++i < n) { + pi = points[i]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + i = -1; + while (++i < 2) { + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +// Open B-spline interpolation; generates "C" commands. +function d3_svg_lineBasisOpen(points) { + if (points.length < 4) return d3_svg_lineLinear(points); + var path = [], + i = -1, + n = points.length, + pi, + px = [0], + py = [0]; + while (++i < 3) { + pi = points[i]; + px.push(pi[0]); + py.push(pi[1]); + } + path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); + --i; while (++i < n) { + pi = points[i]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +// Closed B-spline interpolation; generates "C" commands. +function d3_svg_lineBasisClosed(points) { + var path, + i = -1, + n = points.length, + m = n + 4, + pi, + px = [], + py = []; + while (++i < 4) { + pi = points[i % n]; + px.push(pi[0]); + py.push(pi[1]); + } + path = [ + d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) + ]; + --i; while (++i < m) { + pi = points[i % n]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +function d3_svg_lineBundle(points, tension) { + var n = points.length - 1, + x0 = points[0][0], + y0 = points[0][1], + dx = points[n][0] - x0, + dy = points[n][1] - y0, + i = -1, + p, + t; + while (++i <= n) { + p = points[i]; + t = i / n; + p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); + p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); + } + return d3_svg_lineBasis(points); +} + +// Returns the dot product of the given four-element vectors. +function d3_svg_lineDot4(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; +} + +// Matrix to transform basis (b-spline) control points to bezier +// control points. Derived from FvD 11.2.8. +var d3_svg_lineBasisBezier1 = [0, 2/3, 1/3, 0], + d3_svg_lineBasisBezier2 = [0, 1/3, 2/3, 0], + d3_svg_lineBasisBezier3 = [0, 1/6, 2/3, 1/6]; + +// Pushes a "C" Bézier curve onto the specified path array, given the +// two specified four-element arrays which define the control points. +function d3_svg_lineBasisBezier(path, x, y) { + path.push( + "C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); +} + +// Computes the slope from points p0 to p1. +function d3_svg_lineSlope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]); +} + +// Compute three-point differences for the given points. +// http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Finite_difference +function d3_svg_lineFiniteDifferences(points) { + var i = 0, + j = points.length - 1, + m = [], + p0 = points[0], + p1 = points[1], + d = m[0] = d3_svg_lineSlope(p0, p1); + while (++i < j) { + m[i] = d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1])); + } + m[i] = d; + return m; +} + +// Interpolates the given points using Fritsch-Carlson Monotone cubic Hermite +// interpolation. Returns an array of tangent vectors. For details, see +// http://en.wikipedia.org/wiki/Monotone_cubic_interpolation +function d3_svg_lineMonotoneTangents(points) { + var tangents = [], + d, + a, + b, + s, + m = d3_svg_lineFiniteDifferences(points), + i = -1, + j = points.length - 1; + + // The first two steps are done by computing finite-differences: + // 1. Compute the slopes of the secant lines between successive points. + // 2. Initialize the tangents at every point as the average of the secants. + + // Then, for each segment… + while (++i < j) { + d = d3_svg_lineSlope(points[i], points[i + 1]); + + // 3. If two successive yk = y{k + 1} are equal (i.e., d is zero), then set + // mk = m{k + 1} = 0 as the spline connecting these points must be flat to + // preserve monotonicity. Ignore step 4 and 5 for those k. + + if (Math.abs(d) < 1e-6) { + m[i] = m[i + 1] = 0; + } else { + // 4. Let ak = mk / dk and bk = m{k + 1} / dk. + a = m[i] / d; + b = m[i + 1] / d; + + // 5. Prevent overshoot and ensure monotonicity by restricting the + // magnitude of vector to a circle of radius 3. + s = a * a + b * b; + if (s > 9) { + s = d * 3 / Math.sqrt(s); + m[i] = s * a; + m[i + 1] = s * b; + } + } + } + + // Compute the normalized tangent vector from the slopes. Note that if x is + // not monotonic, it's possible that the slope will be infinite, so we protect + // against NaN by setting the coordinate to zero. + i = -1; while (++i <= j) { + s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) + / (6 * (1 + m[i] * m[i])); + tangents.push([s || 0, m[i] * s || 0]); + } + + return tangents; +} + +function d3_svg_lineMonotone(points) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); +} +d3.svg.line.radial = function() { + var line = d3_svg_line(d3_svg_lineRadial); + line.radius = line.x, delete line.x; + line.angle = line.y, delete line.y; + return line; +}; + +function d3_svg_lineRadial(points) { + var point, + i = -1, + n = points.length, + r, + a; + while (++i < n) { + point = points[i]; + r = point[0]; + a = point[1] + d3_svg_arcOffset; + point[0] = r * Math.cos(a); + point[1] = r * Math.sin(a); + } + return points; +} +function d3_svg_area(projection) { + var x0 = d3_svg_lineX, + x1 = d3_svg_lineX, + y0 = 0, + y1 = d3_svg_lineY, + interpolate, + i0, + i1, + tension = .7; + + function area(d) { + if (d.length < 1) return null; + var points0 = d3_svg_linePoints(this, d, x0, y0), + points1 = d3_svg_linePoints(this, d, x0 === x1 ? d3_svg_areaX(points0) : x1, y0 === y1 ? d3_svg_areaY(points0) : y1); + return "M" + i0(projection(points1), tension) + + "L" + i1(projection(points0.reverse()), tension) + + "Z"; + } + + area.x = function(x) { + if (!arguments.length) return x1; + x0 = x1 = x; + return area; + }; + + area.x0 = function(x) { + if (!arguments.length) return x0; + x0 = x; + return area; + }; + + area.x1 = function(x) { + if (!arguments.length) return x1; + x1 = x; + return area; + }; + + area.y = function(y) { + if (!arguments.length) return y1; + y0 = y1 = y; + return area; + }; + + area.y0 = function(y) { + if (!arguments.length) return y0; + y0 = y; + return area; + }; + + area.y1 = function(y) { + if (!arguments.length) return y1; + y1 = y; + return area; + }; + + area.interpolate = function(x) { + if (!arguments.length) return interpolate; + i0 = d3_svg_lineInterpolators[interpolate = x]; + i1 = i0.reverse || i0; + return area; + }; + + area.tension = function(x) { + if (!arguments.length) return tension; + tension = x; + return area; + }; + + return area.interpolate("linear"); +} + +d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; +d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; + +d3.svg.area = function() { + return d3_svg_area(Object); +}; + +function d3_svg_areaX(points) { + return function(d, i) { + return points[i][0]; + }; +} + +function d3_svg_areaY(points) { + return function(d, i) { + return points[i][1]; + }; +} +d3.svg.area.radial = function() { + var area = d3_svg_area(d3_svg_lineRadial); + area.radius = area.x, delete area.x; + area.innerRadius = area.x0, delete area.x0; + area.outerRadius = area.x1, delete area.x1; + area.angle = area.y, delete area.y; + area.startAngle = area.y0, delete area.y0; + area.endAngle = area.y1, delete area.y1; + return area; +}; +d3.svg.chord = function() { + var source = d3_svg_chordSource, + target = d3_svg_chordTarget, + radius = d3_svg_chordRadius, + startAngle = d3_svg_arcStartAngle, + endAngle = d3_svg_arcEndAngle; + + // TODO Allow control point to be customized. + + function chord(d, i) { + var s = subgroup(this, source, d, i), + t = subgroup(this, target, d, i); + return "M" + s.p0 + + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) + ? curve(s.r, s.p1, s.r, s.p0) + : curve(s.r, s.p1, t.r, t.p0) + + arc(t.r, t.p1, t.a1 - t.a0) + + curve(t.r, t.p1, s.r, s.p0)) + + "Z"; + } + + function subgroup(self, f, d, i) { + var subgroup = f.call(self, d, i), + r = radius.call(self, subgroup, i), + a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, + a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset; + return { + r: r, + a0: a0, + a1: a1, + p0: [r * Math.cos(a0), r * Math.sin(a0)], + p1: [r * Math.cos(a1), r * Math.sin(a1)] + }; + } + + function equals(a, b) { + return a.a0 == b.a0 && a.a1 == b.a1; + } + + function arc(r, p, a) { + return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p; + } + + function curve(r0, p0, r1, p1) { + return "Q 0,0 " + p1; + } + + chord.radius = function(v) { + if (!arguments.length) return radius; + radius = d3.functor(v); + return chord; + }; + + chord.source = function(v) { + if (!arguments.length) return source; + source = d3.functor(v); + return chord; + }; + + chord.target = function(v) { + if (!arguments.length) return target; + target = d3.functor(v); + return chord; + }; + + chord.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3.functor(v); + return chord; + }; + + chord.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3.functor(v); + return chord; + }; + + return chord; +}; + +function d3_svg_chordSource(d) { + return d.source; +} + +function d3_svg_chordTarget(d) { + return d.target; +} + +function d3_svg_chordRadius(d) { + return d.radius; +} + +function d3_svg_chordStartAngle(d) { + return d.startAngle; +} + +function d3_svg_chordEndAngle(d) { + return d.endAngle; +} +d3.svg.diagonal = function() { + var source = d3_svg_chordSource, + target = d3_svg_chordTarget, + projection = d3_svg_diagonalProjection; + + function diagonal(d, i) { + var p0 = source.call(this, d, i), + p3 = target.call(this, d, i), + m = (p0.y + p3.y) / 2, + p = [p0, {x: p0.x, y: m}, {x: p3.x, y: m}, p3]; + p = p.map(projection); + return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; + } + + diagonal.source = function(x) { + if (!arguments.length) return source; + source = d3.functor(x); + return diagonal; + }; + + diagonal.target = function(x) { + if (!arguments.length) return target; + target = d3.functor(x); + return diagonal; + }; + + diagonal.projection = function(x) { + if (!arguments.length) return projection; + projection = x; + return diagonal; + }; + + return diagonal; +}; + +function d3_svg_diagonalProjection(d) { + return [d.x, d.y]; +} +d3.svg.diagonal.radial = function() { + var diagonal = d3.svg.diagonal(), + projection = d3_svg_diagonalProjection, + projection_ = diagonal.projection; + + diagonal.projection = function(x) { + return arguments.length + ? projection_(d3_svg_diagonalRadialProjection(projection = x)) + : projection; + }; + + return diagonal; +}; + +function d3_svg_diagonalRadialProjection(projection) { + return function() { + var d = projection.apply(this, arguments), + r = d[0], + a = d[1] + d3_svg_arcOffset; + return [r * Math.cos(a), r * Math.sin(a)]; + }; +} +d3.svg.mouse = function(container) { + return d3_svg_mousePoint(container, d3.event); +}; + +// https://bugs.webkit.org/show_bug.cgi?id=44083 +var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0; + +function d3_svg_mousePoint(container, e) { + var point = (container.ownerSVGElement || container).createSVGPoint(); + if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) { + var svg = d3.select(document.body) + .append("svg") + .style("position", "absolute") + .style("top", 0) + .style("left", 0); + var ctm = svg[0][0].getScreenCTM(); + d3_mouse_bug44083 = !(ctm.f || ctm.e); + svg.remove(); + } + if (d3_mouse_bug44083) { + point.x = e.pageX; + point.y = e.pageY; + } else { + point.x = e.clientX; + point.y = e.clientY; + } + point = point.matrixTransform(container.getScreenCTM().inverse()); + return [point.x, point.y]; +}; +d3.svg.touches = function(container, touches) { + if (arguments.length < 2) touches = d3.event.touches; + + return touches ? d3_array(touches).map(function(touch) { + var point = d3_svg_mousePoint(container, touch); + point.identifier = touch.identifier; + return point; + }) : []; +}; +d3.svg.symbol = function() { + var type = d3_svg_symbolType, + size = d3_svg_symbolSize; + + function symbol(d, i) { + return (d3_svg_symbols[type.call(this, d, i)] + || d3_svg_symbols.circle) + (size.call(this, d, i)); + } + + symbol.type = function(x) { + if (!arguments.length) return type; + type = d3.functor(x); + return symbol; + }; + + // size of symbol in square pixels + symbol.size = function(x) { + if (!arguments.length) return size; + size = d3.functor(x); + return symbol; + }; + + return symbol; +}; + +function d3_svg_symbolSize() { + return 64; +} + +function d3_svg_symbolType() { + return "circle"; +} + +// TODO cross-diagonal? +var d3_svg_symbols = { + "circle": function(size) { + var r = Math.sqrt(size / Math.PI); + return "M0," + r + + "A" + r + "," + r + " 0 1,1 0," + (-r) + + "A" + r + "," + r + " 0 1,1 0," + r + + "Z"; + }, + "cross": function(size) { + var r = Math.sqrt(size / 5) / 2; + return "M" + -3 * r + "," + -r + + "H" + -r + + "V" + -3 * r + + "H" + r + + "V" + -r + + "H" + 3 * r + + "V" + r + + "H" + r + + "V" + 3 * r + + "H" + -r + + "V" + r + + "H" + -3 * r + + "Z"; + }, + "diamond": function(size) { + var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), + rx = ry * d3_svg_symbolTan30; + return "M0," + -ry + + "L" + rx + ",0" + + " 0," + ry + + " " + -rx + ",0" + + "Z"; + }, + "square": function(size) { + var r = Math.sqrt(size) / 2; + return "M" + -r + "," + -r + + "L" + r + "," + -r + + " " + r + "," + r + + " " + -r + "," + r + + "Z"; + }, + "triangle-down": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), + ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + ry + + "L" + rx +"," + -ry + + " " + -rx + "," + -ry + + "Z"; + }, + "triangle-up": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), + ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + -ry + + "L" + rx +"," + ry + + " " + -rx + "," + ry + + "Z"; + } +}; + +d3.svg.symbolTypes = d3.keys(d3_svg_symbols); + +var d3_svg_symbolSqrt3 = Math.sqrt(3), + d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180); +d3.svg.axis = function() { + var scale = d3.scale.linear(), + orient = "bottom", + tickMajorSize = 6, + tickMinorSize = 6, + tickEndSize = 6, + tickPadding = 3, + tickArguments_ = [10], + tickFormat_, + tickSubdivide = 0; + + function axis(selection) { + selection.each(function(d, i, j) { + var g = d3.select(this); + + // If selection is a transition, create subtransitions. + var transition = selection.delay ? function(o) { + var id = d3_transitionInheritId; + try { + d3_transitionInheritId = selection.id; + return o.transition() + .delay(selection[j][i].delay) + .duration(selection[j][i].duration) + .ease(selection.ease()); + } finally { + d3_transitionInheritId = id; + } + } : Object; + + // Ticks, or domain values for ordinal scales. + var ticks = scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain(), + tickFormat = tickFormat_ == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String) : tickFormat_; + + // Minor ticks. + var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), + subtick = g.selectAll(".minor").data(subticks, String), + subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), + subtickExit = transition(subtick.exit()).style("opacity", 1e-6).remove(), + subtickUpdate = transition(subtick).style("opacity", 1); + + // Major ticks. + var tick = g.selectAll("g").data(ticks, String), + tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), + tickExit = transition(tick.exit()).style("opacity", 1e-6).remove(), + tickUpdate = transition(tick).style("opacity", 1), + tickTransform; + + // Domain. + var range = d3_scaleRange(scale), + path = g.selectAll(".domain").data([0]), + pathEnter = path.enter().append("path").attr("class", "domain"), + pathUpdate = transition(path); + + // Stash a snapshot of the new scale, and retrieve the old snapshot. + var scale1 = scale.copy(), + scale0 = this.__chart__ || scale1; + this.__chart__ = scale1; + + tickEnter.append("line").attr("class", "tick"); + tickEnter.append("text"); + tickUpdate.select("text").text(tickFormat); + + switch (orient) { + case "bottom": { + tickTransform = d3_svg_axisX; + subtickEnter.attr("y2", tickMinorSize); + subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize); + tickEnter.select("line").attr("y2", tickMajorSize); + tickEnter.select("text").attr("y", Math.max(tickMajorSize, 0) + tickPadding); + tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize); + tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); + break; + } + case "top": { + tickTransform = d3_svg_axisX; + subtickEnter.attr("y2", -tickMinorSize); + subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize); + tickEnter.select("line").attr("y2", -tickMajorSize); + tickEnter.select("text").attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)); + tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize); + tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize); + break; + } + case "left": { + tickTransform = d3_svg_axisY; + subtickEnter.attr("x2", -tickMinorSize); + subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0); + tickEnter.select("line").attr("x2", -tickMajorSize); + tickEnter.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)); + tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0); + tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end"); + pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); + break; + } + case "right": { + tickTransform = d3_svg_axisY; + subtickEnter.attr("x2", tickMinorSize); + subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0); + tickEnter.select("line").attr("x2", tickMajorSize); + tickEnter.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding); + tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0); + tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start"); + pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize); + break; + } + } + + // For quantitative scales: + // - enter new ticks from the old scale + // - exit old ticks to the new scale + if (scale.ticks) { + tickEnter.call(tickTransform, scale0); + tickUpdate.call(tickTransform, scale1); + tickExit.call(tickTransform, scale1); + subtickEnter.call(tickTransform, scale0); + subtickUpdate.call(tickTransform, scale1); + subtickExit.call(tickTransform, scale1); + } + + // For ordinal scales: + // - any entering ticks are undefined in the old scale + // - any exiting ticks are undefined in the new scale + // Therefore, we only need to transition updating ticks. + else { + var dx = scale1.rangeBand() / 2, x = function(d) { return scale1(d) + dx; }; + tickEnter.call(tickTransform, x); + tickUpdate.call(tickTransform, x); + } + }); + } + + axis.scale = function(x) { + if (!arguments.length) return scale; + scale = x; + return axis; + }; + + axis.orient = function(x) { + if (!arguments.length) return orient; + orient = x; + return axis; + }; + + axis.ticks = function() { + if (!arguments.length) return tickArguments_; + tickArguments_ = arguments; + return axis; + }; + + axis.tickFormat = function(x) { + if (!arguments.length) return tickFormat_; + tickFormat_ = x; + return axis; + }; + + axis.tickSize = function(x, y, z) { + if (!arguments.length) return tickMajorSize; + var n = arguments.length - 1; + tickMajorSize = +x; + tickMinorSize = n > 1 ? +y : tickMajorSize; + tickEndSize = n > 0 ? +arguments[n] : tickMajorSize; + return axis; + }; + + axis.tickPadding = function(x) { + if (!arguments.length) return tickPadding; + tickPadding = +x; + return axis; + }; + + axis.tickSubdivide = function(x) { + if (!arguments.length) return tickSubdivide; + tickSubdivide = +x; + return axis; + }; + + return axis; +}; + +function d3_svg_axisX(selection, x) { + selection.attr("transform", function(d) { return "translate(" + x(d) + ",0)"; }); +} + +function d3_svg_axisY(selection, y) { + selection.attr("transform", function(d) { return "translate(0," + y(d) + ")"; }); +} + +function d3_svg_axisSubdivide(scale, ticks, m) { + subticks = []; + if (m && ticks.length > 1) { + var extent = d3_scaleExtent(scale.domain()), + subticks, + i = -1, + n = ticks.length, + d = (ticks[1] - ticks[0]) / ++m, + j, + v; + while (++i < n) { + for (j = m; --j > 0;) { + if ((v = +ticks[i] - j * d) >= extent[0]) { + subticks.push(v); + } + } + } + for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1];) { + subticks.push(v); + } + } + return subticks; +} +d3.svg.brush = function() { + var event = d3.dispatch("brushstart", "brush", "brushend"), + x, // x-scale, optional + y, // y-scale, optional + extent = [[0, 0], [0, 0]]; // [x0, y0], [x1, y1] + + function brush(g) { + var resizes = x && y ? ["n", "e", "s", "w", "nw", "ne", "se", "sw"] + : x ? ["e", "w"] + : y ? ["n", "s"] + : []; + + g.each(function() { + var g = d3.select(this).on("mousedown.brush", down), + bg = g.selectAll(".background").data([0]), + fg = g.selectAll(".extent").data([0]), + tz = g.selectAll(".resize").data(resizes, String), + e; + + // An invisible, mouseable area for starting a new brush. + bg.enter().append("rect") + .attr("class", "background") + .style("visibility", "hidden") + .style("pointer-events", "all") + .style("cursor", "crosshair"); + + // The visible brush extent; style this as you like! + fg.enter().append("rect") + .attr("class", "extent") + .style("cursor", "move"); + + // More invisible rects for resizing the extent. + tz.enter().append("rect") + .attr("class", function(d) { return "resize " + d; }) + .attr("width", 6) + .attr("height", 6) + .style("visibility", "hidden") + .style("cursor", function(d) { return d3_svg_brushCursor[d]; }); + + // Update the resizers. + tz.style("pointer-events", brush.empty() ? "none" : "all"); + + // Remove any superfluous resizers. + tz.exit().remove(); + + // Initialize the background to fill the defined range. + // If the range isn't defined, you can post-process. + if (x) { + e = d3_scaleRange(x); + bg.attr("x", e[0]).attr("width", e[1] - e[0]); + d3_svg_brushRedrawX(g, extent); + } + if (y) { + e = d3_scaleRange(y); + bg.attr("y", e[0]).attr("height", e[1] - e[0]); + d3_svg_brushRedrawY(g, extent); + } + }); + } + + function down() { + var target = d3.select(d3.event.target); + + // Store some global state for the duration of the brush gesture. + d3_svg_brush = brush; + d3_svg_brushTarget = this; + d3_svg_brushExtent = extent; + d3_svg_brushOffset = d3.svg.mouse(d3_svg_brushTarget); + + // If the extent was clicked on, drag rather than brush; + // store the offset between the mouse and extent origin instead. + if (d3_svg_brushDrag = target.classed("extent")) { + d3_svg_brushOffset[0] = extent[0][0] - d3_svg_brushOffset[0]; + d3_svg_brushOffset[1] = extent[0][1] - d3_svg_brushOffset[1]; + } + + // If a resizer was clicked on, record which side is to be resized. + // Also, set the offset to the opposite side. + else if (target.classed("resize")) { + d3_svg_brushResize = d3.event.target.__data__; + d3_svg_brushOffset[0] = extent[+/w$/.test(d3_svg_brushResize)][0]; + d3_svg_brushOffset[1] = extent[+/^n/.test(d3_svg_brushResize)][1]; + } + + // If the ALT key is down when starting a brush, the center is at the mouse. + else if (d3.event.altKey) { + d3_svg_brushCenter = d3_svg_brushOffset.slice(); + } + + // Restrict which dimensions are resized. + d3_svg_brushX = !/^(n|s)$/.test(d3_svg_brushResize) && x; + d3_svg_brushY = !/^(e|w)$/.test(d3_svg_brushResize) && y; + + // Notify listeners. + d3_svg_brushDispatch = dispatcher(this, arguments); + d3_svg_brushDispatch("brushstart"); + d3_svg_brushMove(); + d3_eventCancel(); + } + + function dispatcher(that, argumentz) { + return function(type) { + var e = d3.event; + try { + d3.event = {type: type, target: brush}; + event[type].apply(that, argumentz); + } finally { + d3.event = e; + } + }; + } + + brush.x = function(z) { + if (!arguments.length) return x; + x = z; + return brush; + }; + + brush.y = function(z) { + if (!arguments.length) return y; + y = z; + return brush; + }; + + brush.extent = function(z) { + var x0, x1, y0, y1, t; + + // Invert the pixel extent to data-space. + if (!arguments.length) { + if (x) { + x0 = extent[0][0], x1 = extent[1][0]; + if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + } + if (y) { + y0 = extent[0][1], y1 = extent[1][1]; + if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + } + return x && y ? [[x0, y0], [x1, y1]] : x ? [x0, x1] : y && [y0, y1]; + } + + // Scale the data-space extent to pixels. + if (x) { + x0 = z[0], x1 = z[1]; + if (y) x0 = x0[0], x1 = x1[0]; + if (x.invert) x0 = x(x0), x1 = x(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + extent[0][0] = x0, extent[1][0] = x1; + } + if (y) { + y0 = z[0], y1 = z[1]; + if (x) y0 = y0[1], y1 = y1[1]; + if (y.invert) y0 = y(y0), y1 = y(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + extent[0][1] = y0, extent[1][1] = y1; + } + + return brush; + }; + + brush.clear = function() { + extent[0][0] = + extent[0][1] = + extent[1][0] = + extent[1][1] = 0; + return brush; + }; + + brush.empty = function() { + return (x && extent[0][0] === extent[1][0]) + || (y && extent[0][1] === extent[1][1]); + }; + + d3.select(window) + .on("mousemove.brush", d3_svg_brushMove) + .on("mouseup.brush", d3_svg_brushUp) + .on("keydown.brush", d3_svg_brushKeydown) + .on("keyup.brush", d3_svg_brushKeyup); + + return d3.rebind(brush, event, "on"); +}; + +var d3_svg_brush, + d3_svg_brushDispatch, + d3_svg_brushTarget, + d3_svg_brushX, + d3_svg_brushY, + d3_svg_brushExtent, + d3_svg_brushDrag, + d3_svg_brushResize, + d3_svg_brushCenter, + d3_svg_brushOffset; + +function d3_svg_brushRedrawX(g, extent) { + g.select(".extent").attr("x", extent[0][0]); + g.selectAll(".n,.s,.w,.nw,.sw").attr("x", extent[0][0] - 2); + g.selectAll(".e,.ne,.se").attr("x", extent[1][0] - 3); + g.selectAll(".extent,.n,.s").attr("width", extent[1][0] - extent[0][0]); +} + +function d3_svg_brushRedrawY(g, extent) { + g.select(".extent").attr("y", extent[0][1]); + g.selectAll(".n,.e,.w,.nw,.ne").attr("y", extent[0][1] - 3); + g.selectAll(".s,.se,.sw").attr("y", extent[1][1] - 4); + g.selectAll(".extent,.e,.w").attr("height", extent[1][1] - extent[0][1]); +} + +function d3_svg_brushKeydown() { + if (d3.event.keyCode == 32 && d3_svg_brushTarget && !d3_svg_brushDrag) { + d3_svg_brushCenter = null; + d3_svg_brushOffset[0] -= d3_svg_brushExtent[1][0]; + d3_svg_brushOffset[1] -= d3_svg_brushExtent[1][1]; + d3_svg_brushDrag = 2; + d3_eventCancel(); + } +} + +function d3_svg_brushKeyup() { + if (d3.event.keyCode == 32 && d3_svg_brushDrag == 2) { + d3_svg_brushOffset[0] += d3_svg_brushExtent[1][0]; + d3_svg_brushOffset[1] += d3_svg_brushExtent[1][1]; + d3_svg_brushDrag = 0; + d3_eventCancel(); + } +} + +function d3_svg_brushMove() { + if (d3_svg_brushOffset) { + var mouse = d3.svg.mouse(d3_svg_brushTarget), + g = d3.select(d3_svg_brushTarget); + + if (!d3_svg_brushDrag) { + + // If needed, determine the center from the current extent. + if (d3.event.altKey) { + if (!d3_svg_brushCenter) { + d3_svg_brushCenter = [ + (d3_svg_brushExtent[0][0] + d3_svg_brushExtent[1][0]) / 2, + (d3_svg_brushExtent[0][1] + d3_svg_brushExtent[1][1]) / 2 + ]; + } + + // Update the offset, for when the ALT key is released. + d3_svg_brushOffset[0] = d3_svg_brushExtent[+(mouse[0] < d3_svg_brushCenter[0])][0]; + d3_svg_brushOffset[1] = d3_svg_brushExtent[+(mouse[1] < d3_svg_brushCenter[1])][1]; + } + + // When the ALT key is released, we clear the center. + else d3_svg_brushCenter = null; + } + + // Update the brush extent for each dimension. + if (d3_svg_brushX) { + d3_svg_brushMove1(mouse, d3_svg_brushX, 0); + d3_svg_brushRedrawX(g, d3_svg_brushExtent); + } + if (d3_svg_brushY) { + d3_svg_brushMove1(mouse, d3_svg_brushY, 1); + d3_svg_brushRedrawY(g, d3_svg_brushExtent); + } + + // Notify listeners. + d3_svg_brushDispatch("brush"); + } +} + +function d3_svg_brushMove1(mouse, scale, i) { + var range = d3_scaleRange(scale), + r0 = range[0], + r1 = range[1], + offset = d3_svg_brushOffset[i], + size = d3_svg_brushExtent[1][i] - d3_svg_brushExtent[0][i], + min, + max; + + // When dragging, reduce the range by the extent size and offset. + if (d3_svg_brushDrag) { + r0 -= offset; + r1 -= size + offset; + } + + // Clamp the mouse so that the extent fits within the range extent. + min = Math.max(r0, Math.min(r1, mouse[i])); + + // Compute the new extent bounds. + if (d3_svg_brushDrag) { + max = (min += offset) + size; + } else { + + // If the ALT key is pressed, then preserve the center of the extent. + if (d3_svg_brushCenter) offset = Math.max(r0, Math.min(r1, 2 * d3_svg_brushCenter[i] - min)); + + // Compute the min and max of the offset and mouse. + if (offset < min) { + max = min; + min = offset; + } else { + max = offset; + } + } + + // Update the stored bounds. + d3_svg_brushExtent[0][i] = min; + d3_svg_brushExtent[1][i] = max; +} + +function d3_svg_brushUp() { + if (d3_svg_brushOffset) { + d3_svg_brushMove(); + d3.select(d3_svg_brushTarget).selectAll(".resize").style("pointer-events", d3_svg_brush.empty() ? "none" : "all"); + d3_svg_brushDispatch("brushend"); + d3_svg_brush = + d3_svg_brushDispatch = + d3_svg_brushTarget = + d3_svg_brushX = + d3_svg_brushY = + d3_svg_brushExtent = + d3_svg_brushDrag = + d3_svg_brushResize = + d3_svg_brushCenter = + d3_svg_brushOffset = null; + d3_eventCancel(); + } +} + +var d3_svg_brushCursor = { + n: "ns-resize", + e: "ew-resize", + s: "ns-resize", + w: "ew-resize", + nw: "nwse-resize", + ne: "nesw-resize", + se: "nwse-resize", + sw: "nesw-resize" +}; +d3.behavior = {}; +// TODO Track touch points by identifier. + +d3.behavior.drag = function() { + var event = d3.dispatch("drag", "dragstart", "dragend"), + origin = null; + + function drag() { + this + .on("mousedown.drag", mousedown) + .on("touchstart.drag", mousedown); + + d3.select(window) + .on("mousemove.drag", d3_behavior_dragMove) + .on("touchmove.drag", d3_behavior_dragMove) + .on("mouseup.drag", d3_behavior_dragUp, true) + .on("touchend.drag", d3_behavior_dragUp, true) + .on("click.drag", d3_behavior_dragClick, true); + } + + // snapshot the local context for subsequent dispatch + function start() { + d3_behavior_dragEvent = event; + d3_behavior_dragEventTarget = d3.event.target; + d3_behavior_dragTarget = this; + d3_behavior_dragArguments = arguments; + d3_behavior_dragOrigin = d3_behavior_dragPoint(); + if (origin) { + d3_behavior_dragOffset = origin.apply(d3_behavior_dragTarget, d3_behavior_dragArguments); + d3_behavior_dragOffset = [d3_behavior_dragOffset.x - d3_behavior_dragOrigin[0], d3_behavior_dragOffset.y - d3_behavior_dragOrigin[1]]; + } else { + d3_behavior_dragOffset = [0, 0]; + } + d3_behavior_dragMoved = 0; + } + + function mousedown() { + start.apply(this, arguments); + d3_behavior_dragDispatch("dragstart"); + } + + drag.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return drag; + }; + + return d3.rebind(drag, event, "on"); +}; + +var d3_behavior_dragEvent, + d3_behavior_dragEventTarget, + d3_behavior_dragTarget, + d3_behavior_dragArguments, + d3_behavior_dragOffset, + d3_behavior_dragOrigin, + d3_behavior_dragMoved; + +function d3_behavior_dragDispatch(type) { + var p = d3_behavior_dragPoint(), + o = d3.event, + e = d3.event = {type: type}; + + if (p) { + e.x = p[0] + d3_behavior_dragOffset[0]; + e.y = p[1] + d3_behavior_dragOffset[1]; + e.dx = p[0] - d3_behavior_dragOrigin[0]; + e.dy = p[1] - d3_behavior_dragOrigin[1]; + d3_behavior_dragMoved |= e.dx | e.dy; + d3_behavior_dragOrigin = p; + } + + try { + d3_behavior_dragEvent[type].apply(d3_behavior_dragTarget, d3_behavior_dragArguments); + } finally { + d3.event = o; + } + + o.stopPropagation(); + o.preventDefault(); +} + +function d3_behavior_dragPoint() { + var p = d3_behavior_dragTarget.parentNode, + t = d3.event.changedTouches; + return p && (t + ? d3.svg.touches(p, t)[0] + : d3.svg.mouse(p)); +} + +function d3_behavior_dragMove() { + if (!d3_behavior_dragTarget) return; + var parent = d3_behavior_dragTarget.parentNode; + + // O NOES! The drag element was removed from the DOM. + if (!parent) return d3_behavior_dragUp(); + + d3_behavior_dragDispatch("drag"); + d3_eventCancel(); +} + +function d3_behavior_dragUp() { + if (!d3_behavior_dragTarget) return; + d3_behavior_dragDispatch("dragend"); + + // If the node was moved, prevent the mouseup from propagating. + // Also prevent the subsequent click from propagating (e.g., for anchors). + if (d3_behavior_dragMoved) { + d3_eventCancel(); + d3_behavior_dragMoved = d3.event.target === d3_behavior_dragEventTarget; + } + + d3_behavior_dragEvent = + d3_behavior_dragEventTarget = + d3_behavior_dragTarget = + d3_behavior_dragArguments = + d3_behavior_dragOffset = + d3_behavior_dragOrigin = null; +} + +function d3_behavior_dragClick() { + if (d3_behavior_dragMoved) { + d3_eventCancel(); + d3_behavior_dragMoved = 0; + } +} +// TODO unbind zoom behavior? +d3.behavior.zoom = function() { + var xyz = [0, 0, 0], + event = d3.dispatch("zoom"), + extent = d3_behavior_zoomInfiniteExtent; + + function zoom() { + this + .on("mousedown.zoom", mousedown) + .on("mousewheel.zoom", mousewheel) + .on("DOMMouseScroll.zoom", mousewheel) + .on("dblclick.zoom", dblclick) + .on("touchstart.zoom", touchstart); + + d3.select(window) + .on("mousemove.zoom", d3_behavior_zoomMousemove) + .on("mouseup.zoom", d3_behavior_zoomMouseup) + .on("touchmove.zoom", d3_behavior_zoomTouchmove) + .on("touchend.zoom", d3_behavior_zoomTouchup) + .on("click.zoom", d3_behavior_zoomClick, true); + } + + // snapshot the local context for subsequent dispatch + function start() { + d3_behavior_zoomXyz = xyz; + d3_behavior_zoomExtent = extent; + d3_behavior_zoomDispatch = event.zoom; + d3_behavior_zoomEventTarget = d3.event.target; + d3_behavior_zoomTarget = this; + d3_behavior_zoomArguments = arguments; + } + + function mousedown() { + start.apply(this, arguments); + d3_behavior_zoomPanning = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget)); + d3_behavior_zoomMoved = 0; + d3.event.preventDefault(); + window.focus(); + } + + // store starting mouse location + function mousewheel() { + start.apply(this, arguments); + if (!d3_behavior_zoomZooming) d3_behavior_zoomZooming = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget)); + d3_behavior_zoomTo(d3_behavior_zoomDelta() + xyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomZooming); + } + + function dblclick() { + start.apply(this, arguments); + var mouse = d3.svg.mouse(d3_behavior_zoomTarget); + d3_behavior_zoomTo(d3.event.shiftKey ? Math.ceil(xyz[2] - 1) : Math.floor(xyz[2] + 1), mouse, d3_behavior_zoomLocation(mouse)); + } + + // doubletap detection + function touchstart() { + start.apply(this, arguments); + var touches = d3_behavior_zoomTouchup(), + touch, + now = Date.now(); + if ((touches.length === 1) && (now - d3_behavior_zoomLast < 300)) { + d3_behavior_zoomTo(1 + Math.floor(xyz[2]), touch = touches[0], d3_behavior_zoomLocations[touch.identifier]); + } + d3_behavior_zoomLast = now; + } + + zoom.extent = function(x) { + if (!arguments.length) return extent; + extent = x == null ? d3_behavior_zoomInfiniteExtent : x; + return zoom; + }; + + return d3.rebind(zoom, event, "on"); +}; + +var d3_behavior_zoomDiv, + d3_behavior_zoomPanning, + d3_behavior_zoomZooming, + d3_behavior_zoomLocations = {}, // identifier -> location + d3_behavior_zoomLast = 0, + d3_behavior_zoomXyz, + d3_behavior_zoomExtent, + d3_behavior_zoomDispatch, + d3_behavior_zoomEventTarget, + d3_behavior_zoomTarget, + d3_behavior_zoomArguments, + d3_behavior_zoomMoved; + +function d3_behavior_zoomLocation(point) { + return [ + point[0] - d3_behavior_zoomXyz[0], + point[1] - d3_behavior_zoomXyz[1], + d3_behavior_zoomXyz[2] + ]; +} + +// detect the pixels that would be scrolled by this wheel event +function d3_behavior_zoomDelta() { + + // mousewheel events are totally broken! + // https://bugs.webkit.org/show_bug.cgi?id=40441 + // not only that, but Chrome and Safari differ in re. to acceleration! + if (!d3_behavior_zoomDiv) { + d3_behavior_zoomDiv = d3.select("body").append("div") + .style("visibility", "hidden") + .style("top", 0) + .style("height", 0) + .style("width", 0) + .style("overflow-y", "scroll") + .append("div") + .style("height", "2000px") + .node().parentNode; + } + + var e = d3.event, delta; + try { + d3_behavior_zoomDiv.scrollTop = 1000; + d3_behavior_zoomDiv.dispatchEvent(e); + delta = 1000 - d3_behavior_zoomDiv.scrollTop; + } catch (error) { + delta = e.wheelDelta || (-e.detail * 5); + } + + return delta * .005; +} + +// Note: Since we don't rotate, it's possible for the touches to become +// slightly detached from their original positions. Thus, we recompute the +// touch points on touchend as well as touchstart! +function d3_behavior_zoomTouchup() { + var touches = d3.svg.touches(d3_behavior_zoomTarget), + i = -1, + n = touches.length, + touch; + while (++i < n) d3_behavior_zoomLocations[(touch = touches[i]).identifier] = d3_behavior_zoomLocation(touch); + return touches; +} + +function d3_behavior_zoomTouchmove() { + var touches = d3.svg.touches(d3_behavior_zoomTarget); + switch (touches.length) { + + // single-touch pan + case 1: { + var touch = touches[0]; + d3_behavior_zoomTo(d3_behavior_zoomXyz[2], touch, d3_behavior_zoomLocations[touch.identifier]); + break; + } + + // double-touch pan + zoom + case 2: { + var p0 = touches[0], + p1 = touches[1], + p2 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2], + l0 = d3_behavior_zoomLocations[p0.identifier], + l1 = d3_behavior_zoomLocations[p1.identifier], + l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2, l0[2]]; + d3_behavior_zoomTo(Math.log(d3.event.scale) / Math.LN2 + l0[2], p2, l2); + break; + } + } +} + +function d3_behavior_zoomMousemove() { + d3_behavior_zoomZooming = null; + if (d3_behavior_zoomPanning) { + d3_behavior_zoomMoved = 1; + d3_behavior_zoomTo(d3_behavior_zoomXyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomPanning); + } +} + +function d3_behavior_zoomMouseup() { + if (d3_behavior_zoomPanning) { + if (d3_behavior_zoomMoved) { + d3_eventCancel(); + d3_behavior_zoomMoved = d3_behavior_zoomEventTarget === d3.event.target; + } + + d3_behavior_zoomXyz = + d3_behavior_zoomExtent = + d3_behavior_zoomDispatch = + d3_behavior_zoomEventTarget = + d3_behavior_zoomTarget = + d3_behavior_zoomArguments = + d3_behavior_zoomPanning = null; + } +} + +function d3_behavior_zoomClick() { + if (d3_behavior_zoomMoved) { + d3_eventCancel(); + d3_behavior_zoomMoved = 0; + } +} + +function d3_behavior_zoomTo(z, x0, x1) { + z = d3_behavior_zoomExtentClamp(z, 2); + var j = Math.pow(2, d3_behavior_zoomXyz[2]), + k = Math.pow(2, z), + K = Math.pow(2, (d3_behavior_zoomXyz[2] = z) - x1[2]), + x_ = d3_behavior_zoomXyz[0], + y_ = d3_behavior_zoomXyz[1], + x = d3_behavior_zoomXyz[0] = d3_behavior_zoomExtentClamp((x0[0] - x1[0] * K), 0, k), + y = d3_behavior_zoomXyz[1] = d3_behavior_zoomExtentClamp((x0[1] - x1[1] * K), 1, k), + o = d3.event; // Events can be reentrant (e.g., focus). + + d3.event = { + scale: k, + translate: [x, y], + transform: function(sx, sy) { + if (sx) transform(sx, x_, x); + if (sy) transform(sy, y_, y); + } + }; + + function transform(scale, a, b) { + scale.dom