rubyvis 0.3.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/History.txt +16 -0
- data/Manifest.txt +61 -0
- data/README.txt +9 -7
- data/Rakefile +1 -1
- data/lib/rubyvis.rb +3 -17
- data/lib/rubyvis/color/color.rb +11 -13
- data/lib/rubyvis/flatten.rb +5 -7
- data/lib/rubyvis/layout/stack.rb +15 -10
- data/lib/rubyvis/mark.rb +10 -2
- data/lib/rubyvis/mark/area.rb +5 -3
- data/lib/rubyvis/mark/line.rb +4 -3
- data/lib/rubyvis/mark/panel.rb +8 -3
- data/lib/rubyvis/mark/rule.rb +1 -0
- data/lib/rubyvis/scene/svg_area.rb +17 -17
- data/lib/rubyvis/scene/svg_curve.rb +8 -5
- data/lib/rubyvis/scene/svg_line.rb +32 -29
- data/lib/rubyvis/scene/svg_scene.rb +3 -5
- data/lib/rubyvis/scene/svg_wedge.rb +4 -3
- data/lib/rubyvis/vector.rb +104 -0
- data/spec/anchor_spec.rb +29 -0
- data/spec/area_spec.rb +83 -0
- data/spec/bar_spec.rb +3 -0
- data/spec/color_spec.rb +13 -1
- data/spec/dot_spec.rb +41 -0
- data/spec/fixtures/anchor.html +25 -0
- data/spec/fixtures/anchor.svg +1 -0
- data/spec/fixtures/area-segmented.html +29 -0
- data/spec/fixtures/area_interpolation.html +66 -0
- data/spec/fixtures/area_interpolation.svg +1 -0
- data/spec/fixtures/area_segmented.svg +1 -0
- data/spec/fixtures/dot-anchor.html +33 -0
- data/spec/fixtures/dot_anchor.svg +1 -0
- data/spec/fixtures/layers.js +28 -0
- data/spec/fixtures/layout_arc.svg +1 -0
- data/spec/fixtures/layout_cluster.html +39 -0
- data/spec/fixtures/layout_cluster.svg +1 -0
- data/spec/fixtures/layout_cluster_left_group_2.html +39 -0
- data/spec/fixtures/layout_cluster_left_group_2.svg +1 -0
- data/spec/fixtures/layout_grid.html +34 -0
- data/spec/fixtures/layout_grid.svg +1 -0
- data/spec/fixtures/layout_horizon.svg +24 -0
- data/spec/fixtures/layout_indent.html +39 -0
- data/spec/fixtures/layout_indent.svg +1 -0
- data/spec/fixtures/layout_matrix.svg +1 -0
- data/spec/fixtures/layout_pack.html +38 -0
- data/spec/fixtures/layout_pack.svg +1 -0
- data/spec/fixtures/layout_partition_fill.html +40 -0
- data/spec/fixtures/layout_partition_fill.svg +32 -0
- data/spec/fixtures/layout_tree_orient_left.html +36 -0
- data/spec/fixtures/layout_tree_orient_left.svg +1 -0
- data/spec/fixtures/layout_tree_orient_radial_breadth_20.html +39 -0
- data/spec/fixtures/layout_tree_orient_radial_breadth_20.svg +1 -0
- data/spec/fixtures/layout_tree_orient_top.svg +1 -0
- data/spec/fixtures/layout_treemap.svg +1 -0
- data/spec/fixtures/line_interpolation.html +63 -0
- data/spec/fixtures/line_interpolation.svg +1 -0
- data/spec/fixtures/line_interpolation_segmented.html +65 -0
- data/spec/fixtures/line_interpolation_segmented.svg +1 -0
- data/spec/fixtures/protovis-r3.3.js +287 -0
- data/spec/fixtures/rule-anchor.html +33 -0
- data/spec/fixtures/rule_anchor.svg +1 -0
- data/spec/fixtures/stack-expand.html +41 -0
- data/spec/fixtures/stack-silohouette.html +41 -0
- data/spec/fixtures/stack-wiggle.html +41 -0
- data/spec/fixtures/stack_expand.svg +1 -0
- data/spec/fixtures/stack_silohouette.svg +1 -0
- data/spec/fixtures/stack_wiggle.svg +1 -0
- data/spec/fixtures/svgscene.html +26 -0
- data/spec/fixtures/wedge-anchor.html +33 -0
- data/spec/fixtures/wedge-donut.html +35 -0
- data/spec/fixtures/wedge_anchor.svg +1 -0
- data/spec/fixtures/wedge_donut.svg +1 -0
- data/spec/flatten_spec.rb +47 -0
- data/spec/layout_arc_spec.rb +7 -26
- data/spec/layout_cluster_spec.rb +52 -0
- data/spec/layout_grid_spec.rb +40 -0
- data/spec/layout_horizon_spec.rb +6 -25
- data/spec/layout_indent_spec.rb +53 -0
- data/spec/layout_matrix_spec.rb +25 -52
- data/spec/layout_pack_spec.rb +49 -0
- data/spec/layout_partition_spec.rb +45 -0
- data/spec/layout_stack_spec.rb +60 -0
- data/spec/layout_tree_spec.rb +56 -0
- data/spec/layout_treemap_spec.rb +41 -0
- data/spec/line_spec.rb +118 -0
- data/spec/mark_spec.rb +4 -0
- data/spec/panel_spec.rb +12 -1
- data/spec/rule_spec.rb +34 -0
- data/spec/spec_helper.rb +158 -3
- data/spec/vector_spec.rb +36 -0
- data/spec/wedge_spec.rb +66 -0
- metadata +67 -14
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
=== 0.4.0 / 2011-01-03
|
2
|
+
|
3
|
+
Massive bug fix. Please, update ASAP
|
4
|
+
|
5
|
+
* Implemented Vector, used on segmented lines
|
6
|
+
* Bug fix: Segmented areas with basis, cardinal and monotone interpolation was parsed using linear interpolation
|
7
|
+
* Bug fix: Incorrect color when using hsl with decimal h
|
8
|
+
* Bug fix: Segmented areas doesn't change color
|
9
|
+
* Bug fix: Wedge without inner radius return incorrect path
|
10
|
+
* Bug fix: Stack layout with 'inside-out' order crash.
|
11
|
+
* Bug fix: Incorrect marks properties evaluation order
|
12
|
+
* Bug fix: Segmented lines raises an Exception
|
13
|
+
* New specs: Flatten, Grid, Dot, Vector, Rule, Cluster, Partition, Wedge, Indent, Tree, Treemap
|
14
|
+
* Improved specs: Area, Line, Panel
|
15
|
+
* Deleted dependence of Rubyvis.document. Each panel without parent have an independent REXML::Document
|
16
|
+
|
1
17
|
=== 0.3.6 / 2010-12-28
|
2
18
|
|
3
19
|
* Matrix layout implemented. Example and spec available.
|
data/Manifest.txt
CHANGED
@@ -105,25 +105,84 @@ lib/rubyvis/scene/svg_scene.rb
|
|
105
105
|
lib/rubyvis/scene/svg_wedge.rb
|
106
106
|
lib/rubyvis/sceneelement.rb
|
107
107
|
lib/rubyvis/transform.rb
|
108
|
+
lib/rubyvis/vector.rb
|
108
109
|
spec/anchor_spec.rb
|
109
110
|
spec/area_spec.rb
|
110
111
|
spec/bar_spec.rb
|
111
112
|
spec/color_spec.rb
|
112
113
|
spec/dom_spec.rb
|
114
|
+
spec/dot_spec.rb
|
115
|
+
spec/fixtures/anchor.html
|
116
|
+
spec/fixtures/anchor.svg
|
117
|
+
spec/fixtures/area-segmented.html
|
118
|
+
spec/fixtures/area_interpolation.html
|
119
|
+
spec/fixtures/area_interpolation.svg
|
120
|
+
spec/fixtures/area_segmented.svg
|
121
|
+
spec/fixtures/dot-anchor.html
|
122
|
+
spec/fixtures/dot_anchor.svg
|
123
|
+
spec/fixtures/layers.js
|
124
|
+
spec/fixtures/layout_arc.svg
|
125
|
+
spec/fixtures/layout_cluster.html
|
126
|
+
spec/fixtures/layout_cluster.svg
|
127
|
+
spec/fixtures/layout_cluster_left_group_2.html
|
128
|
+
spec/fixtures/layout_cluster_left_group_2.svg
|
129
|
+
spec/fixtures/layout_grid.html
|
130
|
+
spec/fixtures/layout_grid.svg
|
131
|
+
spec/fixtures/layout_horizon.svg
|
132
|
+
spec/fixtures/layout_indent.html
|
133
|
+
spec/fixtures/layout_indent.svg
|
134
|
+
spec/fixtures/layout_matrix.svg
|
135
|
+
spec/fixtures/layout_pack.html
|
136
|
+
spec/fixtures/layout_pack.svg
|
137
|
+
spec/fixtures/layout_partition_fill.html
|
138
|
+
spec/fixtures/layout_partition_fill.svg
|
139
|
+
spec/fixtures/layout_tree_orient_left.html
|
140
|
+
spec/fixtures/layout_tree_orient_left.svg
|
141
|
+
spec/fixtures/layout_tree_orient_radial_breadth_20.html
|
142
|
+
spec/fixtures/layout_tree_orient_radial_breadth_20.svg
|
143
|
+
spec/fixtures/layout_tree_orient_top.svg
|
144
|
+
spec/fixtures/layout_treemap.svg
|
145
|
+
spec/fixtures/line_interpolation.html
|
146
|
+
spec/fixtures/line_interpolation.svg
|
147
|
+
spec/fixtures/line_interpolation_segmented.html
|
148
|
+
spec/fixtures/line_interpolation_segmented.svg
|
149
|
+
spec/fixtures/protovis-r3.3.js
|
150
|
+
spec/fixtures/rule-anchor.html
|
151
|
+
spec/fixtures/rule_anchor.svg
|
152
|
+
spec/fixtures/stack-expand.html
|
153
|
+
spec/fixtures/stack-silohouette.html
|
154
|
+
spec/fixtures/stack-wiggle.html
|
155
|
+
spec/fixtures/stack_expand.svg
|
156
|
+
spec/fixtures/stack_silohouette.svg
|
157
|
+
spec/fixtures/stack_wiggle.svg
|
158
|
+
spec/fixtures/svgscene.html
|
159
|
+
spec/fixtures/wedge-anchor.html
|
160
|
+
spec/fixtures/wedge-donut.html
|
161
|
+
spec/fixtures/wedge_anchor.svg
|
162
|
+
spec/fixtures/wedge_donut.svg
|
163
|
+
spec/flatten_spec.rb
|
113
164
|
spec/histogram_spec.rb
|
114
165
|
spec/internal_spec.rb
|
115
166
|
spec/javascript_behaviour_spec.rb
|
116
167
|
spec/label_spec.rb
|
117
168
|
spec/layout_arc_spec.rb
|
169
|
+
spec/layout_cluster_spec.rb
|
170
|
+
spec/layout_grid_spec.rb
|
118
171
|
spec/layout_horizon_spec.rb
|
172
|
+
spec/layout_indent_spec.rb
|
119
173
|
spec/layout_matrix_spec.rb
|
174
|
+
spec/layout_pack_spec.rb
|
175
|
+
spec/layout_partition_spec.rb
|
120
176
|
spec/layout_stack_spec.rb
|
177
|
+
spec/layout_tree_spec.rb
|
178
|
+
spec/layout_treemap_spec.rb
|
121
179
|
spec/line_spec.rb
|
122
180
|
spec/mark_spec.rb
|
123
181
|
spec/nest_spec.rb
|
124
182
|
spec/panel_spec.rb
|
125
183
|
spec/readme_spec.rb
|
126
184
|
spec/ruby_api_spec.rb
|
185
|
+
spec/rule_spec.rb
|
127
186
|
spec/scale_linear_datetime_spec.rb
|
128
187
|
spec/scale_linear_spec.rb
|
129
188
|
spec/scale_log_spec.rb
|
@@ -131,6 +190,8 @@ spec/scale_ordinal_spec.rb
|
|
131
190
|
spec/scale_spec.rb
|
132
191
|
spec/spec.opts
|
133
192
|
spec/spec_helper.rb
|
193
|
+
spec/vector_spec.rb
|
194
|
+
spec/wedge_spec.rb
|
134
195
|
vendor/protovis/protovis-r3.3.js
|
135
196
|
vendor/protovis/src/behavior/Behavior.js
|
136
197
|
vendor/protovis/src/behavior/Drag.js
|
data/README.txt
CHANGED
@@ -4,16 +4,16 @@
|
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
|
-
Ruby port of Protovis[http://vis.stanford.edu/protovis/], a
|
7
|
+
Ruby port of Protovis[http://vis.stanford.edu/protovis/], a Javascript visualization toolkit.
|
8
8
|
|
9
9
|
== FEATURES/PROBLEMS:
|
10
10
|
|
11
|
-
This library implements almost completely
|
11
|
+
This library implements almost completely core API of protovis, including all static marks, SVG builder class and data classes. Spec coverage is near 90%
|
12
12
|
|
13
13
|
Implemented:
|
14
14
|
|
15
15
|
* Marks: All, except transient and transitions.
|
16
|
-
* Layout: Cluster, Grid, Horizon, Indent, Pack, Partition, Stack, Tree and Treemap. To implement: Bullet,
|
16
|
+
* Layout: Arc, Cluster, Grid, Horizon, Indent, Matrix, Pack, Partition, Stack, Tree and Treemap. To implement: Bullet, Force, and Rollup.
|
17
17
|
|
18
18
|
Using protovis examples[http://vis.stanford.edu/protovis/ex/] as reference
|
19
19
|
|
@@ -35,8 +35,8 @@ Using protovis examples[http://vis.stanford.edu/protovis/ex/] as reference
|
|
35
35
|
* Treemap
|
36
36
|
* Networks:
|
37
37
|
* Arc
|
38
|
-
|
39
|
-
|
38
|
+
* Matrix
|
39
|
+
|
40
40
|
I try to maintain, when posible, complete compatibility with Javascript API, including camel case naming of functions. Johnson [http://github.com/jbarnette/johnson] - the lovely Javascript wrapper inside Ruby embrace - is our friend to test implementation of basic object.
|
41
41
|
|
42
42
|
User could use +pv+ freely, cause is defined as a global method which call Rubyvis.
|
@@ -48,6 +48,7 @@ User could use +pv+ freely, cause is defined as a global method which call Rubyv
|
|
48
48
|
* color/Color.js
|
49
49
|
* color/Colors.js
|
50
50
|
* data/Arrays.js
|
51
|
+
* data/Flatten.js
|
51
52
|
* data/Histogram.js
|
52
53
|
* data/Numbers.js
|
53
54
|
* data/LinearScale.js
|
@@ -57,12 +58,13 @@ User could use +pv+ freely, cause is defined as a global method which call Rubyv
|
|
57
58
|
* data/OrdinalScale.js
|
58
59
|
* data/Scale.js
|
59
60
|
* layout/Arc.js
|
60
|
-
* layout/Layout.js
|
61
61
|
* layout/Cluster.js
|
62
62
|
* layout/Grid.js
|
63
63
|
* layout/Hierarchy.js
|
64
64
|
* layout/Horizon.js
|
65
65
|
* layout/Indent.js
|
66
|
+
* layout/Layout.js
|
67
|
+
* layout/Matrix.js
|
66
68
|
* layout/Network.js
|
67
69
|
* layout/Pack.js
|
68
70
|
* layout/Partition.js
|
@@ -144,7 +146,7 @@ Tested on Ruby 1.8.7, 1.9.1, 1.9.2-p0 and ruby-head (future 1.9.3)
|
|
144
146
|
|
145
147
|
== INSTALL:
|
146
148
|
|
147
|
-
$
|
149
|
+
$ gem install rubyvis
|
148
150
|
|
149
151
|
== LICENSE:
|
150
152
|
|
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ h=Hoe.spec 'rubyvis' do
|
|
18
18
|
self.version=Rubyvis::VERSION
|
19
19
|
self.extra_dev_deps << ["coderay",">=0"] << ["haml",">=0"] << ["nokogiri", ">=0"] << ["rspec",">=2.0"]
|
20
20
|
end
|
21
|
-
|
21
|
+
desc "Publicar docs en rubyforge"
|
22
22
|
task :publicar_docs => [:clean, :docs] do
|
23
23
|
#ruby %{agregar_adsense_a_doc.rb}
|
24
24
|
path = File.expand_path("~/.rubyforge/user-config.yml")
|
data/lib/rubyvis.rb
CHANGED
@@ -5,6 +5,8 @@ require 'rexml/formatters/default'
|
|
5
5
|
|
6
6
|
require 'pp'
|
7
7
|
require 'rubyvis/internals'
|
8
|
+
require 'rubyvis/vector'
|
9
|
+
|
8
10
|
require 'rubyvis/sceneelement'
|
9
11
|
require 'rubyvis/property'
|
10
12
|
require 'rubyvis/nest'
|
@@ -30,7 +32,7 @@ require 'rubyvis/mark/shorcut_methods'
|
|
30
32
|
module Rubyvis
|
31
33
|
@document=nil
|
32
34
|
# Rubyvis version
|
33
|
-
VERSION = '0.
|
35
|
+
VERSION = '0.4.0'
|
34
36
|
# Protovis API on which current Rubyvis is based
|
35
37
|
PROTOVIS_API_VERSION='3.3'
|
36
38
|
# You actually can do it! http://snipplr.com/view/2137/uses-for-infinity-in-ruby/
|
@@ -71,22 +73,6 @@ module Rubyvis
|
|
71
73
|
def self.parent
|
72
74
|
lambda {|*args| self.parent.index}
|
73
75
|
end
|
74
|
-
def self.clear_document
|
75
|
-
@document=REXML::Document.new
|
76
|
-
@document.add_element("document")
|
77
|
-
end
|
78
|
-
def self.document
|
79
|
-
if @document.nil?
|
80
|
-
@document=REXML::Document.new
|
81
|
-
@document.add_element("document")
|
82
|
-
end
|
83
|
-
@document.root
|
84
|
-
end
|
85
|
-
def self.to_svg
|
86
|
-
s=""
|
87
|
-
@document.write(s)
|
88
|
-
s
|
89
|
-
end
|
90
76
|
end
|
91
77
|
|
92
78
|
# Alias for Rubyvis module
|
data/lib/rubyvis/color/color.rb
CHANGED
@@ -36,9 +36,9 @@ module Rubyvis
|
|
36
36
|
end
|
37
37
|
|
38
38
|
if ['hsla','hsl'].include? color_type
|
39
|
-
h=m2[0].
|
40
|
-
s=m2[1].to_f / 100
|
41
|
-
l=m2[2].to_f / 100
|
39
|
+
h=m2[0].to_f
|
40
|
+
s=m2[1].to_f / 100.0
|
41
|
+
l=m2[2].to_f / 100.0
|
42
42
|
return Color::Hsl.new(h,s,l,a).rgb
|
43
43
|
end
|
44
44
|
|
@@ -106,7 +106,7 @@ module Rubyvis
|
|
106
106
|
# errors.
|
107
107
|
# * @param [k] {number} an optional scale factor; defaults to 1.
|
108
108
|
def brighter(k)
|
109
|
-
self.rgb.
|
109
|
+
self.rgb.brighter(k)
|
110
110
|
end
|
111
111
|
|
112
112
|
# Returns a new color that is a brighter version of this color. The behavior of
|
@@ -328,7 +328,7 @@ module Rubyvis
|
|
328
328
|
# color to create a brighter version of this color. Although brighter and
|
329
329
|
# darker are inverse operations, the results of a series of invocations of
|
330
330
|
# these two methods might be inconsistent because of rounding errors.
|
331
|
-
def
|
331
|
+
def brighter(k=1)
|
332
332
|
k = 0.7**k
|
333
333
|
i = 30
|
334
334
|
r=self.r
|
@@ -390,7 +390,6 @@ module Rubyvis
|
|
390
390
|
h = self.h
|
391
391
|
s = self.s
|
392
392
|
l = self.l
|
393
|
-
|
394
393
|
# Some simple corrections for h, s and l. */
|
395
394
|
h = h % 360
|
396
395
|
h += 360 if (h < 0)
|
@@ -402,22 +401,21 @@ module Rubyvis
|
|
402
401
|
m1 = 2 * l - m2
|
403
402
|
v=lambda {|h1|
|
404
403
|
if (h1 > 360)
|
405
|
-
h1 -= 360
|
404
|
+
h1 -= 360
|
406
405
|
elsif (h1 < 0)
|
407
406
|
h1 += 360
|
408
407
|
end
|
409
408
|
|
410
409
|
|
411
|
-
return m1 + (m2 - m1) * h1 / 60 if (h1 < 60)
|
412
|
-
return m2 if (h1 < 180)
|
413
|
-
return m1 + (m2 - m1) * (240 - h1) / 60 if (h1 < 240)
|
410
|
+
return m1 + (m2 - m1) * h1 / 60.0 if (h1 < 60.0)
|
411
|
+
return m2 if (h1 < 180.0)
|
412
|
+
return m1 + (m2 - m1) * (240.0 - h1) / 60.0 if (h1 < 240.0)
|
414
413
|
return m1
|
415
414
|
}
|
416
|
-
vv=lambda {|h1|
|
417
|
-
(v.call(h1) * 255).round
|
418
|
-
}
|
419
415
|
|
416
|
+
vv=lambda {|h1| (v.call(h1) * 255).round}
|
420
417
|
Rubyvis.rgb(vv.call(h + 120), vv.call(h), vv.call(h - 120), a)
|
418
|
+
|
421
419
|
end
|
422
420
|
end
|
423
421
|
|
data/lib/rubyvis/flatten.rb
CHANGED
@@ -62,16 +62,14 @@ module Rubyvis
|
|
62
62
|
# @returns {pv.Nest} this.
|
63
63
|
|
64
64
|
def key(k, f=nil)
|
65
|
-
@keys.push(OpenStruct.new({:name=>
|
65
|
+
@keys.push(OpenStruct.new({:name=>k, :value=>f}))
|
66
66
|
@leaf=nil
|
67
67
|
self
|
68
68
|
end
|
69
69
|
|
70
70
|
# Flattens using the specified leaf function. This is an alternative to
|
71
|
-
# specifying an explicit set of keys; the tiers of the underlying tree
|
72
|
-
# determined dynamically by recursing on the values, and the resulting keys
|
73
|
-
# will be stored in the entries <tt>keys</tt> attribute. The leaf function must
|
74
|
-
# return true for leaves, and false for internal nodes.
|
71
|
+
# specifying an explicit set of keys; the tiers of the underlying tree
|
72
|
+
# will be determined dynamically by recursing on the values, and the resulting keys will be stored in the entries +:keys+ attribute. The leaf function must return true for leaves, and false for internal nodes.
|
75
73
|
#
|
76
74
|
# @param {function} f a leaf function.
|
77
75
|
# @returns {pv.Nest} this.
|
@@ -99,7 +97,7 @@ module Rubyvis
|
|
99
97
|
@stack.pop
|
100
98
|
}
|
101
99
|
else
|
102
|
-
@entries.push(@stack+value)
|
100
|
+
@entries.push(@stack+[value])
|
103
101
|
end
|
104
102
|
end
|
105
103
|
# Returns the flattened array. Each entry in the array is an object; each
|
@@ -117,7 +115,7 @@ module Rubyvis
|
|
117
115
|
@entries.map {|stack|
|
118
116
|
m={}
|
119
117
|
@keys.each_with_index {|k,i|
|
120
|
-
v
|
118
|
+
v=stack[i]
|
121
119
|
m[k.name]=k.value ? k.value.js_call(self,v) : v
|
122
120
|
}
|
123
121
|
m
|
data/lib/rubyvis/layout/stack.rb
CHANGED
@@ -107,7 +107,7 @@ module Rubyvis
|
|
107
107
|
end
|
108
108
|
def values(f=nil)
|
109
109
|
if f.nil?
|
110
|
-
@values
|
110
|
+
return @values
|
111
111
|
else
|
112
112
|
@_values=Rubyvis.functor(f)
|
113
113
|
return self
|
@@ -171,17 +171,20 @@ module Rubyvis
|
|
171
171
|
|
172
172
|
# order
|
173
173
|
_index=nil
|
174
|
-
case
|
175
|
-
when "inside-out"
|
176
|
-
|
177
|
-
|
174
|
+
case s.order
|
175
|
+
when "inside-out"
|
176
|
+
|
177
|
+
max = dy.map {|v| Rubyvis.max_index(v) }
|
178
|
+
_map = Rubyvis.range(n).sort {|a,b| max[a] <=> max[b]}
|
179
|
+
|
178
180
|
sums = dy.map {|v| Rubyvis.sum(v)}
|
179
181
|
top = 0
|
180
182
|
bottom = 0
|
181
183
|
tops = []
|
182
184
|
bottoms = []
|
185
|
+
|
183
186
|
n.times {|i|
|
184
|
-
j =
|
187
|
+
j = _map[i]
|
185
188
|
if (top < bottom)
|
186
189
|
top += sums[j];
|
187
190
|
tops.push(j);
|
@@ -190,8 +193,9 @@ module Rubyvis
|
|
190
193
|
bottoms.push(j);
|
191
194
|
end
|
192
195
|
}
|
193
|
-
_index = bottoms.reverse+tops
|
194
196
|
|
197
|
+
_index = bottoms.reverse+tops
|
198
|
+
|
195
199
|
when "reverse"
|
196
200
|
_index = Rubyvis.range(n - 1, -1, -1)
|
197
201
|
else
|
@@ -237,13 +241,13 @@ module Rubyvis
|
|
237
241
|
y[_index[0]][j] = 0
|
238
242
|
|
239
243
|
k = 0
|
240
|
-
n.times {|i|k += dy[i][j]}
|
244
|
+
n.times {|i| k += dy[i][j]}
|
241
245
|
if (k!=0)
|
242
246
|
k = h / k.to_f
|
243
247
|
n.times {|i| dy[i][j] *= k}
|
244
248
|
else
|
245
249
|
k = h / n.to_f
|
246
|
-
n.times { dy[i][j] = k}
|
250
|
+
n.times {|i| dy[i][j] = k}
|
247
251
|
end
|
248
252
|
}
|
249
253
|
else
|
@@ -267,6 +271,7 @@ module Rubyvis
|
|
267
271
|
px = i < 0 ? (horizontal ? "l" : "b") : orient[i + 1,1]
|
268
272
|
py = orient[0,1]
|
269
273
|
|
274
|
+
|
270
275
|
@values=values
|
271
276
|
@prop.each {|k,v|
|
272
277
|
@prop[k]=@none
|
@@ -279,7 +284,7 @@ module Rubyvis
|
|
279
284
|
|
280
285
|
def layer
|
281
286
|
that=self
|
282
|
-
value = Rubyvis::Mark.new().data(lambda {
|
287
|
+
value = Rubyvis::Mark.new().data(lambda { that.values[self.parent.index] }).top(proxy("t")).left(proxy("l")).right(proxy("r")).
|
283
288
|
bottom(proxy("b")).
|
284
289
|
width(proxy("w")).
|
285
290
|
height(proxy("h"))
|
data/lib/rubyvis/mark.rb
CHANGED
@@ -618,6 +618,7 @@ module Rubyvis
|
|
618
618
|
p a if $DEBUG
|
619
619
|
a
|
620
620
|
}).visible(lambda {
|
621
|
+
|
621
622
|
self.scene.target[index].visible
|
622
623
|
}).id(lambda {
|
623
624
|
self.scene.target[index].id
|
@@ -660,6 +661,7 @@ module Rubyvis
|
|
660
661
|
'left'
|
661
662
|
end
|
662
663
|
}).text_baseline(lambda {
|
664
|
+
|
663
665
|
if ['right','left','center'].include? self.name
|
664
666
|
'middle'
|
665
667
|
elsif self.name=='top'
|
@@ -833,7 +835,10 @@ module Rubyvis
|
|
833
835
|
end
|
834
836
|
def bind_bind(mark)
|
835
837
|
begin
|
836
|
-
mark._properties.
|
838
|
+
#puts "Binding:#{mark.type}->#{mark._properties.map {|v| v.name}}"
|
839
|
+
|
840
|
+
mark._properties.reverse.each {|v|
|
841
|
+
|
837
842
|
#p v.name
|
838
843
|
k=v.name
|
839
844
|
if !@seen.has_key?(k)
|
@@ -864,10 +869,14 @@ module Rubyvis
|
|
864
869
|
@types={1=>[],2=>[],3=>[]}
|
865
870
|
@_data=nil
|
866
871
|
@_required=[]
|
872
|
+
#puts "Binding!"
|
867
873
|
bind_bind(self)
|
868
874
|
bind_bind((self.class).defaults)
|
869
875
|
@types[1].reverse!
|
870
876
|
@types[3].reverse!
|
877
|
+
#puts "***"
|
878
|
+
#pp @types[3]
|
879
|
+
#puts "***"
|
871
880
|
mark=self
|
872
881
|
begin
|
873
882
|
properties.each {|name,v|
|
@@ -1056,7 +1065,6 @@ module Rubyvis
|
|
1056
1065
|
#p "#{type}:"+props.map {|prop| prop.name}.join(",")
|
1057
1066
|
props.each do |prop|
|
1058
1067
|
v=prop.value
|
1059
|
-
|
1060
1068
|
# p "#{prop.name}=#{v}"
|
1061
1069
|
if prop._type==3
|
1062
1070
|
v=v.js_apply(self, Mark.stack)
|