hyper-d3 1.0.0.lap23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +313 -0
- data/README.md +118 -0
- data/Rakefile +31 -0
- data/hyper-d3.gemspec +27 -0
- data/lib/d3.rb +68 -0
- data/lib/d3/arc.rb +29 -0
- data/lib/d3/area.rb +53 -0
- data/lib/d3/axis.rb +79 -0
- data/lib/d3/band_scale.rb +30 -0
- data/lib/d3/collections.rb +9 -0
- data/lib/d3/color.rb +76 -0
- data/lib/d3/color_schemes.rb +34 -0
- data/lib/d3/continuous_scale.rb +60 -0
- data/lib/d3/creator.rb +11 -0
- data/lib/d3/curve.rb +74 -0
- data/lib/d3/dsv.rb +103 -0
- data/lib/d3/ease.rb +319 -0
- data/lib/d3/format.rb +95 -0
- data/lib/d3/histograms.rb +46 -0
- data/lib/d3/interpolate.rb +125 -0
- data/lib/d3/line.rb +27 -0
- data/lib/d3/map.rb +48 -0
- data/lib/d3/misc.rb +15 -0
- data/lib/d3/native.rb +112 -0
- data/lib/d3/nest.rb +100 -0
- data/lib/d3/ordinal_scale.rb +39 -0
- data/lib/d3/path.rb +24 -0
- data/lib/d3/pie.rb +25 -0
- data/lib/d3/point_scale.rb +27 -0
- data/lib/d3/polygon.rb +18 -0
- data/lib/d3/quadtree.rb +89 -0
- data/lib/d3/quantile_scale.rb +19 -0
- data/lib/d3/quantize_scale.rb +20 -0
- data/lib/d3/radial_area.rb +55 -0
- data/lib/d3/radial_line.rb +27 -0
- data/lib/d3/random.rb +14 -0
- data/lib/d3/search.rb +30 -0
- data/lib/d3/selection.rb +151 -0
- data/lib/d3/sequential_scale.rb +31 -0
- data/lib/d3/set.rb +30 -0
- data/lib/d3/source/d3-drag.js +234 -0
- data/lib/d3/source/d3-scale-chromatic.js +484 -0
- data/lib/d3/source/d3.js +17178 -0
- data/lib/d3/stack.rb +13 -0
- data/lib/d3/statistics.rb +81 -0
- data/lib/d3/symbol.rb +70 -0
- data/lib/d3/threshold_scale.rb +22 -0
- data/lib/d3/time_format.rb +47 -0
- data/lib/d3/time_interval.rb +85 -0
- data/lib/d3/transformations.rb +16 -0
- data/lib/hyper-d3.rb +17 -0
- data/lib/hyperloop/d3/component.rb +12 -0
- data/lib/hyperloop/d3/mixin.rb +59 -0
- data/lib/hyperloop/d3/version.rb +5 -0
- data/spec/arc_spec.rb +80 -0
- data/spec/area_spec.rb +98 -0
- data/spec/axis_spec.rb +174 -0
- data/spec/band_scale_spec.rb +73 -0
- data/spec/color_spec.rb +74 -0
- data/spec/continuous_scale_spec.rb +217 -0
- data/spec/coverage_spec.rb +16 -0
- data/spec/creator_spec.rb +15 -0
- data/spec/curve_spec.rb +206 -0
- data/spec/dsv_spec.rb +194 -0
- data/spec/ease_spec.rb +370 -0
- data/spec/format_spec.rb +87 -0
- data/spec/histograms_spec.rb +61 -0
- data/spec/html/index.html.erb +11 -0
- data/spec/interpolate_spec.rb +152 -0
- data/spec/line_spec.rb +54 -0
- data/spec/map_spec.rb +80 -0
- data/spec/misc_spec.rb +21 -0
- data/spec/nest_spec.rb +89 -0
- data/spec/objects_spec.rb +22 -0
- data/spec/ordinal_scale_spec.rb +59 -0
- data/spec/path_spec.rb +65 -0
- data/spec/pie_spec.rb +114 -0
- data/spec/point_scale_spec.rb +58 -0
- data/spec/polygon_spec.rb +51 -0
- data/spec/quadtree_spec.rb +128 -0
- data/spec/quantile_scale_spec.rb +24 -0
- data/spec/quantize_scale_spec.rb +40 -0
- data/spec/radial_area_spec.rb +123 -0
- data/spec/radial_line_spec.rb +50 -0
- data/spec/random_spec.rb +34 -0
- data/spec/search_spec.rb +69 -0
- data/spec/selection_data_spec.rb +64 -0
- data/spec/selection_manipulation_spec.rb +166 -0
- data/spec/selection_spec.rb +187 -0
- data/spec/sequential_scale_spec.rb +90 -0
- data/spec/set_spec.rb +57 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/stack_spec.rb +5 -0
- data/spec/statistics_spec.rb +65 -0
- data/spec/symbol_spec.rb +116 -0
- data/spec/test_app/.gitignore +23 -0
- data/spec/test_app/Gemfile +7 -0
- data/spec/test_app/Gemfile.lock +206 -0
- data/spec/test_app/README.md +9 -0
- data/spec/test_app/Rakefile +6 -0
- data/spec/test_app/app/assets/config/manifest.js +3 -0
- data/spec/test_app/app/assets/images/.keep +0 -0
- data/spec/test_app/app/assets/javascripts/application.js +13 -0
- data/spec/test_app/app/assets/javascripts/cable.js +13 -0
- data/spec/test_app/app/assets/javascripts/channels/.keep +0 -0
- data/spec/test_app/app/assets/javascripts/data/elections_2016.rb +10 -0
- data/spec/test_app/app/assets/javascripts/data/harry_potter.rb +19 -0
- data/spec/test_app/app/assets/javascripts/data/iphones.rb +29 -0
- data/spec/test_app/app/assets/javascripts/data/london_population.rb +26 -0
- data/spec/test_app/app/assets/javascripts/data/man_vs_horse.rb +55 -0
- data/spec/test_app/app/assets/javascripts/data/mtg_modern_colors.rb +96 -0
- data/spec/test_app/app/assets/javascripts/data/mtg_modern_creatures.rb +116 -0
- data/spec/test_app/app/assets/javascripts/data/olympics_2016_medals.rb +100 -0
- data/spec/test_app/app/assets/javascripts/data/paradox.rb +60 -0
- data/spec/test_app/app/assets/javascripts/data/polish_pms.rb +28 -0
- data/spec/test_app/app/assets/javascripts/data/star_trek_voyager.rb +183 -0
- data/spec/test_app/app/assets/javascripts/data/weather_in_london.rb +381 -0
- data/spec/test_app/app/assets/javascripts/elections_2016.rb +27 -0
- data/spec/test_app/app/assets/javascripts/harry_potter.rb +42 -0
- data/spec/test_app/app/assets/javascripts/iphones.rb +54 -0
- data/spec/test_app/app/assets/javascripts/london_population.rb +53 -0
- data/spec/test_app/app/assets/javascripts/london_population_area.rb +49 -0
- data/spec/test_app/app/assets/javascripts/man_vs_horse.rb +60 -0
- data/spec/test_app/app/assets/javascripts/mtg_modern_colors.rb +56 -0
- data/spec/test_app/app/assets/javascripts/mtg_modern_creatures.rb +70 -0
- data/spec/test_app/app/assets/javascripts/olympics_2016_medals.rb +62 -0
- data/spec/test_app/app/assets/javascripts/paradox.rb +64 -0
- data/spec/test_app/app/assets/javascripts/polish_pms.rb +60 -0
- data/spec/test_app/app/assets/javascripts/star_trek_voyager.rb +44 -0
- data/spec/test_app/app/assets/javascripts/weather_in_london.rb +69 -0
- data/spec/test_app/app/assets/stylesheets/application.css +15 -0
- data/spec/test_app/app/channels/application_cable/channel.rb +4 -0
- data/spec/test_app/app/channels/application_cable/connection.rb +4 -0
- data/spec/test_app/app/controllers/application_controller.rb +27 -0
- data/spec/test_app/app/controllers/concerns/.keep +0 -0
- data/spec/test_app/app/helpers/application_helper.rb +2 -0
- data/spec/test_app/app/jobs/application_job.rb +2 -0
- data/spec/test_app/app/mailers/application_mailer.rb +4 -0
- data/spec/test_app/app/models/application_record.rb +3 -0
- data/spec/test_app/app/models/concerns/.keep +0 -0
- data/spec/test_app/app/views/application/index.erb +18 -0
- data/spec/test_app/app/views/application/visualization.erb +28 -0
- data/spec/test_app/app/views/layouts/application.html.erb +13 -0
- data/spec/test_app/bin/bundle +3 -0
- data/spec/test_app/bin/rails +4 -0
- data/spec/test_app/bin/rake +4 -0
- data/spec/test_app/bin/setup +38 -0
- data/spec/test_app/bin/update +29 -0
- data/spec/test_app/bin/yarn +11 -0
- data/spec/test_app/config.ru +5 -0
- data/spec/test_app/config/application.rb +18 -0
- data/spec/test_app/config/boot.rb +3 -0
- data/spec/test_app/config/cable.yml +10 -0
- data/spec/test_app/config/database.yml +25 -0
- data/spec/test_app/config/environment.rb +5 -0
- data/spec/test_app/config/environments/development.rb +54 -0
- data/spec/test_app/config/environments/production.rb +91 -0
- data/spec/test_app/config/environments/test.rb +42 -0
- data/spec/test_app/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/test_app/config/initializers/assets.rb +14 -0
- data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/test_app/config/initializers/cookies_serializer.rb +5 -0
- data/spec/test_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/test_app/config/initializers/inflections.rb +16 -0
- data/spec/test_app/config/initializers/mime_types.rb +4 -0
- data/spec/test_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/test_app/config/locales/en.yml +33 -0
- data/spec/test_app/config/puma.rb +56 -0
- data/spec/test_app/config/routes.rb +5 -0
- data/spec/test_app/config/secrets.yml +32 -0
- data/spec/test_app/config/spring.rb +6 -0
- data/spec/test_app/db/seeds.rb +7 -0
- data/spec/test_app/lib/assets/.keep +0 -0
- data/spec/test_app/lib/tasks/.keep +0 -0
- data/spec/test_app/log/.keep +0 -0
- data/spec/test_app/package.json +5 -0
- data/spec/test_app/public/404.html +67 -0
- data/spec/test_app/public/422.html +67 -0
- data/spec/test_app/public/500.html +66 -0
- data/spec/test_app/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/test_app/public/apple-touch-icon.png +0 -0
- data/spec/test_app/public/favicon.ico +0 -0
- data/spec/test_app/public/robots.txt +1 -0
- data/spec/test_app/test/application_system_test_case.rb +5 -0
- data/spec/test_app/test/controllers/.keep +0 -0
- data/spec/test_app/test/fixtures/.keep +0 -0
- data/spec/test_app/test/fixtures/files/.keep +0 -0
- data/spec/test_app/test/helpers/.keep +0 -0
- data/spec/test_app/test/integration/.keep +0 -0
- data/spec/test_app/test/mailers/.keep +0 -0
- data/spec/test_app/test/models/.keep +0 -0
- data/spec/test_app/test/system/.keep +0 -0
- data/spec/test_app/test/test_helper.rb +10 -0
- data/spec/test_app/tmp/.keep +0 -0
- data/spec/test_app/vendor/.keep +0 -0
- data/spec/threshold_scale_spec.rb +28 -0
- data/spec/time_format_spec.rb +100 -0
- data/spec/time_interval_spec.rb +314 -0
- data/spec/transformations_spec.rb +51 -0
- data/startrekvoyager.png +0 -0
- metadata +529 -0
data/lib/d3/nest.rb
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
module D3
|
2
|
+
class Nest
|
3
|
+
def initialize
|
4
|
+
@native = `window.d3`.JS.nest
|
5
|
+
@depth = 0
|
6
|
+
@rollup = false
|
7
|
+
end
|
8
|
+
|
9
|
+
def key(&block)
|
10
|
+
@native.JS.key(block)
|
11
|
+
@depth += 1
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def sort_keys(key=nil,&block)
|
16
|
+
if block
|
17
|
+
raise ArgumentError, "Pass block or :ascending/:descending"
|
18
|
+
else
|
19
|
+
if key == :ascending
|
20
|
+
block = `window.d3.ascending`
|
21
|
+
elsif key == :descending
|
22
|
+
block = `window.d3.descending`
|
23
|
+
else
|
24
|
+
raise ArgumentError, "Pass block or :ascending/:descending"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
@native.JS.sortKeys(block)
|
28
|
+
self
|
29
|
+
end
|
30
|
+
|
31
|
+
def sort_values(key=nil,&block)
|
32
|
+
if block
|
33
|
+
raise ArgumentError, "Pass block or :ascending/:descending"
|
34
|
+
else
|
35
|
+
if key == :ascending
|
36
|
+
block = `window.d3.ascending`
|
37
|
+
elsif key == :descending
|
38
|
+
block = `window.d3.descending`
|
39
|
+
else
|
40
|
+
raise ArgumentError, "Pass block or :ascending/:descending"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
@native.JS.sortValues(block)
|
44
|
+
self
|
45
|
+
end
|
46
|
+
|
47
|
+
# This is really attrocious, why don't we just return nested hash?
|
48
|
+
def map(array)
|
49
|
+
result = @native.JS.map(array)
|
50
|
+
map_map(result, @depth)
|
51
|
+
end
|
52
|
+
|
53
|
+
def entries(array)
|
54
|
+
result = @native.JS.entries(array)
|
55
|
+
map_entries(result, @depth)
|
56
|
+
end
|
57
|
+
|
58
|
+
def object(array)
|
59
|
+
@native.JS.object(array)
|
60
|
+
end
|
61
|
+
|
62
|
+
def rollup(&block)
|
63
|
+
@native.JS.rollup(block)
|
64
|
+
@rollup = true
|
65
|
+
self
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def map_entries(result, depth)
|
71
|
+
if depth == 0
|
72
|
+
result
|
73
|
+
else
|
74
|
+
if @rollup and depth == 1
|
75
|
+
result.map{|o| [`o.key`, `o.value`]}
|
76
|
+
else
|
77
|
+
result.map{|o| [`o.key`, map_entries(`o.values`, depth-1)]}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def map_map(result, depth)
|
83
|
+
if depth == 0
|
84
|
+
result
|
85
|
+
else
|
86
|
+
output = D3::Map.new(`window.d3.map()`)
|
87
|
+
D3::Map.new(result).each do |vs, k|
|
88
|
+
output.set(k, map_map(vs, depth-1))
|
89
|
+
end
|
90
|
+
output
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
class << self
|
96
|
+
def nest
|
97
|
+
D3::Nest.new
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module D3
|
2
|
+
class OrdinalScale
|
3
|
+
include D3::Native
|
4
|
+
|
5
|
+
def call(t)
|
6
|
+
@native.call(t)
|
7
|
+
end
|
8
|
+
attributes_d3 %i[domain range]
|
9
|
+
alias_native_new :copy
|
10
|
+
|
11
|
+
# D3 is trying to reinvent Ruby symbols here
|
12
|
+
def unknown(new_value=nil)
|
13
|
+
if new_value == nil
|
14
|
+
v = @native.JS.unknown
|
15
|
+
if `JSON.stringify(v) === '{"name":"implicit"}'`
|
16
|
+
:implicit
|
17
|
+
else
|
18
|
+
v
|
19
|
+
end
|
20
|
+
else
|
21
|
+
if new_value == :implicit
|
22
|
+
new_value = `window.d3.scaleImplicit`
|
23
|
+
end
|
24
|
+
@native.JS.unknown(new_value)
|
25
|
+
self
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class << self
|
31
|
+
def scale_ordinal(*args)
|
32
|
+
D3::OrdinalScale.new @d3.JS.scaleOrdinal(*args)
|
33
|
+
end
|
34
|
+
|
35
|
+
def scale_implicit
|
36
|
+
:implicit
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/d3/path.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module D3
|
2
|
+
class Path
|
3
|
+
include D3::Native
|
4
|
+
|
5
|
+
# D3 methods aren't chainable, but there's no reason why they shouldn't be
|
6
|
+
aliases_native_chainable %i[
|
7
|
+
moveTo
|
8
|
+
closePath
|
9
|
+
lineTo
|
10
|
+
quadraticCurveTo
|
11
|
+
bezierCurveTo
|
12
|
+
arcTo
|
13
|
+
arc
|
14
|
+
rect
|
15
|
+
]
|
16
|
+
alias_native :to_s, :toString
|
17
|
+
end
|
18
|
+
|
19
|
+
class << self
|
20
|
+
def path
|
21
|
+
D3::Path.new @d3.JS.path
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/d3/pie.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module D3
|
2
|
+
class PieGenerator
|
3
|
+
include D3::Native
|
4
|
+
def call(*args)
|
5
|
+
@native.call(*args).map{|o|
|
6
|
+
`Opal.hash({ data: o.data, index: o.index, value: o.value, start_angle: o.startAngle, end_angle: o.endAngle, pad_angle: o.padAngle })`
|
7
|
+
}
|
8
|
+
end
|
9
|
+
|
10
|
+
attributes_d3_block %i[
|
11
|
+
startAngle
|
12
|
+
endAngle
|
13
|
+
padAngle
|
14
|
+
value
|
15
|
+
sort
|
16
|
+
sortValues
|
17
|
+
]
|
18
|
+
end
|
19
|
+
|
20
|
+
class << self
|
21
|
+
def pie
|
22
|
+
D3::PieGenerator.new @d3.JS.pie
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module D3
|
2
|
+
class PointScale
|
3
|
+
include D3::Native
|
4
|
+
|
5
|
+
def call(t)
|
6
|
+
v = @native.call(t)
|
7
|
+
`v === undefined ? nil : v`
|
8
|
+
end
|
9
|
+
attributes_d3 %i[
|
10
|
+
domain
|
11
|
+
range
|
12
|
+
rangeRound
|
13
|
+
padding
|
14
|
+
align
|
15
|
+
round
|
16
|
+
]
|
17
|
+
alias_native_new :copy
|
18
|
+
alias_native :bandwidth
|
19
|
+
alias_native :step
|
20
|
+
end
|
21
|
+
|
22
|
+
class << self
|
23
|
+
def scale_point
|
24
|
+
D3::PointScale.new @d3.JS.scalePoint
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/d3/polygon.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module D3
|
2
|
+
class << self
|
3
|
+
# This could maybe use more OO interface in addition to this?
|
4
|
+
# Like D3::Polygon.new(points).area etc.
|
5
|
+
|
6
|
+
aliases_d3 %i[
|
7
|
+
polygonArea
|
8
|
+
polygonCentroid
|
9
|
+
polygonContains
|
10
|
+
polygonLength
|
11
|
+
]
|
12
|
+
|
13
|
+
def polygon_hull(points)
|
14
|
+
hull = @d3.JS.polygonHull(points)
|
15
|
+
`hull === null ? nil : hull`
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/d3/quadtree.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
module D3
|
2
|
+
class Quad
|
3
|
+
include D3::Native
|
4
|
+
|
5
|
+
def internal?
|
6
|
+
`#@native.constructor === Array`
|
7
|
+
end
|
8
|
+
|
9
|
+
def leaf?
|
10
|
+
`#@native.constructor !== Array`
|
11
|
+
end
|
12
|
+
|
13
|
+
def next
|
14
|
+
return nil if internal?
|
15
|
+
return nil if `#@native.next == undefined`
|
16
|
+
D3::Quad.new(`#@native.next`)
|
17
|
+
end
|
18
|
+
|
19
|
+
def data
|
20
|
+
return nil if internal?
|
21
|
+
`#@native.data`
|
22
|
+
end
|
23
|
+
|
24
|
+
def children
|
25
|
+
return nil if leaf?
|
26
|
+
result = (0..3).map do |i|
|
27
|
+
q = `#@native[i]`
|
28
|
+
if `q == null`
|
29
|
+
nil
|
30
|
+
else
|
31
|
+
D3::Quad.new(q)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class QuadTree
|
38
|
+
include D3::Native
|
39
|
+
aliases_native %i[data find size]
|
40
|
+
aliases_native_chainable %i[add addAll cover remove removeAll]
|
41
|
+
alias_native_new :copy
|
42
|
+
attribute_d3 :extent
|
43
|
+
|
44
|
+
# visit/visitAfter functions have stupid JS habit of using non-nil return as control
|
45
|
+
# and that messes up with languages which have automatic return
|
46
|
+
# Maybe worth rewriting to require explicit StopIteration ?
|
47
|
+
def visit
|
48
|
+
@native.JS.visit(proc do |node, x0, y0, x1, y1|
|
49
|
+
yield(D3::Quad.new(node), x0, y0, x1, y1)
|
50
|
+
end)
|
51
|
+
self
|
52
|
+
end
|
53
|
+
|
54
|
+
def visit_after
|
55
|
+
@native.JS.visitAfter(proc do |node, x0, y0, x1, y1|
|
56
|
+
yield(D3::Quad.new(node), x0, y0, x1, y1)
|
57
|
+
end)
|
58
|
+
self
|
59
|
+
end
|
60
|
+
|
61
|
+
def root
|
62
|
+
D3::Quad.new @native.JS.root
|
63
|
+
end
|
64
|
+
|
65
|
+
def x(&block)
|
66
|
+
if block_given?
|
67
|
+
@native.JS.x(block)
|
68
|
+
self
|
69
|
+
else
|
70
|
+
@native.JS.x
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def y(&block)
|
75
|
+
if block_given?
|
76
|
+
@native.JS.y(block)
|
77
|
+
self
|
78
|
+
else
|
79
|
+
@native.JS.y
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class << self
|
85
|
+
def quadtree(*args)
|
86
|
+
D3::QuadTree.new @d3.JS.quadtree(*args)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module D3
|
2
|
+
class QuantileScale
|
3
|
+
include D3::Native
|
4
|
+
|
5
|
+
def call(t)
|
6
|
+
@native.call(t)
|
7
|
+
end
|
8
|
+
|
9
|
+
attributes_d3 %i[domain range]
|
10
|
+
aliases_native %i[invertExtent quantiles]
|
11
|
+
alias_native_new :copy
|
12
|
+
end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def scale_quantile
|
16
|
+
D3::QuantileScale.new @d3.JS.scaleQuantile
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module D3
|
2
|
+
class QuantizeScale
|
3
|
+
include D3::Native
|
4
|
+
|
5
|
+
def call(t)
|
6
|
+
@native.call(t)
|
7
|
+
end
|
8
|
+
|
9
|
+
attributes_d3 %i[domain range]
|
10
|
+
aliases_native %i[invertExtent ticks tickFormat]
|
11
|
+
alias_native_chainable :nice
|
12
|
+
alias_native_new :copy
|
13
|
+
end
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def scale_quantize
|
17
|
+
D3::QuantizeScale.new @d3.JS.scaleQuantize
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module D3
|
2
|
+
class RadialAreaGenerator
|
3
|
+
include D3::Native
|
4
|
+
|
5
|
+
def call(*args)
|
6
|
+
result = @native.call(*args)
|
7
|
+
`result === null ? nil : result`
|
8
|
+
end
|
9
|
+
|
10
|
+
attributes_d3_block %i[
|
11
|
+
angle
|
12
|
+
startAngle
|
13
|
+
endAngle
|
14
|
+
radius
|
15
|
+
innerRadius
|
16
|
+
outerRadius
|
17
|
+
defined
|
18
|
+
]
|
19
|
+
|
20
|
+
def curve(new_value=`undefined`)
|
21
|
+
if `new_value === undefined`
|
22
|
+
D3::Curve.new @native.JS.curve
|
23
|
+
else
|
24
|
+
@native.JS.curve(new_value.to_n)
|
25
|
+
self
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def line_start_angle
|
30
|
+
D3::RadialLineGenerator.new @native.JS.lineStartAngle
|
31
|
+
end
|
32
|
+
|
33
|
+
def line_end_angle
|
34
|
+
D3::RadialLineGenerator.new @native.JS.lineEndAngle
|
35
|
+
end
|
36
|
+
|
37
|
+
def line_inner_radius
|
38
|
+
D3::RadialLineGenerator.new @native.JS.lineInnerRadius
|
39
|
+
end
|
40
|
+
|
41
|
+
def line_outer_radius
|
42
|
+
D3::RadialLineGenerator.new @native.JS.lineOuterRadius
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class << self
|
47
|
+
def radial_area(data = nil)
|
48
|
+
if data
|
49
|
+
D3::RadialAreaGenerator.new @d3.JS.radialArea(data.to_n)
|
50
|
+
else
|
51
|
+
D3::RadialAreaGenerator.new @d3.JS.radialArea
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module D3
|
2
|
+
class RadialLineGenerator
|
3
|
+
include D3::Native
|
4
|
+
|
5
|
+
def call(*args)
|
6
|
+
result = @native.call(*args)
|
7
|
+
`result === null ? nil : result`
|
8
|
+
end
|
9
|
+
|
10
|
+
attributes_d3_block %i[angle radius defined]
|
11
|
+
|
12
|
+
def curve(new_value=`undefined`)
|
13
|
+
if `new_value === undefined`
|
14
|
+
D3::Curve.new @native.JS.curve
|
15
|
+
else
|
16
|
+
@native.JS.curve(new_value.to_n)
|
17
|
+
self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class << self
|
23
|
+
def radial_line
|
24
|
+
D3::RadialLineGenerator.new @d3.JS.radialLine
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|