d3js-plugins-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +28 -0
- data/Rakefile +1 -0
- data/d3js-plugins-rails.gemspec +21 -0
- data/lib/d3js-plugins-rails/version.rb +7 -0
- data/lib/d3js-plugins-rails.rb +10 -0
- data/vendor/assets/javascripts/d3/plugins/.gitignore +1 -0
- data/vendor/assets/javascripts/d3/plugins/LICENSE +26 -0
- data/vendor/assets/javascripts/d3/plugins/Makefile +87 -0
- data/vendor/assets/javascripts/d3/plugins/README.md +19 -0
- data/vendor/assets/javascripts/d3/plugins/box/box.js +301 -0
- data/vendor/assets/javascripts/d3/plugins/bullet/README.md +14 -0
- data/vendor/assets/javascripts/d3/plugins/bullet/bullet.js +241 -0
- data/vendor/assets/javascripts/d3/plugins/chernoff/README.md +15 -0
- data/vendor/assets/javascripts/d3/plugins/chernoff/chernoff.js +176 -0
- data/vendor/assets/javascripts/d3/plugins/cie/README.md +54 -0
- data/vendor/assets/javascripts/d3/plugins/cie/cie.js +155 -0
- data/vendor/assets/javascripts/d3/plugins/fisheye/README.md +43 -0
- data/vendor/assets/javascripts/d3/plugins/fisheye/fisheye.js +85 -0
- data/vendor/assets/javascripts/d3/plugins/force_labels/README.md +29 -0
- data/vendor/assets/javascripts/d3/plugins/force_labels/force_labels.js +56 -0
- data/vendor/assets/javascripts/d3/plugins/geo/polyhedron/README.md +7 -0
- data/vendor/assets/javascripts/d3/plugins/geo/polyhedron/polyhedron.js +436 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/README.md +107 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/aitoff.js +40 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/armadillo.js +79 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/august.js +15 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/baker.js +28 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/berghaus.js +60 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/boggs.js +27 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/bonne.js +29 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/bromley.js +5 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/collignon.js +17 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/conic-conformal.js +29 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/conic-equidistant.js +27 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/craig.js +24 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/craster.js +18 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/cylindrical-equal-area.js +23 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert1.js +18 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert2.js +17 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert3.js +17 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert4.js +24 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert5.js +17 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert6.js +22 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eisenlohr.js +16 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/end.js +1 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/gringorten.js +111 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/guyou.js +46 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/hammer-retroazimuthal.js +75 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/hammer.js +51 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/hatano.js +25 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/healpix.js +64 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/hill.js +64 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/homolosine.js +17 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/interrupt.js +111 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/kavrayskiy7.js +15 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/lagrange.js +27 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/larrivee.js +39 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/laskowski.js +31 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/littrow.js +21 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/loximuthal.js +29 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/miller.js +15 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/mollweide.js +35 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/mt-flat-polar-parabolic.js +21 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/mt-flat-polar-quartic.js +23 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/mt-flat-polar-sinusoidal.js +25 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/natural-earth.js +22 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/nell-hammer.js +20 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/parallel1.js +12 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/parallel2.js +13 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/peirce-quincuncial.js +14 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/polyconic.js +25 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/projection.js +29 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/robinson.js +83 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/satellite.js +68 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/sinu-mollweide.js +19 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/sinusoidal.js +15 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/start.js +1 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/aitoff-test.js +26 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/armadillo-test.js +28 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/baker-test.js +26 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/boggs-test.js +26 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/bonne-test.js +45 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/craig-test.js +25 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/craster-test.js +25 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/env.js +32 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/equirectangular-test.js +97 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/hammer-test.js +29 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/hatano-test.js +25 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/hill-test.js +26 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/larrivee-test.js +25 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/laskowski-test.js +26 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/littrow-test.js +24 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/loximuthal-test.js +25 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/mollweide-test.js +26 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/mt-flat-polar-parabolic-test.js +25 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/mt-flat-polar-quartic-test.js +25 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/mt-flat-polar-sinusoidal-test.js +25 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/natural-earth-test.js +26 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/quartic-authalic-test.js +0 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/robinson-test.js +26 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/wagner6-test.js +25 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/winkel3-test.js +26 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/van-der-grinten.js +41 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/van-der-grinten4.js +22 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/wagner4.js +9 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/wagner6.js +15 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/wagner7.js +22 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/wiechel.js +14 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/winkel3.js +40 -0
- data/vendor/assets/javascripts/d3/plugins/geo/tile/README.md +6 -0
- data/vendor/assets/javascripts/d3/plugins/geo/tile/tile.js +53 -0
- data/vendor/assets/javascripts/d3/plugins/geodesic/README.md +3 -0
- data/vendor/assets/javascripts/d3/plugins/geodesic/geodesic.js +130 -0
- data/vendor/assets/javascripts/d3/plugins/geom/contour/README.md +5 -0
- data/vendor/assets/javascripts/d3/plugins/geom/contour/contour.js +72 -0
- data/vendor/assets/javascripts/d3/plugins/graph/README.md +148 -0
- data/vendor/assets/javascripts/d3/plugins/graph/data/cities-matrix.json +37 -0
- data/vendor/assets/javascripts/d3/plugins/graph/data/cities.csv +36 -0
- data/vendor/assets/javascripts/d3/plugins/graph/data/miserables.json +338 -0
- data/vendor/assets/javascripts/d3/plugins/graph/graph.js +161 -0
- data/vendor/assets/javascripts/d3/plugins/graph/index.html +37 -0
- data/vendor/assets/javascripts/d3/plugins/hexbin/README.md +58 -0
- data/vendor/assets/javascripts/d3/plugins/hexbin/hexbin.js +96 -0
- data/vendor/assets/javascripts/d3/plugins/hive/README.md +5 -0
- data/vendor/assets/javascripts/d3/plugins/hive/hive.js +80 -0
- data/vendor/assets/javascripts/d3/plugins/horizon/README.md +11 -0
- data/vendor/assets/javascripts/d3/plugins/horizon/horizon.js +192 -0
- data/vendor/assets/javascripts/d3/plugins/interpolate-zoom/README.md +11 -0
- data/vendor/assets/javascripts/d3/plugins/interpolate-zoom/interpolate-zoom.js +75 -0
- data/vendor/assets/javascripts/d3/plugins/jsonp/README.md +26 -0
- data/vendor/assets/javascripts/d3/plugins/jsonp/jsonp.js +25 -0
- data/vendor/assets/javascripts/d3/plugins/keybinding/README.md +17 -0
- data/vendor/assets/javascripts/d3/plugins/keybinding/keybinding.js +120 -0
- data/vendor/assets/javascripts/d3/plugins/longscroll/README.md +10 -0
- data/vendor/assets/javascripts/d3/plugins/longscroll/longscroll.js +75 -0
- data/vendor/assets/javascripts/d3/plugins/package.json +20 -0
- data/vendor/assets/javascripts/d3/plugins/qq/README.md +3 -0
- data/vendor/assets/javascripts/d3/plugins/qq/qq.js +249 -0
- data/vendor/assets/javascripts/d3/plugins/rollup/README.md +5 -0
- data/vendor/assets/javascripts/d3/plugins/rollup/rollup.js +131 -0
- data/vendor/assets/javascripts/d3/plugins/sankey/README.md +17 -0
- data/vendor/assets/javascripts/d3/plugins/sankey/sankey.js +292 -0
- data/vendor/assets/javascripts/d3/plugins/simplify/README.md +6 -0
- data/vendor/assets/javascripts/d3/plugins/simplify/simplify-test.js +193 -0
- data/vendor/assets/javascripts/d3/plugins/simplify/simplify.js +446 -0
- data/vendor/assets/javascripts/d3/plugins/superformula/superformula.js +98 -0
- data/vendor/assets/javascripts/d3/plugins/urlencode/urlencode-test.js +68 -0
- data/vendor/assets/javascripts/d3/plugins/urlencode/urlencode.js +37 -0
- metadata +218 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Vlad Gorodetsky
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# d3js-plugins-rails
|
2
|
+
|
3
|
+
Each plugin should live in a directory that matches its name.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add the following to your gemfile:
|
8
|
+
|
9
|
+
gem 'd3js-plugins-rails'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Add the *needed* directives to your JavaScript manifest file (application.js):
|
16
|
+
|
17
|
+
//= require d3/plugins/geo/projection/projection
|
18
|
+
//= require d3/plugins/geo/projection/kavrayskiy7
|
19
|
+
|
20
|
+
It's unlikely you will need to include all plugins globally.
|
21
|
+
|
22
|
+
## Contributing
|
23
|
+
|
24
|
+
1. Fork it
|
25
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
26
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
27
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
28
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'd3js-plugins-rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "d3js-plugins-rails"
|
8
|
+
gem.version = D3js::Plugins::Rails::VERSION
|
9
|
+
gem.authors = ["Vlad Gorodetsky"]
|
10
|
+
gem.email = ["v@gor.io"]
|
11
|
+
gem.description = %q{Shared plugins for d3js library.}
|
12
|
+
gem.summary = %q{Gemified d3js-plugins asset for Rails}
|
13
|
+
gem.homepage = "http://github.com/bai/d3js-plugins-rails"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency "railties", ">= 3.0", "< 5.0"
|
21
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
d3.*.js
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Copyright (c) 2012, Michael Bostock
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
12
|
+
and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
* The name Michael Bostock may not be used to endorse or promote products
|
15
|
+
derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
18
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
19
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
20
|
+
DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
|
21
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
22
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
24
|
+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
26
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,87 @@
|
|
1
|
+
NODE_PATH ?= ./node_modules
|
2
|
+
JS_UGLIFY = uglifyjs
|
3
|
+
JS_TESTER = $(NODE_PATH)/vows/bin/vows
|
4
|
+
|
5
|
+
all: \
|
6
|
+
d3.geo.projection.js \
|
7
|
+
d3.geo.projection.min.js
|
8
|
+
|
9
|
+
d3.geo.projection.js: \
|
10
|
+
geo/projection/start.js \
|
11
|
+
geo/projection/projection.js \
|
12
|
+
geo/projection/parallel1.js \
|
13
|
+
geo/projection/parallel2.js \
|
14
|
+
geo/projection/interrupt.js \
|
15
|
+
geo/projection/aitoff.js \
|
16
|
+
geo/projection/guyou.js \
|
17
|
+
geo/projection/mollweide.js \
|
18
|
+
geo/projection/sinusoidal.js \
|
19
|
+
geo/projection/sinu-mollweide.js \
|
20
|
+
geo/projection/armadillo.js \
|
21
|
+
geo/projection/august.js \
|
22
|
+
geo/projection/baker.js \
|
23
|
+
geo/projection/berghaus.js \
|
24
|
+
geo/projection/boggs.js \
|
25
|
+
geo/projection/bonne.js \
|
26
|
+
geo/projection/bromley.js \
|
27
|
+
geo/projection/collignon.js \
|
28
|
+
geo/projection/conic-conformal.js \
|
29
|
+
geo/projection/conic-equidistant.js \
|
30
|
+
geo/projection/craig.js \
|
31
|
+
geo/projection/craster.js \
|
32
|
+
geo/projection/cylindrical-equal-area.js \
|
33
|
+
geo/projection/eckert1.js \
|
34
|
+
geo/projection/eckert2.js \
|
35
|
+
geo/projection/eckert3.js \
|
36
|
+
geo/projection/eckert4.js \
|
37
|
+
geo/projection/eckert5.js \
|
38
|
+
geo/projection/eckert6.js \
|
39
|
+
geo/projection/eisenlohr.js \
|
40
|
+
geo/projection/gringorten.js \
|
41
|
+
geo/projection/hammer-retroazimuthal.js \
|
42
|
+
geo/projection/hammer.js \
|
43
|
+
geo/projection/hatano.js \
|
44
|
+
geo/projection/healpix.js \
|
45
|
+
geo/projection/hill.js \
|
46
|
+
geo/projection/homolosine.js \
|
47
|
+
geo/projection/kavrayskiy7.js \
|
48
|
+
geo/projection/lagrange.js \
|
49
|
+
geo/projection/larrivee.js \
|
50
|
+
geo/projection/laskowski.js \
|
51
|
+
geo/projection/littrow.js \
|
52
|
+
geo/projection/loximuthal.js \
|
53
|
+
geo/projection/miller.js \
|
54
|
+
geo/projection/mt-flat-polar-parabolic.js \
|
55
|
+
geo/projection/mt-flat-polar-quartic.js \
|
56
|
+
geo/projection/mt-flat-polar-sinusoidal.js \
|
57
|
+
geo/projection/natural-earth.js \
|
58
|
+
geo/projection/nell-hammer.js \
|
59
|
+
geo/projection/peirce-quincuncial.js \
|
60
|
+
geo/projection/polyconic.js \
|
61
|
+
geo/projection/robinson.js \
|
62
|
+
geo/projection/satellite.js \
|
63
|
+
geo/projection/van-der-grinten.js \
|
64
|
+
geo/projection/van-der-grinten4.js \
|
65
|
+
geo/projection/wagner4.js \
|
66
|
+
geo/projection/wagner6.js \
|
67
|
+
geo/projection/wagner7.js \
|
68
|
+
geo/projection/wiechel.js \
|
69
|
+
geo/projection/winkel3.js \
|
70
|
+
geo/projection/end.js
|
71
|
+
|
72
|
+
test: all
|
73
|
+
@$(JS_TESTER) $(shell find . -name "*-test.js" \! -path "./node_modules/*")
|
74
|
+
|
75
|
+
%.min.js: %.js Makefile
|
76
|
+
@rm -f $@
|
77
|
+
$(JS_UGLIFY) $< -c -m -o $@
|
78
|
+
|
79
|
+
d3%js: Makefile
|
80
|
+
@rm -f $@
|
81
|
+
@cat $(filter %.js,$^) > $@.tmp
|
82
|
+
$(JS_UGLIFY) $@.tmp -b indent-level=2 -o $@
|
83
|
+
@rm $@.tmp
|
84
|
+
@chmod a-w $@
|
85
|
+
|
86
|
+
clean:
|
87
|
+
rm -f d3.*.js
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# D3 Plugins
|
2
|
+
|
3
|
+
This is a repository for sharing D3 plugins.
|
4
|
+
|
5
|
+
Each plugin should live in a directory that matches its name.
|
6
|
+
|
7
|
+
## Running Tests
|
8
|
+
|
9
|
+
The tests use [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/):
|
10
|
+
|
11
|
+
brew install node
|
12
|
+
|
13
|
+
Next, from the root directory of this repository, install dependencies:
|
14
|
+
|
15
|
+
npm install
|
16
|
+
|
17
|
+
To run the tests, use:
|
18
|
+
|
19
|
+
npm test
|
@@ -0,0 +1,301 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
// Inspired by http://informationandvisualization.de/blog/box-plot
|
4
|
+
d3.box = function() {
|
5
|
+
var width = 1,
|
6
|
+
height = 1,
|
7
|
+
duration = 0,
|
8
|
+
domain = null,
|
9
|
+
value = Number,
|
10
|
+
whiskers = boxWhiskers,
|
11
|
+
quartiles = boxQuartiles,
|
12
|
+
tickFormat = null;
|
13
|
+
|
14
|
+
// For each small multiple…
|
15
|
+
function box(g) {
|
16
|
+
g.each(function(d, i) {
|
17
|
+
d = d.map(value).sort(d3.ascending);
|
18
|
+
var g = d3.select(this),
|
19
|
+
n = d.length,
|
20
|
+
min = d[0],
|
21
|
+
max = d[n - 1];
|
22
|
+
|
23
|
+
// Compute quartiles. Must return exactly 3 elements.
|
24
|
+
var quartileData = d.quartiles = quartiles(d);
|
25
|
+
|
26
|
+
// Compute whiskers. Must return exactly 2 elements, or null.
|
27
|
+
var whiskerIndices = whiskers && whiskers.call(this, d, i),
|
28
|
+
whiskerData = whiskerIndices && whiskerIndices.map(function(i) { return d[i]; });
|
29
|
+
|
30
|
+
// Compute outliers. If no whiskers are specified, all data are "outliers".
|
31
|
+
// We compute the outliers as indices, so that we can join across transitions!
|
32
|
+
var outlierIndices = whiskerIndices
|
33
|
+
? d3.range(0, whiskerIndices[0]).concat(d3.range(whiskerIndices[1] + 1, n))
|
34
|
+
: d3.range(n);
|
35
|
+
|
36
|
+
// Compute the new x-scale.
|
37
|
+
var x1 = d3.scale.linear()
|
38
|
+
.domain(domain && domain.call(this, d, i) || [min, max])
|
39
|
+
.range([height, 0]);
|
40
|
+
|
41
|
+
// Retrieve the old x-scale, if this is an update.
|
42
|
+
var x0 = this.__chart__ || d3.scale.linear()
|
43
|
+
.domain([0, Infinity])
|
44
|
+
.range(x1.range());
|
45
|
+
|
46
|
+
// Stash the new scale.
|
47
|
+
this.__chart__ = x1;
|
48
|
+
|
49
|
+
// Note: the box, median, and box tick elements are fixed in number,
|
50
|
+
// so we only have to handle enter and update. In contrast, the outliers
|
51
|
+
// and other elements are variable, so we need to exit them! Variable
|
52
|
+
// elements also fade in and out.
|
53
|
+
|
54
|
+
// Update center line: the vertical line spanning the whiskers.
|
55
|
+
var center = g.selectAll("line.center")
|
56
|
+
.data(whiskerData ? [whiskerData] : []);
|
57
|
+
|
58
|
+
center.enter().insert("line", "rect")
|
59
|
+
.attr("class", "center")
|
60
|
+
.attr("x1", width / 2)
|
61
|
+
.attr("y1", function(d) { return x0(d[0]); })
|
62
|
+
.attr("x2", width / 2)
|
63
|
+
.attr("y2", function(d) { return x0(d[1]); })
|
64
|
+
.style("opacity", 1e-6)
|
65
|
+
.transition()
|
66
|
+
.duration(duration)
|
67
|
+
.style("opacity", 1)
|
68
|
+
.attr("y1", function(d) { return x1(d[0]); })
|
69
|
+
.attr("y2", function(d) { return x1(d[1]); });
|
70
|
+
|
71
|
+
center.transition()
|
72
|
+
.duration(duration)
|
73
|
+
.style("opacity", 1)
|
74
|
+
.attr("y1", function(d) { return x1(d[0]); })
|
75
|
+
.attr("y2", function(d) { return x1(d[1]); });
|
76
|
+
|
77
|
+
center.exit().transition()
|
78
|
+
.duration(duration)
|
79
|
+
.style("opacity", 1e-6)
|
80
|
+
.attr("y1", function(d) { return x1(d[0]); })
|
81
|
+
.attr("y2", function(d) { return x1(d[1]); })
|
82
|
+
.remove();
|
83
|
+
|
84
|
+
// Update innerquartile box.
|
85
|
+
var box = g.selectAll("rect.box")
|
86
|
+
.data([quartileData]);
|
87
|
+
|
88
|
+
box.enter().append("rect")
|
89
|
+
.attr("class", "box")
|
90
|
+
.attr("x", 0)
|
91
|
+
.attr("y", function(d) { return x0(d[2]); })
|
92
|
+
.attr("width", width)
|
93
|
+
.attr("height", function(d) { return x0(d[0]) - x0(d[2]); })
|
94
|
+
.transition()
|
95
|
+
.duration(duration)
|
96
|
+
.attr("y", function(d) { return x1(d[2]); })
|
97
|
+
.attr("height", function(d) { return x1(d[0]) - x1(d[2]); });
|
98
|
+
|
99
|
+
box.transition()
|
100
|
+
.duration(duration)
|
101
|
+
.attr("y", function(d) { return x1(d[2]); })
|
102
|
+
.attr("height", function(d) { return x1(d[0]) - x1(d[2]); });
|
103
|
+
|
104
|
+
// Update median line.
|
105
|
+
var medianLine = g.selectAll("line.median")
|
106
|
+
.data([quartileData[1]]);
|
107
|
+
|
108
|
+
medianLine.enter().append("line")
|
109
|
+
.attr("class", "median")
|
110
|
+
.attr("x1", 0)
|
111
|
+
.attr("y1", x0)
|
112
|
+
.attr("x2", width)
|
113
|
+
.attr("y2", x0)
|
114
|
+
.transition()
|
115
|
+
.duration(duration)
|
116
|
+
.attr("y1", x1)
|
117
|
+
.attr("y2", x1);
|
118
|
+
|
119
|
+
medianLine.transition()
|
120
|
+
.duration(duration)
|
121
|
+
.attr("y1", x1)
|
122
|
+
.attr("y2", x1);
|
123
|
+
|
124
|
+
// Update whiskers.
|
125
|
+
var whisker = g.selectAll("line.whisker")
|
126
|
+
.data(whiskerData || []);
|
127
|
+
|
128
|
+
whisker.enter().insert("line", "circle, text")
|
129
|
+
.attr("class", "whisker")
|
130
|
+
.attr("x1", 0)
|
131
|
+
.attr("y1", x0)
|
132
|
+
.attr("x2", width)
|
133
|
+
.attr("y2", x0)
|
134
|
+
.style("opacity", 1e-6)
|
135
|
+
.transition()
|
136
|
+
.duration(duration)
|
137
|
+
.attr("y1", x1)
|
138
|
+
.attr("y2", x1)
|
139
|
+
.style("opacity", 1);
|
140
|
+
|
141
|
+
whisker.transition()
|
142
|
+
.duration(duration)
|
143
|
+
.attr("y1", x1)
|
144
|
+
.attr("y2", x1)
|
145
|
+
.style("opacity", 1);
|
146
|
+
|
147
|
+
whisker.exit().transition()
|
148
|
+
.duration(duration)
|
149
|
+
.attr("y1", x1)
|
150
|
+
.attr("y2", x1)
|
151
|
+
.style("opacity", 1e-6)
|
152
|
+
.remove();
|
153
|
+
|
154
|
+
// Update outliers.
|
155
|
+
var outlier = g.selectAll("circle.outlier")
|
156
|
+
.data(outlierIndices, Number);
|
157
|
+
|
158
|
+
outlier.enter().insert("circle", "text")
|
159
|
+
.attr("class", "outlier")
|
160
|
+
.attr("r", 5)
|
161
|
+
.attr("cx", width / 2)
|
162
|
+
.attr("cy", function(i) { return x0(d[i]); })
|
163
|
+
.style("opacity", 1e-6)
|
164
|
+
.transition()
|
165
|
+
.duration(duration)
|
166
|
+
.attr("cy", function(i) { return x1(d[i]); })
|
167
|
+
.style("opacity", 1);
|
168
|
+
|
169
|
+
outlier.transition()
|
170
|
+
.duration(duration)
|
171
|
+
.attr("cy", function(i) { return x1(d[i]); })
|
172
|
+
.style("opacity", 1);
|
173
|
+
|
174
|
+
outlier.exit().transition()
|
175
|
+
.duration(duration)
|
176
|
+
.attr("cy", function(i) { return x1(d[i]); })
|
177
|
+
.style("opacity", 1e-6)
|
178
|
+
.remove();
|
179
|
+
|
180
|
+
// Compute the tick format.
|
181
|
+
var format = tickFormat || x1.tickFormat(8);
|
182
|
+
|
183
|
+
// Update box ticks.
|
184
|
+
var boxTick = g.selectAll("text.box")
|
185
|
+
.data(quartileData);
|
186
|
+
|
187
|
+
boxTick.enter().append("text")
|
188
|
+
.attr("class", "box")
|
189
|
+
.attr("dy", ".3em")
|
190
|
+
.attr("dx", function(d, i) { return i & 1 ? 6 : -6 })
|
191
|
+
.attr("x", function(d, i) { return i & 1 ? width : 0 })
|
192
|
+
.attr("y", x0)
|
193
|
+
.attr("text-anchor", function(d, i) { return i & 1 ? "start" : "end"; })
|
194
|
+
.text(format)
|
195
|
+
.transition()
|
196
|
+
.duration(duration)
|
197
|
+
.attr("y", x1);
|
198
|
+
|
199
|
+
boxTick.transition()
|
200
|
+
.duration(duration)
|
201
|
+
.text(format)
|
202
|
+
.attr("y", x1);
|
203
|
+
|
204
|
+
// Update whisker ticks. These are handled separately from the box
|
205
|
+
// ticks because they may or may not exist, and we want don't want
|
206
|
+
// to join box ticks pre-transition with whisker ticks post-.
|
207
|
+
var whiskerTick = g.selectAll("text.whisker")
|
208
|
+
.data(whiskerData || []);
|
209
|
+
|
210
|
+
whiskerTick.enter().append("text")
|
211
|
+
.attr("class", "whisker")
|
212
|
+
.attr("dy", ".3em")
|
213
|
+
.attr("dx", 6)
|
214
|
+
.attr("x", width)
|
215
|
+
.attr("y", x0)
|
216
|
+
.text(format)
|
217
|
+
.style("opacity", 1e-6)
|
218
|
+
.transition()
|
219
|
+
.duration(duration)
|
220
|
+
.attr("y", x1)
|
221
|
+
.style("opacity", 1);
|
222
|
+
|
223
|
+
whiskerTick.transition()
|
224
|
+
.duration(duration)
|
225
|
+
.text(format)
|
226
|
+
.attr("y", x1)
|
227
|
+
.style("opacity", 1);
|
228
|
+
|
229
|
+
whiskerTick.exit().transition()
|
230
|
+
.duration(duration)
|
231
|
+
.attr("y", x1)
|
232
|
+
.style("opacity", 1e-6)
|
233
|
+
.remove();
|
234
|
+
});
|
235
|
+
d3.timer.flush();
|
236
|
+
}
|
237
|
+
|
238
|
+
box.width = function(x) {
|
239
|
+
if (!arguments.length) return width;
|
240
|
+
width = x;
|
241
|
+
return box;
|
242
|
+
};
|
243
|
+
|
244
|
+
box.height = function(x) {
|
245
|
+
if (!arguments.length) return height;
|
246
|
+
height = x;
|
247
|
+
return box;
|
248
|
+
};
|
249
|
+
|
250
|
+
box.tickFormat = function(x) {
|
251
|
+
if (!arguments.length) return tickFormat;
|
252
|
+
tickFormat = x;
|
253
|
+
return box;
|
254
|
+
};
|
255
|
+
|
256
|
+
box.duration = function(x) {
|
257
|
+
if (!arguments.length) return duration;
|
258
|
+
duration = x;
|
259
|
+
return box;
|
260
|
+
};
|
261
|
+
|
262
|
+
box.domain = function(x) {
|
263
|
+
if (!arguments.length) return domain;
|
264
|
+
domain = x == null ? x : d3.functor(x);
|
265
|
+
return box;
|
266
|
+
};
|
267
|
+
|
268
|
+
box.value = function(x) {
|
269
|
+
if (!arguments.length) return value;
|
270
|
+
value = x;
|
271
|
+
return box;
|
272
|
+
};
|
273
|
+
|
274
|
+
box.whiskers = function(x) {
|
275
|
+
if (!arguments.length) return whiskers;
|
276
|
+
whiskers = x;
|
277
|
+
return box;
|
278
|
+
};
|
279
|
+
|
280
|
+
box.quartiles = function(x) {
|
281
|
+
if (!arguments.length) return quartiles;
|
282
|
+
quartiles = x;
|
283
|
+
return box;
|
284
|
+
};
|
285
|
+
|
286
|
+
return box;
|
287
|
+
};
|
288
|
+
|
289
|
+
function boxWhiskers(d) {
|
290
|
+
return [0, d.length - 1];
|
291
|
+
}
|
292
|
+
|
293
|
+
function boxQuartiles(d) {
|
294
|
+
return [
|
295
|
+
d3.quantile(d, .25),
|
296
|
+
d3.quantile(d, .5),
|
297
|
+
d3.quantile(d, .75)
|
298
|
+
];
|
299
|
+
}
|
300
|
+
|
301
|
+
})();
|